Fix order of build flags.

Place user-specified CPPFLAGS and LDFLAGS later so that user-specified
non-standard paths that have old versions of qpdf don't cause the
build to fail.
This commit is contained in:
Jay Berkenbilt 2012-06-21 21:20:35 -04:00
parent 81e8752362
commit 30dbf94f53
2 changed files with 16 additions and 6 deletions

View File

@ -1,5 +1,11 @@
2012-06-21 Jay Berkenbilt <ejb@ql.org> 2012-06-21 Jay Berkenbilt <ejb@ql.org>
* make/libtool.mk: Place user-specified CPPFLAGS and LDFLAGS later
in the compilation so that if a user installs things in a
non-standard place that they have to tell the build about, earlier
versions of qpdf installed there won't break the build. Thanks to
Macports for reporting this. (Fixes bug 3468860.)
* Instead of using off_t in the public APIs, use qpdf_offset_t * Instead of using off_t in the public APIs, use qpdf_offset_t
instead. This is defined as long long in qpdf/Types.h. If your instead. This is defined as long long in qpdf/Types.h. If your
system doesn't support long long, you can redefine it. system doesn't support long long, you can redefine it.

View File

@ -40,18 +40,20 @@ endif
# 1 2 # 1 2
# Usage: $(call compile,src,includes) # Usage: $(call compile,src,includes)
define compile define compile
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \ $(CXX) $(CXXFLAGS) \
$(call depflags,$(basename $(call src_to_obj,$(1)))) \ $(call depflags,$(basename $(call src_to_obj,$(1)))) \
$(foreach I,$(2),-I$(I)) \ $(foreach I,$(2),-I$(I)) \
$(CPPFLAGS) \
-c $(1) -o $(call src_to_obj,$(1)) -c $(1) -o $(call src_to_obj,$(1))
endef endef
# 1 2 # 1 2
# Usage: $(call c_compile,src,includes) # Usage: $(call c_compile,src,includes)
define c_compile define c_compile
$(CC) $(CPPFLAGS) $(CFLAGS) \ $(CC) $(CFLAGS) \
$(call depflags,$(basename $(call c_src_to_obj,$(1)))) \ $(call depflags,$(basename $(call c_src_to_obj,$(1)))) \
$(foreach I,$(2),-I$(I)) \ $(foreach I,$(2),-I$(I)) \
$(CPPFLAGS) \
-c $(1) -o $(call c_src_to_obj,$(1)) -c $(1) -o $(call c_src_to_obj,$(1))
endef endef
@ -59,9 +61,10 @@ endef
# Usage: $(call libcompile,src,includes) # Usage: $(call libcompile,src,includes)
define libcompile define libcompile
$(LIBTOOL) --quiet --mode=compile \ $(LIBTOOL) --quiet --mode=compile \
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \ $(CXX) $(CXXFLAGS) \
$(call libdepflags,$(basename $(call src_to_obj,$(1)))) \ $(call libdepflags,$(basename $(call src_to_obj,$(1)))) \
$(foreach I,$(2),-I$(I)) \ $(foreach I,$(2),-I$(I)) \
$(CPPFLAGS) \
-c $(1) -o $(call src_to_obj,$(1)); \ -c $(1) -o $(call src_to_obj,$(1)); \
$(call fixdeps,$(basename $(call src_to_obj,$(1)))) $(call fixdeps,$(basename $(call src_to_obj,$(1))))
endef endef
@ -70,9 +73,10 @@ endef
# Usage: $(call libcompile,src,includes) # Usage: $(call libcompile,src,includes)
define c_libcompile define c_libcompile
$(LIBTOOL) --quiet --mode=compile \ $(LIBTOOL) --quiet --mode=compile \
$(CC) $(CPPFLAGS) $(CXXFLAGS) \ $(CC) $(CXXFLAGS) \
$(call libdepflags,$(basename $(call c_src_to_obj,$(1)))) \ $(call libdepflags,$(basename $(call c_src_to_obj,$(1)))) \
$(foreach I,$(2),-I$(I)) \ $(foreach I,$(2),-I$(I)) \
$(CPPFLAGS) \
-c $(1) -o $(call c_src_to_obj,$(1)); \ -c $(1) -o $(call c_src_to_obj,$(1)); \
$(call fixdeps,$(basename $(call src_to_obj,$(1)))) $(call fixdeps,$(basename $(call src_to_obj,$(1))))
endef endef
@ -90,14 +94,14 @@ endef
define makelib define makelib
$(LIBTOOL) --mode=link \ $(LIBTOOL) --mode=link \
$(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \ $(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \
-o $(2) $(1) $(3) $(4) \ -o $(2) $(1) $(4) $(3) \
-rpath $(libdir) -version-info $(5):$(6):$(7) -rpath $(libdir) -version-info $(5):$(6):$(7)
endef endef
# 1 2 3 4 # 1 2 3 4
# Usage: $(call makebin,objs,binary,ldflags,libs) # Usage: $(call makebin,objs,binary,ldflags,libs)
define makebin define makebin
$(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(1) -o $(2) $(3) $(4) $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(1) -o $(2) $(4) $(3)
endef endef
# Install target # Install target