aboutsummaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-10-10 18:51:20 +0200
committerJay Berkenbilt <ejb@ql.org>2009-10-10 18:51:20 +0200
commitc7be2041b8c97129323a8a7ad6d8da0310d371f1 (patch)
tree34e0422395e05a6a50177868b9fb0d00967c0e96 /make
parentdd66ea8160e79003aa407a423a92899427ea6ffe (diff)
downloadqpdf-c7be2041b8c97129323a8a7ad6d8da0310d371f1.tar.zst
include external-libs
git-svn-id: svn+q:///qpdf/trunk@761 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'make')
-rw-r--r--make/gcc-linux.mk10
-rw-r--r--make/rules.mk22
2 files changed, 27 insertions, 5 deletions
diff --git a/make/gcc-linux.mk b/make/gcc-linux.mk
index e4fdbe02..6124357b 100644
--- a/make/gcc-linux.mk
+++ b/make/gcc-linux.mk
@@ -28,7 +28,7 @@ endef
# Usage: $(call c_compile,src,includes)
define c_compile
$(CC) $(CPPFLAGS) $(CFLAGS) \
- $(call depflags,$(basename $(call src_to_obj,$(1)))) \
+ $(call depflags,$(basename $(call c_src_to_obj,$(1)))) \
$(foreach I,$(2),-I$(I)) \
-c $(1) -o $(call c_src_to_obj,$(1))
endef
@@ -39,6 +39,12 @@ define libcompile
$(foreach I,$(2),-I$(I)) \
-c $(1) -o $(call src_to_obj,$(1))
endef
+define c_libcompile
+ $(CC) $(CPPFLAGS) $(CXXFLAGS) -fpic \
+ $(call depflags,$(basename $(call c_src_to_lobj,$(1)))) \
+ $(foreach I,$(2),-I$(I)) \
+ -c $(1) -o $(call c_src_to_obj,$(1))
+endef
# 1 2
@@ -52,7 +58,7 @@ endef
# 1 2 3 4 5
# Usage: $(call makelib,objs,library,current,revision,age)
define makelib
- $(RM) $2
+ $(RM) $(2) $(2).*
major=$$(( $(3) - $(5))); \
versuffix=$$major.$5.$4; \
$(CXX) $(CXXFLAGS) -shared -o $(2).$$versuffix $(1) \
diff --git a/make/rules.mk b/make/rules.mk
index a55087b5..efeb9a7f 100644
--- a/make/rules.mk
+++ b/make/rules.mk
@@ -1,18 +1,34 @@
include make/$(BUILDRULES).mk
+define firstelem
+$(word 1,$(subst /, ,$(1)))
+endef
+SPC := $(subst /, ,/)
+define lastelem
+$(subst $(SPC),/,$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1))))
+endef
+define objbase
+$(patsubst %.$(2),%.$(3),$(firstelem)/$(OUTPUT_DIR)/$(lastelem))
+endef
+
# Usage: $(call src_to_obj,srcs)
define src_to_obj
-$(foreach F,$(1),$(dir $(F))$(OUTPUT_DIR)/$(patsubst %.cc,%.$(OBJ),$(notdir $(F))))
+$(foreach F,$(1),$(call objbase,$(F),cc,$(OBJ)))
endef
# Usage: $(call c_src_to_obj,srcs)
define c_src_to_obj
-$(foreach F,$(1),$(dir $(F))$(OUTPUT_DIR)/$(patsubst %.c,%.$(OBJ),$(notdir $(F))))
+$(foreach F,$(1),$(call objbase,$(F),c,$(OBJ)))
endef
# Usage: $(call src_to_lobj,srcs)
define src_to_lobj
-$(foreach F,$(1),$(dir $(F))$(OUTPUT_DIR)/$(patsubst %.cc,%.$(LOBJ),$(notdir $(F))))
+$(foreach F,$(1),$(call objbase,$(F),cc,$(LOBJ)))
+endef
+
+# Usage: $(call c_src_to_lobj,srcs)
+define c_src_to_lobj
+$(foreach F,$(1),$(call objbase,$(F),c,$(LOBJ)))
endef
# Usage: $(call obj_to_dep,objs)