summaryrefslogtreecommitdiff
path: root/plugins/Makefile.plugin.mk
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 09:06:59 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 09:06:59 +0200
commit4ea2cc3bd4a7d9b1c54a9d33e6a1cf82e7c8c21d (patch)
treed2e54377d14d604356c86862a326f64ae64dadd6 /plugins/Makefile.plugin.mk
Imported Upstream version 0.18.1upstream/0.18.1
Diffstat (limited to 'plugins/Makefile.plugin.mk')
-rw-r--r--plugins/Makefile.plugin.mk78
1 files changed, 78 insertions, 0 deletions
diff --git a/plugins/Makefile.plugin.mk b/plugins/Makefile.plugin.mk
new file mode 100644
index 0000000..539de86
--- /dev/null
+++ b/plugins/Makefile.plugin.mk
@@ -0,0 +1,78 @@
+
+# Generic plug-in Makefile for Shotwell standard plugins.
+#
+# Requires PLUGIN and SRC_FILES be set to the name of the plugin binary (minus extension) and that
+# the directory is registered in plugins.mk.
+#
+# To use, include this file in each plug-in directory's Makefile after setting appropriate variables.
+# Also be sure that each plug-in has a dummy_main() function to satisfy valac's linkage.
+#
+# NOTE: This file is called from the cwd of each directory, hence the relative paths should be
+# read as such.
+
+ifndef VALAC
+VALAC := valac
+endif
+MAKE_FILES := Makefile ../Makefile.plugin.mk ../plugins.mk
+HEADER_FILES := ../shotwell-plugin-dev-1.0.vapi ../shotwell-plugin-dev-1.0.h \
+ ../shotwell-plugin-dev-1.0.deps
+
+include ../plugins.mk
+
+# automatically include shotwell-plugin-dev-1.0's dependencies
+# NOTE: This line will generate an error when running "make dist" from the master Makefile.
+# It can be safely ignored.
+PKGS := $(shell sed ':a;N;$$!ba;s/\n/ /g' ../shotwell-plugin-dev-1.0.deps) $(PKGS)
+
+# automatically include the shotwell-plugin-dev-1.0 package as a local dependency
+EXT_PKGS := $(PKGS)
+PKGS := shotwell-plugin-dev-1.0 $(PKGS) $(PLUGIN_PKGS)
+
+# automatically include the Resources.vala common file
+SRC_FILES := ../common/Resources.vala $(SRC_FILES)
+
+CFILES := $(notdir $(SRC_FILES:.vala=.c))
+OFILES := $(notdir $(SRC_FILES:.vala=.o))
+
+CFLAGS := `pkg-config --print-errors --cflags $(EXT_PKGS) $(PLUGIN_PKGS)` -nostdlib -export-dynamic $(PLUGIN_CFLAGS)
+LIBS := `pkg-config --print-errors --libs $(EXT_PKGS) $(PLUGIN_PKGS)`
+DEFINES := -D_VERSION='"$(PLUGINS_VERSION)"' -DGETTEXT_PACKAGE='"shotwell"'
+
+all: $(PLUGIN).so
+
+.stamp: $(SRC_FILES) $(MAKE_FILES) $(HEADER_FILES)
+ $(VALAC) --target-glib=$(MIN_GLIB_VERSION) -g --enable-checking --fatal-warnings --save-temps --compile --enable-deprecated \
+ --vapidir=../ $(foreach pkg,$(PKGS),--pkg=$(pkg)) $(foreach pkg,$(CUSTOM_VAPI_PKGS),--pkg=$(pkg)) \
+ -X -I../.. -X -fPIC \
+ $(foreach dfn,$(DEFINES),-X $(dfn)) \
+ $(USER_VALAFLAGS) \
+ --vapidir=../../vapi \
+ $(SRC_FILES)
+ @touch .stamp
+
+$(CFILES): .stamp
+ @
+
+$(OFILES): %.o: %.c $(CFILES)
+ $(CC) -c $(CFLAGS) $(DEFINES) -I../.. $(CFILES)
+
+$(PLUGIN).so: $(OFILES)
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared $(OFILES) $(LIBS) -o $@
+
+.PHONY: cleantemps
+cleantemps:
+ @rm -f $(notdir $(SRC_FILES:.vala=.c)) $(notdir $(SRC_FILES:.vala=.o))
+ @rm -f .stamp
+
+.PHONY: clean
+clean: cleantemps
+ @rm -f $(PLUGIN).so $(OFILES) $(CFILES)
+
+.PHONY: distclean
+distclean: clean
+
+.PHONY: listfiles
+listfiles:
+ @printf "plugins/$(PLUGIN)/Makefile $(foreach file,$(SRC_FILES),plugins/$(PLUGIN)/$(file)) "
+ @printf "$(foreach rc,$(RC_FILES),plugins/$(PLUGIN)/$(rc)) "
+