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

add qpdf-ctest as C test program

git-svn-id: svn+q:///qpdf/trunk@726 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-09-27 14:52:04 +00:00
parent 84ec83e925
commit 91d8c48533
3 changed files with 29 additions and 2 deletions

View File

@ -4,6 +4,11 @@ define src_to_obj
$(foreach F,$(1),$(dir $(F))$(OUTPUT_DIR)/$(patsubst %.cc,%.o,$(notdir $(F))))
endef
# Usage: $(call c_src_to_obj,srcs)
define c_src_to_obj
$(foreach F,$(1),$(dir $(F))$(OUTPUT_DIR)/$(patsubst %.c,%.o,$(notdir $(F))))
endef
# Usage: $(call src_to_lobj,srcs)
define src_to_lobj
$(foreach F,$(1),$(dir $(F))$(OUTPUT_DIR)/$(patsubst %.cc,%.lo,$(notdir $(F))))
@ -46,6 +51,15 @@ define compile
-c $(1) -o $(call src_to_obj,$(1))
endef
# 1 2
# Usage: $(call c_compile,src,includes)
define c_compile
$(CC) $(CPPFLAGS) $(CFLAGS) \
$(call depflags,$(basename $(call src_to_obj,$(1)))) \
$(foreach I,$(2),-I$(I)) \
-c $(1) -o $(call c_src_to_obj,$(1))
endef
# 1 2
# Usage: $(call libcompile,src,includes)
define libcompile

View File

@ -1,6 +1,7 @@
BINS_qpdf = qpdf test_driver
CBINS_qpdf = qpdf-ctest
TARGETS_qpdf = $(foreach B,$(BINS_qpdf),qpdf/$(OUTPUT_DIR)/$(B))
TARGETS_qpdf = $(foreach B,$(BINS_qpdf) $(CBINS_qpdf),qpdf/$(OUTPUT_DIR)/$(B))
$(TARGETS_qpdf): $(TARGETS_libqpdf)
@ -12,6 +13,8 @@ TC_SRCS_qpdf = $(wildcard libqpdf/*.cc) $(wildcard qpdf/*.cc)
$(foreach B,$(BINS_qpdf),$(eval \
OBJS_$(B) = $(call src_to_obj,qpdf/$(B).cc)))
$(foreach B,$(CBINS_qpdf),$(eval \
OBJS_$(B) = $(call c_src_to_obj,qpdf/$(B).c)))
ifeq ($(GENDEPS),1)
-include $(foreach B,$(BINS_qpdf),$(call obj_to_dep,$(OBJS_$(B))))
@ -21,6 +24,10 @@ $(foreach B,$(BINS_qpdf),$(eval \
$(OBJS_$(B)): qpdf/$(OUTPUT_DIR)/%.o: qpdf/$(B).cc ; \
$(call compile,qpdf/$(B).cc,$(INCLUDES_qpdf))))
$(foreach B,$(BINS_qpdf),$(eval \
$(foreach B,$(CBINS_qpdf),$(eval \
$(OBJS_$(B)): qpdf/$(OUTPUT_DIR)/%.o: qpdf/$(B).c ; \
$(call c_compile,qpdf/$(B).c,$(INCLUDES_qpdf))))
$(foreach B,$(BINS_qpdf) $(CBINS_qpdf),$(eval \
qpdf/$(OUTPUT_DIR)/$(B): $(OBJS_$(B)) ; \
$(call makebin,$(OBJS_$(B)),$$@)))

6
qpdf/qpdf-ctest.c Normal file
View File

@ -0,0 +1,6 @@
#include <qpdf/qpdf-c.h>
int main()
{
return 0;
}