1# Since the programs in this directories are examples for the user, this 2# make file should be as ordinary as possible. It should not rely heavily 3# on included make files or configuration parameters. It should not use 4# libtool. Also, we don't try to build or rebuild the libraries on which 5# these programs depend. 6 7 8ifeq ($(SRCDIR),) 9SRCDIR = $(CURDIR)/../.. 10BLDDIR = $(SRCDIR) 11endif 12SUBDIR=examples/cpp 13 14include $(BLDDIR)/config.mk 15 16default: all 17 18CXXFLAGS = $(CFLAGS_PERSONAL) $(CADD) 19LDFLAGS += $(LADD) 20 21# If this were a real application, working from an installed copy of 22# Xmlrpc-c, XMLRPC_C_CONFIG would just be 'xmlrpc-c-config'. It would be 23# found in the user's PATH. 24XMLRPC_C_CONFIG = $(BLDDIR)/xmlrpc-c-config.test 25 26 27SERVERPROGS_CGI = \ 28 xmlrpc_sample_add_server.cgi 29 30SERVERPROGS_ABYSS = \ 31 xmlrpc_inetd_server \ 32 xmlrpc_loop_server \ 33 xmlrpc_sample_add_server \ 34 callinfo_abyss_server \ 35 36CLIENTPROGS = \ 37 xmlrpc_sample_add_client \ 38 sample_add_client_complex \ 39 asynch_client \ 40 41# Build up PROGS: 42PROGS = 43 44ifeq ($(ENABLE_ABYSS_SERVER),yes) 45 PROGS += $(SERVERPROGS_ABYSS) 46endif 47 48ifeq ($(MUST_BUILD_CLIENT),yes) 49 PROGS += $(CLIENTPROGS) 50endif 51 52ifeq ($(ENABLE_CGI_SERVER),yes) 53 PROGS += $(SERVERPROGS_CGI) 54endif 55 56PROGS += pstream_inetd_server pstream_serial_server 57 58ifeq ($(MUST_BUILD_CLIENT),yes) 59 PROGS += pstream_client 60endif 61 62INCLUDES = -I. $(shell $(XMLRPC_C_CONFIG) c++2 client abyss-server --cflags) 63 64LIBS_SERVER_ABYSS = \ 65 $(shell $(XMLRPC_C_CONFIG) c++2 abyss-server --libs) 66 67LIBS_SERVER_CGI = \ 68 $(shell $(XMLRPC_C_CONFIG) c++2 cgi-server --libs) 69 70LIBS_CLIENT = \ 71 $(shell $(XMLRPC_C_CONFIG) c++2 client --libs) 72 73LIBS_BASE = \ 74 $(shell $(XMLRPC_C_CONFIG) c++2 --libs) 75 76all: $(PROGS) 77 78$(SERVERPROGS_CGI):%.cgi:%_cgi.o 79 $(CXXLD) -o $@ $^ $(LIBS_SERVER_CGI) $(LDFLAGS) 80 81$(SERVERPROGS_ABYSS):%:%.o 82 $(CXXLD) -o $@ $^ $(LIBS_SERVER_ABYSS) $(LDFLAGS) 83 84$(CLIENTPROGS):%:%.o 85 $(CXXLD) -o $@ $^ $(LIBS_CLIENT) $(LDFLAGS) 86 87 88LIBS_PSTREAM_CLIENT = \ 89 $(shell $(XMLRPC_C_CONFIG) c++2 client --libs) 90 91pstream_client:%:%.o 92 $(CXXLD) -o $@ $^ $(LIBS_PSTREAM_CLIENT) $(LDFLAGS) 93 94LIBS_PSTREAM_SERVER = \ 95 $(shell $(XMLRPC_C_CONFIG) c++2 pstream-server --libs) 96 97pstream_inetd_server pstream_serial_server:%:%.o 98 $(CXXLD) -o $@ $^ $(LIBS_PSTREAM_SERVER) $(LDFLAGS) 99 100OBJECTS = $(patsubst %,%.o,$(patsubst %.cgi,%_cgi,$(PROGS))) 101 102$(OBJECTS):%.o:%.cpp 103 $(CXX) -c $(INCLUDES) $(CXXFLAGS) $< 104 105# See example/Makefile for an explanation of config.h and xmlrpc_amconfig.h 106 107$(OBJECTS): config.h xmlrpc_amconfig.h 108 109config.h: 110 $(LN_S) $(BLDDIR)/xmlrpc_config.h $@ 111xmlrpc_amconfig.h: 112 $(LN_S) $(BLDDIR)/$@ . 113 114.PHONY: clean 115clean: 116 rm -f $(PROGS) *.o config.h xmlrpc_amconfig.h 117 118.PHONY: distclean 119distclean: clean 120 121.PHONY: dep depend 122dep depend: 123# We don't do dependencies in this directory, because it's supposed to be 124# an example of what a program outside this package would do, so we can't 125# go weaving it into the rest of the package. Ergo, a developer must 126# carefully clean and remake examples as he updates other parts of the tree. 127