1ifeq ($(SRCDIR),) 2 updir = $(shell echo $(dir $(1)) | sed 's/.$$//') 3 SRCCPPDIR := $(call updir,$(CURDIR)) 4 srcDIR := $(call updir,$(SRCCPPDIR)) 5 SRCDIR := $(call updir,$(srcDIR)) 6 BLDDIR := $(SRCDIR) 7endif 8SUBDIR := src/test/cpp 9 10include $(BLDDIR)/config.mk 11 12PROGS = test 13 14default: all 15 16all: $(PROGS) 17 18XMLRPC_C_CONFIG = $(BLDDIR)/xmlrpc-c-config.test 19 20LIBS := $(shell $(XMLRPC_C_CONFIG) client --ldadd) 21 22ifeq ($(MUST_BUILD_CURL_CLIENT),yes) 23 LIBS += $(shell curl-config --libs) 24endif 25ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes) 26 LIBS += $(shell libwww-config --libs) 27endif 28 29LIBS += -lpthread 30 31INCLUDES = -Isrcdir/include -I$(BLDDIR) -Isrcdir -Isrcdir/lib/util/include 32 33# This 'Makefile' dependency makes sure the symlinks get built before 34# this make file is used for anything. 35 36Makefile: srcdir 37 38include $(SRCDIR)/common.mk 39 40 41TEST_OBJS = \ 42 test.o \ 43 base64.o \ 44 registry.o \ 45 server_abyss.o \ 46 server_pstream.o \ 47 tools.o \ 48 value.o \ 49 xml.o \ 50 51ifeq ($(MUST_BUILD_CLIENT),yes) 52 TEST_OBJS += testclient.o 53 CLIENT_LIBS = $(LIBXMLRPC_CLIENTPP_A) $(LIBXMLRPC_CLIENT_A) 54else 55 TEST_OBJS += testclient_dummy.o 56 CLIENT_LIBS = 57endif 58 59 60TEST_LIBS = \ 61 $(LIBXMLRPC_SERVER_ABYSSPP_A) \ 62 $(LIBXMLRPC_SERVER_PSTREAMPP_A) \ 63 $(LIBXMLRPC_SERVERPP_A) \ 64 $(CLIENT_LIBS) $(LIBXMLRPCPP_A) \ 65 $(LIBXMLRPC_CPP_A) \ 66 $(LIBXMLRPC_SERVER_ABYSS_A) \ 67 $(LIBXMLRPC_SERVER_A) \ 68 $(LIBXMLRPC_A) \ 69 $(LIBXMLRPC_ABYSS_A) \ 70 $(LIBXMLRPC_PACKETSOCKET_A) \ 71 $(LIBXMLRPC_UTIL_A) \ 72 73ifneq ($(ENABLE_LIBXML2_BACKEND),yes) 74 # We're using the internal Expat XML parser 75 TEST_LIBS += $(LIBXMLRPC_XMLPARSE_A) $(LIBXMLRPC_XMLTOK_A) 76 LIB_XML = 77 registry.o: D_INTERNAL_EXPAT=-DINTERNAL_EXPAT 78else 79 LIB_XML = $(shell xml2-config --libs) 80endif 81 82test: $(TEST_OBJS) $(TEST_LIBS) 83 $(CXXLD) -o $@ $(LDFLAGS) $(LADD) $^ $(LIB_XML) $(LIBS) 84 85%.o:%.cpp 86 $(CXX) -c $(INCLUDES) $(CXXFLAGS_ALL) $(D_INTERNAL_EXPAT) $< 87 88# Note the difference between 'check' and 'runtests'. 'check' means to check 89# our own correctness. 'runtests' means to run the tests that check our 90# parent's correctness 91 92.PHONY: check 93check: 94 95.PHONY: runtests 96runtests: test 97 ./test 98 99.PHONY: install 100install: 101 102.PHONY: clean clean-local distclean 103clean: clean-common clean-local 104clean-local: 105 rm -f $(PROGS) 106 107distclean: clean distclean-common 108 109.PHONY: dep 110dep: dep-common 111 112include depend.mk 113