initial load of upstream version 1.06.32
[xmlrpc-c] / examples / cpp / Makefile
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
8 ifeq ($(SRCDIR)x,x)
9 SRCDIR = $(CURDIR)/../..
10 BUILDDIR = ../..
11 endif
12
13 default: all
14
15 include $(BUILDDIR)/Makefile.config
16
17 CXXFLAGS = $(CXXFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
18 LDFLAGS = $(LADD)
19
20 # If this were a real application, working from an installed copy of
21 # Xmlrpc-c, XMLRPC_C_CONFIG would just be 'xmlrpc-c-config'.  It would be
22 # found in the user's PATH.
23 XMLRPC_C_CONFIG = $(BUILDDIR)/xmlrpc-c-config.test
24
25
26 SERVERPROGS_ABYSS = \
27   xmlrpc_inetd_server \
28   xmlrpc_loop_server \
29   xmlrpc_sample_add_server \
30
31 LEGACY_CLIENTPROGS = \
32   meerkat-app-list
33
34 CLIENTPROGS = \
35   xmlrpc_sample_add_client \
36   sample_add_client_complex \
37
38 # Build up PROGS:
39 PROGS = 
40
41 ifeq ($(ENABLE_ABYSS_SERVER),yes)
42   PROGS += $(SERVERPROGS_ABYSS)
43 endif
44
45 ifeq ($(MUST_BUILD_CLIENT),yes)
46   PROGS += $(CLIENTPROGS) $(LEGACY_CLIENTPROGS)
47 endif
48
49 INCLUDES = $(shell $(XMLRPC_C_CONFIG) c++2 client abyss-server --cflags)
50
51 LDADD_SERVER_ABYSS = \
52   $(shell $(XMLRPC_C_CONFIG) c++2 abyss-server --ldadd)
53
54 LDADD_CLIENT = \
55   $(shell $(XMLRPC_C_CONFIG) c++2 client --ldadd)
56
57 LDADD_BASE = \
58   $(shell $(XMLRPC_C_CONFIG) c++2 --ldadd)
59
60 LDADD_LEGACY_CLIENT = \
61   $(shell $(XMLRPC_C_CONFIG) c++ client --ldadd)
62
63 all: $(PROGS)
64
65 $(SERVERPROGS_ABYSS):%:%.o
66         $(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_SERVER_ABYSS)
67
68 $(LEGACY_CLIENTPROGS):%:%.o
69         $(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_LEGACY_CLIENT)
70
71 $(CLIENTPROGS):%:%.o
72         $(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_CLIENT)
73
74 %.o:%.cpp
75         $(CXX) -c $(INCLUDES) $(CXXFLAGS) $<
76
77 *.c: config.h xmlrpc_amconfig.h
78
79 config.h:
80         $(LN_S) $(BUILDDIR)/xmlrpc_config.h $@
81 xmlrpc_amconfig.h:
82         $(LN_S) $(BUILDDIR)/$@ .
83
84 include $(SRCDIR)/Makefile.common
85
86 .PHONY: clean
87 clean: clean-common
88         rm -f $(PROGS) config.h xmlrpc_amconfig.h
89
90 .PHONY: distclean
91 distclean: clean
92
93 .PHONY: dep depend
94 dep depend:
95 # We don't do dependencies in this directory, because it's supposed to be
96 # an example of what a program outside this package would do, so we can't
97 # go weaving it into the rest of the package.  Ergo, a developer must
98 # carefully clean and remake examples as he updates other parts of the tree.