initial load of upstream version 1.06.32
[xmlrpc-c] / src / Makefile
1 ifeq ($(SRCDIR)x,x)
2 SRCDIR = $(CURDIR)/..
3 endif
4 SUBDIR = src
5 BUILDDIR = $(SRCDIR)
6 VPATH = .:$(SRCDIR)
7
8 include $(BUILDDIR)/Makefile.config
9
10 ABYSS_LIBDIR = $(BUILDDIR)/lib/abyss/src/.libs
11 LIBUTIL_LIBDIR = $(BUILDDIR)/lib/libutil/.libs
12
13 default: all
14
15 SUBDIRS =
16
17 ifeq ($(ENABLE_CPLUSPLUS),yes)
18   SUBDIRS += cpp
19 endif
20
21 WININET_TRANSPORT_DIR = $(SRCDIR)/lib/wininet_transport
22 CURL_TRANSPORT_DIR    = $(SRCDIR)/lib/curl_transport
23 LIBWWW_TRANSPORT_DIR  = $(SRCDIR)/lib/libwww_transport
24
25 # TRANSPORT_OBJS is the list of modules that have to go into the client
26 # library to provide the client XML transport functions.  Since there is
27 # some variability in what XML transports we can build into the client
28 # library, this is a little complicated.
29
30 # TRANSPORT_LIBDEP is linker -l options to declare what libraries contain
31 # things to which the transport objects refer.  (like LIBxxx_LIBDEP --
32 # see below)
33
34 TRANSPORT_OBJS =
35 TRANSPORT_LIBDEP =
36 ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
37   TRANSPORT_OBJS += $(WININET_TRANSPORT_DIR)/xmlrpc_wininet_transport.lo
38   TRANSPORT_LIBDEP += $(shell wininet-config --libs)
39 endif
40 ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
41   TRANSPORT_OBJS += $(CURL_TRANSPORT_DIR)/xmlrpc_curl_transport.lo
42   TRANSPORT_LIBDEP += $(shell curl-config --libs)
43 endif
44 ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
45   TRANSPORT_OBJS += $(LIBWWW_TRANSPORT_DIR)/xmlrpc_libwww_transport.lo
46   TRANSPORT_LIBDEP += $(shell libwww-config --libs)
47 endif
48
49 ifeq ($(ENABLE_LIBXML2_BACKEND),yes)
50   LIBXML_INCLUDES = $(shell xml2-config --cflags)
51   LIBXML_LIBS = $(shell xml2-config --libs)
52 else
53   LIBXML_INCLUDES = -I$(SRCDIR)/lib/expat/xmlparse
54 endif
55
56 ABYSS_INCLUDES = -I$(SRCDIR)/lib/abyss/src
57
58 ifeq ($(ENABLE_LIBXML2_BACKEND),yes)
59   XMLRPC_XML_PARSER = xmlrpc_libxml2.lo
60 else
61   XMLRPC_XML_PARSER = xmlrpc_expat.lo
62 endif
63
64 # LIBxxx_OBJS is the list of object files that make up library libxxx.
65
66 # LIBxxx_LIBDEP is linker -l options to declare what libraries contain
67 # things to which the library being built refers.  This information
68 # makes its way to the dynamic linker, so it knows to load the
69 # referred-to library before it loads libxxx.  Note that the link command
70 # may require the necessary -L options in addition.
71
72 LIBXMLRPC_CLIENT_OBJS = xmlrpc_client.lo xmlrpc_client_global.lo
73 LIBXMLRPC_CLIENT_LIBDEP = -lxmlrpc_util -lxmlrpc
74
75 LIBXMLRPC_SERVER_OBJS = registry.lo system_method.lo
76 LIBXMLRPC_SERVER_LIBDEP = -lxmlrpc_util -lxmlrpc
77
78 LIBXMLRPC_SERVER_ABYSS_OBJS = xmlrpc_server_abyss.lo
79 LIBXMLRPC_SERVER_ABYSS_LIBDEP = \
80   -lxmlrpc_util -lxmlrpc_server -L$(ABYSS_LIBDIR) -lxmlrpc_abyss -lxmlrpc
81
82 LIBXMLRPC_SERVER_CGI_OBJS = xmlrpc_server_cgi.lo
83 LIBXMLRPC_SERVER_CGI_LIBDEP = -lxmlrpc_util -lxmlrpc_server -lxmlrpc
84
85 LIBXMLRPC_OBJS = \
86         trace.lo \
87         xmlrpc_data.lo \
88         xmlrpc_builddecomp.lo \
89         xmlrpc_datetime.lo \
90         xmlrpc_array.lo \
91         xmlrpc_struct.lo \
92         $(XMLRPC_XML_PARSER) \
93         xmlrpc_parse.lo \
94         xmlrpc_serialize.lo \
95         xmlrpc_base64.lo \
96         xmlrpc_utf8.lo \
97         xmlrpc_authcookie.lo \
98
99 LIBXMLRPC_LIBDEP = -lxmlrpc_util $(LIBXML_LIBS)
100
101 LIB_OBJS = $(LIBXMLRPC_CLIENT_OBJS) $(LIBXMLRPC_SERVER_OBJS)
102
103 TRANSPORT_INCLUDES = \
104   -I$(WININET_TRANSPORT_DIR) \
105   -I$(CURL_TRANSPORT_DIR) \
106   -I$(LIBWWW_TRANSPORT_DIR) \
107
108 INCLUDES = -I$(BUILDDIR) -I$(SRCDIR) \
109            -I$(SRCDIR)/include -I$(SRCDIR)/lib/util/include \
110            -I$(SRCDIR)/lib/abyss/src \
111            $(TRANSPORT_INCLUDES) \
112            $(LIBXML_INCLUDES) \
113
114 # People sometimes think that when the Xmlrpc-c build has been
115 # configured for no Abyss server (configure --disable-abyss), that
116 # libmxlrpc_server_abyss should not get built.  But
117 # libxmlrpc_server_abyss is not part of the Abyss server; it is merely
118 # some code that exploits an Abyss server, and you don't need to have a
119 # built Abyss server to build it.
120
121 TARGET_LTLIBRARIES = libxmlrpc.la libxmlrpc_server.la \
122      libxmlrpc_server_abyss.la
123
124 ifeq ($(MUST_BUILD_CLIENT),yes)
125   TARGET_LTLIBRARIES += libxmlrpc_client.la
126 endif
127
128 ifeq ($(ENABLE_CGI_SERVER),yes)
129   TARGET_LTLIBRARIES += libxmlrpc_server_cgi.la
130 endif
131
132 all: $(TARGET_LTLIBRARIES) $(SUBDIRS:%=%/all)
133
134 LDFLAGS = $(LADD)
135
136 LIBPATHS = -L.libs -L$(LIBUTIL_LIBDIR)
137
138 LIBLDFLAGS = $(LDFLAGS_VERSINFO) -rpath $(LIBINST_DIR) $(LIBPATHS) $(LADD)
139
140
141 libxmlrpc.la: $(LIBXMLRPC_OBJS)
142         $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) \
143           $(LIBXMLRPC_OBJS) $(LIBXMLRPC_LIBDEP) 
144
145 libxmlrpc_client.la: $(LIBXMLRPC_CLIENT_OBJS) $(TRANSPORT_OBJS)
146         $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) \
147           $(LIBXMLRPC_CLIENT_OBJS) $(TRANSPORT_OBJS) \
148           $(LIBXMLRPC_CLIENT_LIBDEP) $(TRANSPORT_LIBDEP) \
149
150 libxmlrpc_server.la: $(LIBXMLRPC_SERVER_OBJS)
151         $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) \
152           $(LIBXMLRPC_SERVER_OBJS) $(LIBXMLRPC_SERVER_LIBDEP)
153
154 libxmlrpc_server_abyss.la: $(LIBXMLRPC_SERVER_ABYSS_OBJS)
155         $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) \
156           $(LIBXMLRPC_SERVER_ABYSS_OBJS) $(LIBXMLRPC_SERVER_ABYSS_LIBDEP)
157
158 libxmlrpc_server_cgi.la: $(LIBXMLRPC_SERVER_CGI_OBJS)
159         $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) \
160           $(LIBXMLRPC_SERVER_CGI_OBJS) $(LIBXMLRPC_SERVER_CGI_LIBDEP)
161
162
163 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
164
165 $(LIBXMLRPC_CLIENT_OBJS) $(LIBXMLRPC_SERVER_OBJS):%.lo:%.c
166         $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(CFLAGS) $<
167
168 $(LIBXMLRPC_OBJS):%.lo:%.c
169         $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(LIBXML_INCLUDES) \
170           $(CFLAGS) $<
171
172 $(LIBXMLRPC_SERVER_ABYSS_OBJS):%.lo:%.c
173         $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(ABYSS_INCLUDES) \
174           $(CFLAGS) $<
175
176 xmlrpc_server_cgi.lo:%.lo:%.c
177         $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) \
178           $(CFLAGS) $<
179
180 LTLIBRARIES_TO_INSTALL = $(TARGET_LTLIBRARIES)
181
182 check:
183         $(MAKE) -C test runtests
184         $(MAKE) -C cpp  check
185
186 .PHONY: install
187 install: install-common $(SUBDIRS:%=%/install)
188
189 .PHONY: clean clean-local distclean
190 clean: clean-common clean-local $(SUBDIRS:%=%/clean)
191 clean-local:
192         $(MAKE) -C test clean
193
194 distclean: clean-common clean-local distclean-common $(SUBDIRS:%=%/distclean)
195
196 .PHONY: dep
197 dep: $(SUBDIRS:%=%/dep) $(BUILDDIR)/transport_config.h dep-common
198
199 include $(SRCDIR)/Makefile.common
200
201 xmlrpc_client.lo: $(BUILDDIR)/transport_config.h
202
203 include Makefile.depend