2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

include external-libs

git-svn-id: svn+q:///qpdf/trunk@761 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-10-10 16:51:20 +00:00
parent dd66ea8160
commit c7be2041b8
6 changed files with 89 additions and 6 deletions

View File

@ -30,7 +30,8 @@
# install to install in a separate location. This is useful for
# packagers.
BUILD_ITEMS = manual libqpdf zlib-flate libtests qpdf examples
#XXX
BUILD_ITEMS = manual external-libs libqpdf zlib-flate libtests qpdf examples
OUTPUT_DIR = build
ALL_TARGETS =

1
external-libs/Makefile Normal file
View File

@ -0,0 +1 @@
include ../make/proxy.mk

57
external-libs/build.mk Normal file
View File

@ -0,0 +1,57 @@
TARGETS_external-libs = external-libs/$(OUTPUT_DIR)/libexternal.a
INCLUDES_external-libs = external-libs/zlib external-libs/pcre \
external-libs/$(OUTPUT_DIR)
SRCS_external-libs_zlib = \
external-libs/zlib/adler32.c \
external-libs/zlib/compress.c \
external-libs/zlib/crc32.c \
external-libs/zlib/gzio.c \
external-libs/zlib/uncompr.c \
external-libs/zlib/deflate.c \
external-libs/zlib/trees.c \
external-libs/zlib/zutil.c \
external-libs/zlib/inflate.c \
external-libs/zlib/infback.c \
external-libs/zlib/inftrees.c \
external-libs/zlib/inffast.c \
SRCS_external-libs_pcre = \
external-libs/pcre/maketables.c \
external-libs/pcre/get.c \
external-libs/pcre/study.c \
external-libs/pcre/pcre.c
SRCS_external-libs = $(SRCS_external-libs_zlib) $(SRCS_external-libs_pcre)
external-libs/$(OUTPUT_DIR)/pcre.$(LOBJ): external-libs/$(OUTPUT_DIR)/chartables.c
external-libs/$(OUTPUT_DIR)/chartables.c: external-libs/$(OUTPUT_DIR)/$(call binname,dftables)
external-libs/$(OUTPUT_DIR)/$(call binname,dftables) \
external-libs/$(OUTPUT_DIR)/chartables.c
external-libs/$(OUTPUT_DIR)/$(call binname,dftables):
$(CC) -o $@ external-libs/pcre/dftables.c
# -----
OBJS_external-libs_zlib = $(call c_src_to_lobj,$(subst zlib/,,$(SRCS_external-libs_zlib)))
OBJS_external-libs_pcre = $(call c_src_to_lobj,$(subst pcre/,,$(SRCS_external-libs_pcre)))
OBJS_external-libs = $(OBJS_external-libs_zlib) $(OBJS_external-libs_pcre)
x:
@echo $(call lobj_to_dep,$(OBJS_external-libs))
ifeq ($(GENDEPS),1)
-include $(call lobj_to_dep,$(OBJS_external-libs))
endif
$(OBJS_external-libs_zlib): external-libs/$(OUTPUT_DIR)/%.$(LOBJ): external-libs/zlib/%.c
$(call c_libcompile,$<,$(INCLUDES_external-libs))
$(OBJS_external-libs_pcre): external-libs/$(OUTPUT_DIR)/%.$(LOBJ): external-libs/pcre/%.c
$(call c_libcompile,$<,$(INCLUDES_external-libs))
$(TARGETS_external-libs): $(OBJS_external-libs)
$(call makeslib,$(OBJS_external-libs),$(TARGETS_external-libs))

View File

@ -1,5 +1,7 @@
TARGETS_libqpdf = libqpdf/$(OUTPUT_DIR)/$(call libname,qpdf)
$(TARGETS_libqpdf): $(TARGETS_external-libs)
INCLUDES_libqpdf = include libqpdf
SRCS_libqpdf = \

View File

@ -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) \

View File

@ -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)