mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-31 02:48:31 +00:00
generalize build
git-svn-id: svn+q:///qpdf/trunk@776 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
parent
9e05a15d7b
commit
2b5ac676ed
@ -31,4 +31,4 @@ $(foreach B,$(CBINS_examples),$(eval \
|
||||
|
||||
$(foreach B,$(BINS_examples) $(CBINS_examples),$(eval \
|
||||
examples/$(OUTPUT_DIR)/$(call binname,$(B)): $(OBJS_$(B)) ; \
|
||||
$(call makebin,$(OBJS_$(B)),$$@)))
|
||||
$(call makebin,$(OBJS_$(B)),$$@,$(LDFLAGS) $(LDFLAGS_libqpdf),$(LIBS) $(LIBS_libqpdf))))
|
||||
|
@ -54,6 +54,5 @@ OBJS_dftables = $(call c_src_to_obj,external-libs/pcre/dftables.c)
|
||||
$(OBJS_dftables): external-libs/pcre/dftables.c
|
||||
$(call c_compile,$<,)
|
||||
|
||||
external-libs/$(OUTPUT_DIR)/$(call binname,dftables): LIBS=
|
||||
external-libs/$(OUTPUT_DIR)/$(call binname,dftables): $(OBJS_dftables)
|
||||
$(call makebin,$(OBJS_dftables),$@)
|
||||
$(call makebin,$(OBJS_dftables),$@,,)
|
||||
|
@ -3,6 +3,8 @@ TARGETS_libqpdf = libqpdf/$(OUTPUT_DIR)/$(call libname,qpdf)
|
||||
$(TARGETS_libqpdf): $(TARGETS_external-libs)
|
||||
|
||||
INCLUDES_libqpdf = include libqpdf $(INCLUDES_external-libs)
|
||||
LDFLAGS_libqpdf = -Llibqpdf/$(OUTPUT_DIR)
|
||||
LIBS_libqpdf = -lqpdf
|
||||
|
||||
SRCS_libqpdf = \
|
||||
libqpdf/BitStream.cc \
|
||||
@ -70,4 +72,4 @@ $(OBJS_libqpdf): libqpdf/$(OUTPUT_DIR)/%.$(LOBJ): libqpdf/%.cc
|
||||
# * Otherwise, increment REVISION
|
||||
|
||||
$(TARGETS_libqpdf): $(OBJS_libqpdf)
|
||||
$(call makelib,$(OBJS_libqpdf),$@,3,0,0)
|
||||
$(call makelib,$(OBJS_libqpdf),$@,$(LDFLAGS),$(LIBS),3,0,0)
|
||||
|
@ -36,4 +36,4 @@ $(foreach B,$(BINS_libtests),$(eval \
|
||||
|
||||
$(foreach B,$(BINS_libtests),$(eval \
|
||||
libtests/$(OUTPUT_DIR)/$(call binname,$(B)): $(OBJS_$(B)) ; \
|
||||
$(call makebin,$(OBJS_$(B)),$$@)))
|
||||
$(call makebin,$(OBJS_$(B)),$$@,$(LDFLAGS) $(LDFLAGS_libqpdf),$(LIBS) $(LIBS_libqpdf))))
|
||||
|
@ -62,22 +62,21 @@ define makeslib
|
||||
$(RANLIB) $(2)
|
||||
endef
|
||||
|
||||
# 1 2 3 4 5
|
||||
# Usage: $(call makelib,objs,library,current,revision,age)
|
||||
# 1 2 3 4 5 6 7
|
||||
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
|
||||
define makelib
|
||||
$(RM) $(2) $(2).*
|
||||
major=$$(( $(3) - $(5))); \
|
||||
versuffix=$$major.$5.$4; \
|
||||
major=$$(( $(5) - $(7))); \
|
||||
versuffix=$$major.$(7).$(6); \
|
||||
$(CXX) $(CXXFLAGS) -shared -o $(2).$$versuffix $(1) \
|
||||
-Wl,--soname -Wl,`basename $(2)`.$$major \
|
||||
$(LDFLAGS) $(LIBS); \
|
||||
$(3) $(4); \
|
||||
ln -s `basename $(2)`.$$versuffix $(2); \
|
||||
ln -s `basename $(2)`.$$versuffix $(2).$$major
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call makebin,objs,binary)
|
||||
# 1 2 3 4
|
||||
# Usage: $(call makebin,objs,binary,ldflags,libs)
|
||||
define makebin
|
||||
$(CXX) $(CXXFLAGS) $(1) -o $(2) $(LDFLAGS) \
|
||||
-Llibqpdf/$(OUTPUT_DIR) -lqpdf $(LIBS)
|
||||
$(CXX) $(CXXFLAGS) $(1) -o $(2) $(LDFLAGS) $(3) $(4)
|
||||
endef
|
||||
|
@ -76,18 +76,16 @@ define makeslib
|
||||
$(RANLIB) $(2)
|
||||
endef
|
||||
|
||||
# 1 2 3 4 5
|
||||
# Usage: $(call makelib,objs,library,current,revision,age)
|
||||
# 1 2 3 4 5 6 7
|
||||
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
|
||||
define makelib
|
||||
$(LIBTOOL) --mode=link \
|
||||
$(CXX) $(CXXFLAGS) -o $(2) $(1) $(LDFLAGS) $(LIBS) \
|
||||
-rpath $(libdir) -version-info $(3):$(4):$(5)
|
||||
$(CXX) $(CXXFLAGS) -o $(2) $(1) $(3) $(4) \
|
||||
-rpath $(libdir) -version-info $(5):$(6):$(7)
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call makebin,objs,binary)
|
||||
# 1 2 3 4
|
||||
# Usage: $(call makebin,objs,binary,ldflags,libs)
|
||||
define makebin
|
||||
$(LIBTOOL) --mode=link \
|
||||
$(CXX) $(CXXFLAGS) $(1) -o $(2) $(LDFLAGS) \
|
||||
-Llibqpdf/$(OUTPUT_DIR) -lqpdf $(LIBS)
|
||||
$(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(1) -o $(2) $(3) $(4)
|
||||
endef
|
||||
|
@ -44,17 +44,16 @@ define makeslib
|
||||
$(RANLIB) $(2)
|
||||
endef
|
||||
|
||||
# 1 2 3 4 5
|
||||
# Usage: $(call makelib,objs,library,current,revision,age)
|
||||
# 1 2 3 4 5 6 7
|
||||
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
|
||||
define makelib
|
||||
dlltool -l $(2) -D $$(basename `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(3).dll) $(1); \
|
||||
$(CXX) -shared -o `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(3).dll \
|
||||
$(1) $(LDFLAGS) $(LIBS)
|
||||
dlltool -l $(2) -D $$(basename `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(5).dll) $(1); \
|
||||
$(CXX) -shared -o `echo $(2) | sed -e 's,/lib\(.*\).a,/\1,'`$(5).dll \
|
||||
$(1) $(3) $(4)
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call makebin,objs,binary)
|
||||
# 1 2 3 4
|
||||
# Usage: $(call makebin,objs,binary,ldflags,libs)
|
||||
define makebin
|
||||
$(CXX) $(CXXFLAGS) $(1) -o $(2) $(LDFLAGS) \
|
||||
-Llibqpdf/$(OUTPUT_DIR) -lqpdf $(LIBS)
|
||||
$(CXX) $(CXXFLAGS) $(1) -o $(2) $(3) $(4)
|
||||
endef
|
||||
|
25
make/msvc.mk
25
make/msvc.mk
@ -40,26 +40,27 @@ define makeslib
|
||||
lib /nologo /OUT:$(2) $(1)
|
||||
endef
|
||||
|
||||
# 1 2 3 4 5
|
||||
# Usage: $(call makelib,objs,library,current,revision,age)
|
||||
# 1 2 3 4 5 6 7
|
||||
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
|
||||
define makelib
|
||||
cl /nologo /Zi /Gy /EHsc /MD /LD /Fe$(basename $(2))$(3).dll $(1) \
|
||||
cl /nologo /Zi /Gy /EHsc /MD /LD /Fe$(basename $(2))$(5).dll $(1) \
|
||||
/link /incremental:no \
|
||||
$(foreach L,$(subst -L,,$(LDFLAGS)),/LIBPATH:$(L)) \
|
||||
$(foreach L,$(subst -l,,$(LIBS)),$(L).lib)
|
||||
if [ -f $(basename $(2))$(3).dll.manifest ]; then \
|
||||
mt.exe -nologo -manifest $(basename $(2))$(3).dll.manifest \
|
||||
-outputresource:$(basename $(2))$(3).dll\;2; \
|
||||
$(foreach L,$(subst -L,,$(3)),/LIBPATH:$(L)) \
|
||||
$(foreach L,$(subst -l,,$(4)),$(L).lib)
|
||||
if [ -f $(basename $(2))$(5).dll.manifest ]; then \
|
||||
mt.exe -nologo -manifest $(basename $(2))$(5).dll.manifest \
|
||||
-outputresource:$(basename $(2))$(5).dll\;2; \
|
||||
fi
|
||||
mv $(2)$(5).lib $(2).lib
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call makebin,objs,binary)
|
||||
# 1 2 3 4
|
||||
# Usage: $(call makebin,objs,binary,ldflags,libs)
|
||||
define makebin
|
||||
cl /nologo /Zi /Gy /EHsc /MD $(1) \
|
||||
/link /incremental:no /OUT:$(2) \
|
||||
$(foreach L,$(subst -L,,$(LDFLAGS)),/LIBPATH:$(L)) \
|
||||
$(foreach L,$(subst -l,,$(LIBS)),$(L).lib)
|
||||
$(foreach L,$(subst -L,,$(3)),/LIBPATH:$(L)) \
|
||||
$(foreach L,$(subst -l,,$(4)),$(L).lib)
|
||||
if [ -f $(2).manifest ]; then \
|
||||
mt.exe -nologo -manifest $(2).manifest \
|
||||
-outputresource:$(2)\;2; \
|
||||
|
@ -30,4 +30,4 @@ $(foreach B,$(CBINS_qpdf),$(eval \
|
||||
|
||||
$(foreach B,$(BINS_qpdf) $(CBINS_qpdf),$(eval \
|
||||
qpdf/$(OUTPUT_DIR)/$(call binname,$(B)): $(OBJS_$(B)) ; \
|
||||
$(call makebin,$(OBJS_$(B)),$$@)))
|
||||
$(call makebin,$(OBJS_$(B)),$$@,$(LDFLAGS) $(LDFLAGS_libqpdf),$(LIBS) $(LIBS_libqpdf))))
|
||||
|
@ -19,4 +19,4 @@ $(OBJS_zlib-flate): zlib-flate/$(OUTPUT_DIR)/%.$(OBJ): zlib-flate/%.cc
|
||||
$(call compile,$<,$(INCLUDES_zlib-flate))
|
||||
|
||||
zlib-flate/$(OUTPUT_DIR)/$(call binname,zlib-flate): $(OBJS_zlib-flate)
|
||||
$(call makebin,$(OBJS_zlib-flate),$@)
|
||||
$(call makebin,$(OBJS_zlib-flate),$@,$(LDFLAGS) $(LDFLAGS_libqpdf),$(LIBS) $(LIBS_libqpdf))
|
||||
|
Loading…
x
Reference in New Issue
Block a user