summaryrefslogtreecommitdiff
path: root/examples/build.mk
diff options
context:
space:
mode:
Diffstat (limited to 'examples/build.mk')
-rw-r--r--examples/build.mk40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/build.mk b/examples/build.mk
new file mode 100644
index 0000000..12734b1
--- /dev/null
+++ b/examples/build.mk
@@ -0,0 +1,40 @@
+BINS_examples = \
+ pdf-bookmarks \
+ pdf-mod-info \
+ pdf-npages \
+ pdf-double-page-size \
+ pdf-invert-images \
+ pdf-create
+CBINS_examples = pdf-linearize
+
+TARGETS_examples = $(foreach B,$(BINS_examples) $(CBINS_examples),examples/$(OUTPUT_DIR)/$(call binname,$(B)))
+
+$(TARGETS_examples): $(TARGETS_qpdf)
+
+INCLUDES_examples = include
+
+TC_SRCS_examples = $(wildcard examples/*.cc)
+
+# -----
+
+$(foreach B,$(BINS_examples),$(eval \
+ OBJS_$(B) = $(call src_to_obj,examples/$(B).cc)))
+
+$(foreach B,$(CBINS_examples),$(eval \
+ OBJS_$(B) = $(call c_src_to_obj,examples/$(B).c)))
+
+ifeq ($(GENDEPS),1)
+-include $(foreach B,$(BINS_examples) $(CBINS_examples),$(call obj_to_dep,$(OBJS_$(B))))
+endif
+
+$(foreach B,$(BINS_examples),$(eval \
+ $(OBJS_$(B)): examples/$(OUTPUT_DIR)/%.$(OBJ): examples/$(B).cc ; \
+ $(call compile,examples/$(B).cc,$(INCLUDES_examples))))
+
+$(foreach B,$(CBINS_examples),$(eval \
+ $(OBJS_$(B)): examples/$(OUTPUT_DIR)/%.$(OBJ): examples/$(B).c ; \
+ $(call c_compile,examples/$(B).c,$(INCLUDES_examples))))
+
+$(foreach B,$(BINS_examples) $(CBINS_examples),$(eval \
+ examples/$(OUTPUT_DIR)/$(call binname,$(B)): $(OBJS_$(B)) ; \
+ $(call makebin,$(OBJS_$(B)),$$@,$(LDFLAGS) $(LDFLAGS_libqpdf),$(LIBS_libqpdf) $(LIBS))))