Commit 30dbf94f53a3fd9760242883bdc5bddbaa0c9f44

Authored by Jay Berkenbilt
1 parent 81e87523

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.
Showing 2 changed files with 16 additions and 6 deletions
ChangeLog
1 2012-06-21 Jay Berkenbilt <ejb@ql.org> 1 2012-06-21 Jay Berkenbilt <ejb@ql.org>
2 2
  3 + * make/libtool.mk: Place user-specified CPPFLAGS and LDFLAGS later
  4 + in the compilation so that if a user installs things in a
  5 + non-standard place that they have to tell the build about, earlier
  6 + versions of qpdf installed there won't break the build. Thanks to
  7 + Macports for reporting this. (Fixes bug 3468860.)
  8 +
3 * Instead of using off_t in the public APIs, use qpdf_offset_t 9 * Instead of using off_t in the public APIs, use qpdf_offset_t
4 instead. This is defined as long long in qpdf/Types.h. If your 10 instead. This is defined as long long in qpdf/Types.h. If your
5 system doesn't support long long, you can redefine it. 11 system doesn't support long long, you can redefine it.
make/libtool.mk
@@ -40,18 +40,20 @@ endif @@ -40,18 +40,20 @@ endif
40 # 1 2 40 # 1 2
41 # Usage: $(call compile,src,includes) 41 # Usage: $(call compile,src,includes)
42 define compile 42 define compile
43 - $(CXX) $(CPPFLAGS) $(CXXFLAGS) \ 43 + $(CXX) $(CXXFLAGS) \
44 $(call depflags,$(basename $(call src_to_obj,$(1)))) \ 44 $(call depflags,$(basename $(call src_to_obj,$(1)))) \
45 $(foreach I,$(2),-I$(I)) \ 45 $(foreach I,$(2),-I$(I)) \
  46 + $(CPPFLAGS) \
46 -c $(1) -o $(call src_to_obj,$(1)) 47 -c $(1) -o $(call src_to_obj,$(1))
47 endef 48 endef
48 49
49 # 1 2 50 # 1 2
50 # Usage: $(call c_compile,src,includes) 51 # Usage: $(call c_compile,src,includes)
51 define c_compile 52 define c_compile
52 - $(CC) $(CPPFLAGS) $(CFLAGS) \ 53 + $(CC) $(CFLAGS) \
53 $(call depflags,$(basename $(call c_src_to_obj,$(1)))) \ 54 $(call depflags,$(basename $(call c_src_to_obj,$(1)))) \
54 $(foreach I,$(2),-I$(I)) \ 55 $(foreach I,$(2),-I$(I)) \
  56 + $(CPPFLAGS) \
55 -c $(1) -o $(call c_src_to_obj,$(1)) 57 -c $(1) -o $(call c_src_to_obj,$(1))
56 endef 58 endef
57 59
@@ -59,9 +61,10 @@ endef @@ -59,9 +61,10 @@ endef
59 # Usage: $(call libcompile,src,includes) 61 # Usage: $(call libcompile,src,includes)
60 define libcompile 62 define libcompile
61 $(LIBTOOL) --quiet --mode=compile \ 63 $(LIBTOOL) --quiet --mode=compile \
62 - $(CXX) $(CPPFLAGS) $(CXXFLAGS) \ 64 + $(CXX) $(CXXFLAGS) \
63 $(call libdepflags,$(basename $(call src_to_obj,$(1)))) \ 65 $(call libdepflags,$(basename $(call src_to_obj,$(1)))) \
64 $(foreach I,$(2),-I$(I)) \ 66 $(foreach I,$(2),-I$(I)) \
  67 + $(CPPFLAGS) \
65 -c $(1) -o $(call src_to_obj,$(1)); \ 68 -c $(1) -o $(call src_to_obj,$(1)); \
66 $(call fixdeps,$(basename $(call src_to_obj,$(1)))) 69 $(call fixdeps,$(basename $(call src_to_obj,$(1))))
67 endef 70 endef
@@ -70,9 +73,10 @@ endef @@ -70,9 +73,10 @@ endef
70 # Usage: $(call libcompile,src,includes) 73 # Usage: $(call libcompile,src,includes)
71 define c_libcompile 74 define c_libcompile
72 $(LIBTOOL) --quiet --mode=compile \ 75 $(LIBTOOL) --quiet --mode=compile \
73 - $(CC) $(CPPFLAGS) $(CXXFLAGS) \ 76 + $(CC) $(CXXFLAGS) \
74 $(call libdepflags,$(basename $(call c_src_to_obj,$(1)))) \ 77 $(call libdepflags,$(basename $(call c_src_to_obj,$(1)))) \
75 $(foreach I,$(2),-I$(I)) \ 78 $(foreach I,$(2),-I$(I)) \
  79 + $(CPPFLAGS) \
76 -c $(1) -o $(call c_src_to_obj,$(1)); \ 80 -c $(1) -o $(call c_src_to_obj,$(1)); \
77 $(call fixdeps,$(basename $(call src_to_obj,$(1)))) 81 $(call fixdeps,$(basename $(call src_to_obj,$(1))))
78 endef 82 endef
@@ -90,14 +94,14 @@ endef @@ -90,14 +94,14 @@ endef
90 define makelib 94 define makelib
91 $(LIBTOOL) --mode=link \ 95 $(LIBTOOL) --mode=link \
92 $(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \ 96 $(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \
93 - -o $(2) $(1) $(3) $(4) \ 97 + -o $(2) $(1) $(4) $(3) \
94 -rpath $(libdir) -version-info $(5):$(6):$(7) 98 -rpath $(libdir) -version-info $(5):$(6):$(7)
95 endef 99 endef
96 100
97 # 1 2 3 4 101 # 1 2 3 4
98 # Usage: $(call makebin,objs,binary,ldflags,libs) 102 # Usage: $(call makebin,objs,binary,ldflags,libs)
99 define makebin 103 define makebin
100 - $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(1) -o $(2) $(3) $(4) 104 + $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(1) -o $(2) $(4) $(3)
101 endef 105 endef
102 106
103 # Install target 107 # Install target