1 # -*-makefile-*- <-- an Emacs control
3 # This file contains rules and variable settings for the convenience
4 # of every other make file in the package.
6 # No make file is required to use this file, but it usually saves a lot
9 # The following make variables are meaningful as input to this file:
11 # SRCDIR: Name of directory which is the top of the Xmlrpc-c source tree.
12 # BUILDDIR: Name of directory which is the top of the Xmlrpc-c build tree.
14 LIBTOOL = $(SRCDIR)/libtool
15 LINK = $(LIBTOOL) --mode=link $(CCLD)
17 GCC_WARNINGS = -Wall -Wundef -Wimplicit -W -Winline -Wundef
18 # We need -Wwrite-strings after we fix all the missing consts
20 GCC_C_WARNINGS = $(GCC_WARNINGS) \
21 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes
23 GCC_CXX_WARNINGS = $(GCC_WARNINGS) -Woverloaded-virtual -Wsynth
25 # The NDEBUG macro says not to build code that assumes there are no bugs.
26 # This makes the code go faster. The main thing it does is tell the C library
27 # to make assert() a no-op as opposed to generating code to check the
28 # assertion and crash the program if it isn't really true. You can add
29 # -UNDEBUG (in any of various ways) to override this.
31 CFLAGS_COMMON = -DNDEBUG
32 CXXFLAGS_COMMON = -DNDEBUG
34 ifeq ($(C_COMPILER_GNU),yes)
35 CFLAGS_COMMON += $(GCC_C_WARNINGS) -fno-common -g -O3
38 ifeq ($(CXX_COMPILER_GNU),yes)
39 CXXFLAGS_COMMON += $(GCC_CXX_WARNINGS) -g
42 DISTDIR = $(BUILDDIR)/$(PACKAGE)-$(VERSION)/$(SUBDIR)
44 # MAJ and MIN are major and minor version numbers for shared libraries.
45 # Libtool builds are controlled by LDFLAGS_VERSINFO instead.
49 # LDFLAGS_VERSINFO is a libtool link option (--version-info) that
50 # tells it what version numbers to put on the shared libraries (and
51 # maybe in those special libtool link files). Exactly how it works is
52 # somewhat mysterious; it's designed to be part of a linking system
53 # where you always use libtool to link the libraries, and libtool
54 # figures out which if any version of a library meets the link's
55 # requirements. But we expect our libraries to be linked with the
56 # regular (non-libtool) linker, so what we care about is the major,
57 # minor, and revision numbers in the file names and sonames. Libtool
58 # has an option --version-number that supposedly lets us specify that,
59 # but it doesn't seem to work. All I get is 0.0.0. So we manipulate
60 # --version-info instead.
62 # This appears to work: in the option --version-info A.B.C:
64 # C is the minor number
65 # B is the revision number
66 # A minus C is the major number.
68 # So you would get libxmlrpc.so.A-C.C.B .
70 # Our strategy is to make the library version numbers the same as the
71 # Xmlrpc-c version numbers except that we update the major number when and
72 # only when we make a non-backward-compatible change to the library. So
73 # e.g. libxmlrpc for Xmlrpc-c 1.06.01 is named libxmlrpc.so.3.6.1.
75 LDFLAGS_VERSINFO = -version-info 9:15:6 # 3.6.15
77 # CURDIR was introduced in GNU Make 3.77.
79 CURDIR := $(shell /bin/pwd)
82 LIBXMLRPC_UTIL = $(BUILDDIR)/lib/libutil/libxmlrpc_util.la
83 LIBXMLRPC = $(BUILDDIR)/src/libxmlrpc.la
84 LIBXMLRPC_CLIENT = $(BUILDDIR)/src/libxmlrpc_client.la
85 LIBXMLRPC_SERVER = $(BUILDDIR)/src/libxmlrpc_server.la
86 LIBXMLRPC_SERVER_ABYSS = $(BUILDDIR)/src/libxmlrpc_server_abyss.la
87 LIBXMLRPC_SERVER_CGI = $(BUILDDIR)/src/libxmlrpc_server_cgi.la
88 LIBXMLRPC_ABYSS = $(BUILDDIR)/lib/abyss/src/libxmlrpc_abyss.la
89 LIBXMLRPC_XMLPARSE = $(BUILDDIR)/lib/expat/xmlparse/libxmlrpc_xmlparse.la
90 LIBXMLRPC_XMLTOK = $(BUILDDIR)/lib/expat/xmltok/libxmlrpc_xmltok.la
91 LIBXMLRPC_UTIL_A = $(BUILDDIR)/lib/libutil/.libs/libxmlrpc_util.a
92 LIBXMLRPC_A = $(BUILDDIR)/src/.libs/libxmlrpc.a
93 LIBXMLRPC_CLIENT_A = $(BUILDDIR)/src/.libs/libxmlrpc_client.a
94 LIBXMLRPC_SERVER_A = $(BUILDDIR)/src/.libs/libxmlrpc_server.a
95 LIBXMLRPC_SERVER_ABYSS_A = $(BUILDDIR)/src/.libs/libxmlrpc_server_abyss.a
96 LIBXMLRPC_SERVER_CGI_A = $(BUILDDIR)/src/.libs/libxmlrpc_server_cgi.a
97 LIBXMLRPC_ABYSS_A = $(BUILDDIR)/lib/abyss/src/.libs/libxmlrpc_abyss.a
98 LIBXMLRPC_XMLPARSE_A = $(BUILDDIR)/lib/expat/xmlparse/.libs/libxmlrpc_xmlparse.a
99 LIBXMLRPC_XMLTOK_A = $(BUILDDIR)/lib/expat/xmltok/.libs/libxmlrpc_xmltok.a
100 LIBXMLRPC_CPP = $(BUILDDIR)/src/cpp/libxmlrpc_cpp.a
101 LIBXMLRPC++ = $(BUILDDIR)/src/cpp/libxmlrpc++.a
102 LIBXMLRPC_CLIENT++ = $(BUILDDIR)/src/cpp/libxmlrpc_client++.a
103 LIBXMLRPC_SERVER++ = $(BUILDDIR)/src/cpp/libxmlrpc_server++.a
104 LIBXMLRPC_SERVER_ABYSS++ = $(BUILDDIR)/src/cpp/libxmlrpc_server_abyss++.a
106 CASPRINTF = $(BUILDDIR)/lib/util/casprintf.o
111 # LIBXMLRPC_XML is the list of Xmlrpc-c libraries we need to parse
112 # XML. If we're using an external library to parse XML, this is null.
113 # LDLIBS_XMLRPC_XML is the corresonding -l options.
115 ifneq ($(ENABLE_LIBXML2_BACKEND),yes)
116 # We're using the internal Expat XML parser
117 LIBXMLRPC_XML = $(LIBXMLRPC_XMLPARSE) $(LIBXMLRPC_XMLTOK)
119 -L$(BUILDDIR)/lib/expat/xmlparse/.libs \
121 -L$(BUILDDIR)/lib/expat/xmltok/.libs \
124 LDLIBS_XML = $(shell xml2-config --libs)
128 ##############################################################################
130 ##############################################################################
132 # We use the srcdir and blddir symbolic links simply to make the make
133 # rules easier to read in the make output. We could use $(SRCDIR) and
134 # $(BLDDIR) variables, but that makes the compile and link commands
135 # a mile long. Note that Make sometime figures that a directory which
136 # is a dependency is newer than the symbolic link pointing to it and wants
137 # to rebuild the symbolic link. So we don't make $(BLDDIR) a
138 # dependency of 'blddir'.
146 $(SUBDIRS:%=%/all): %/all: $(CURDIR)/%
147 $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
150 $(SUBDIRS:%=%/install): %/install: $(CURDIR)/%
151 $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
154 $(SUBDIRS:%=%/clean): %/clean: $(CURDIR)/%
155 $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
158 $(SUBDIRS:%=%/distclean): %/distclean: $(CURDIR)/%
159 $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
162 $(SUBDIRS:%=%/check): %/check: $(CURDIR)/%
163 $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
166 $(SUBDIRS:%=%/distdir): %/distdir: $(CURDIR)/%
167 $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
170 $(SUBDIRS:%=%/dep): %/dep: $(CURDIR)/%
171 $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
174 $(BUILDDIR)/lib/wininet_transport/xmlrpc_wininet_transport.lo: FORCE
175 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/wininet_transport/Makefile \
178 $(BUILDDIR)/lib/curl_transport/xmlrpc_curl_transport.lo: FORCE
179 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/curl_transport/Makefile \
182 $(BUILDDIR)/lib/libwww_transport/xmlrpc_libwww_transport.lo: FORCE
183 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/libwww_transport/Makefile \
186 $(LIBXMLRPC_ABYSS): FORCE
187 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/abyss/src/Makefile \
190 $(LIBXMLRPC_XMLPARSE): FORCE
191 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/expat/xmlparse/Makefile \
194 $(LIBXMLRPC_XMLTOK): FORCE
195 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/expat/xmltok/Makefile \
198 $(LIBXMLRPC_UTIL): FORCE
199 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/libutil/Makefile \
202 $(LIBXMLRPC) $(LIBXMLRPC_CLIENT) $(LIBXMLRPC_SERVER): FORCE
203 $(MAKE) -C $(dir $@) -f $(SRCDIR)/src/Makefile \
206 $(LIBXMLRPC++) $(LIBXMLRPC_CLIENT++) $(LIBXMLRPC_SERVER++) \
207 $(LIBXMLRPC_SERVER_ABYSS++): FORCE
208 $(MAKE) -C $(dir $@) -f $(SRCDIR)/src/cpp/Makefile \
211 $(LIBXMLRPC_UTIL_A): $(LIBXMLRPC_UTIL)
212 $(LIBXMLRPC_A): $(LIBXMLRPC)
213 $(LIBXMLRPC_CLIENT_A): $(LIBXMLRPC_CLIENT)
214 $(LIBXMLRPC_SERVER_ABYSS_A): $(LIBXMLRPC_SERVER_ABYSS)
215 $(LIBXMLRPC_CGI_A): $(LIBXMLRPC_CGI)
216 $(LIBXMLRPC_ABYSS_A): $(LIBXMLRPC_ABYSS)
217 $(LIBXMLRPC_XMLPARSE_A): $(LIBXMLRPC_XMLPARSE)
218 $(LIBXMLRPC_XMLTOK_A): $(LIBXMLRPC_XMLTOK)
221 $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/util/Makefile \
224 # About version.h: This is a built header file, which means it is a supreme
225 # pain in the ass. The biggest problem is that when we automatically make
226 # dependencies (Makefile.depend), it doesn't exist yet. This means Gcc
227 # generates a dependency on it being in the local directory. Therefore,
228 # we generate it in the local directory, as a symbolic link, wherever it
229 # is needed. But the original is always in the top level directory,
230 # generated by a rule in that directory's make file. Problem 2 is that
231 # the top directory's make file includes Makefile.common, so the rules
232 # below conflict with it. That's what OMIT_VERSION_H is for.
234 ifneq ($(OMIT_VERSION_H),Y)
236 $(BUILDDIR)/version.h:
237 $(MAKE) -C $(dir $@) -f $(SRCDIR)/GNUmakefile $(notdir $@)
239 version.h: $(BUILDDIR)/version.h
244 $(BUILDDIR)/include/xmlrpc-c/config.h:
245 $(MAKE) -C $(BUILDDIR)/include -f $(SRCDIR)/include/Makefile \
248 ifneq ($(OMIT_TRANSPORT_CONFIG_H),Y)
249 $(BUILDDIR)/transport_config.h:
250 $(MAKE) -C $(dir $@) $(notdir $@)
253 $(ALL_OBJS): $(BUILDDIR)/include/xmlrpc-c/config.h
256 ##############################################################################
257 # SHARED LIBRARY RULES #
258 ##############################################################################
260 ifeq ($(SHARED_LIB_TYPE),unix)
261 include $(SRCDIR)/unix-common.make
264 ifeq ($(SHARED_LIB_TYPE),irix)
265 include $(SRCDIR)/irix-common.make
268 ifeq ($(SHARED_LIB_TYPE),dll)
269 include $(SRCDIR)/dll-common.make
272 ifeq ($(SHARED_LIB_TYPE),dylib)
273 include $(SRCDIR)/dylib-common.make
276 ifeq ($(SHARED_LIB_TYPE),NONE)
277 install-shared-libraries:
281 ##############################################################################
283 # (except shared libraries) #
284 ##############################################################################
286 MKINSTALLDIRS = $(SHELL) $(SRCDIR)/mkinstalldirs
288 .PHONY: install-common install-libraries install-headers install-bin
290 install-ltlibraries install-static-libraries install-shared-libraries \
291 install-headers install-bin
293 INSTALL_LIB_CMD = $(INSTALL_DATA) $$p $(DESTDIR)$(LIBINST_DIR)/$$p
294 RANLIB_CMD = $(RANLIB) $(DESTDIR)$(LIBINST_DIR)/$$p
296 install-static-libraries: $(STATIC_LIBRARIES_TO_INSTALL)
297 $(MKINSTALLDIRS) $(DESTDIR)$(LIBINST_DIR)
298 @list='$(STATIC_LIBRARIES_TO_INSTALL)'; for p in $$list; do \
299 if test -f $$p; then \
300 echo " $(INSTALL_LIB_CMD)"; \
301 $(INSTALL_LIB_CMD); \
305 @list='$(STATIC_LIBRARIES_TO_INSTALL)'; for p in $$list; do \
306 if test -f $$p; then \
307 echo " $(RANLIB_CMD)"; \
312 LIBTOOL_INSTALL_CMD = $(LIBTOOL) --mode=install \
313 $(INSTALL_SHLIB) $$p $(DESTDIR)$(LIBINST_DIR)/$$p
315 install-ltlibraries: $(LTLIBRARIES_TO_INSTALL)
316 $(MKINSTALLDIRS) $(DESTDIR)$(LIBINST_DIR)
317 @list='$(LTLIBRARIES_TO_INSTALL)'; for p in $$list; do \
318 if test -f $$p; then \
319 echo " $(LIBTOOL_INSTALL_CMD)"; \
320 $(LIBTOOL_INSTALL_CMD); \
324 HEADERDESTDIR = $(DESTDIR)$(HEADERINST_DIR)
325 INSTALL_HDR_CMD = $(INSTALL_DATA) $$d$$p $(HEADERDESTDIR)/$$p
327 install-headers: $(HEADERS_TO_INSTALL)
328 $(MKINSTALLDIRS) $(HEADERDESTDIR)
329 $(MKINSTALLDIRS) $(HEADERDESTDIR)/xmlrpc-c
330 @list='$(HEADERS_TO_INSTALL)'; for p in $$list; do \
331 if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
332 echo " $(INSTALL_HDR_CMD)"; \
333 $(INSTALL_HDR_CMD); \
337 INSTALL_PROGRAM_CMD = $(INSTALL_PROGRAM) $$p $(DESTDIR)$(PROGRAMINST_DIR)/$$p
339 install-bin: $(PROGRAMS_TO_INSTALL) $(DESTDIR)$(PROGRAMINST_DIR)
340 @list='$(PROGRAMS_TO_INSTALL)'; \
341 for p in $$list; do \
342 echo "$(INSTALL_PROGRAM_CMD)"; \
343 $(INSTALL_PROGRAM_CMD); \
346 $(DESTDIR)$(PROGRAMINST_DIR):
350 ##############################################################################
351 # MISCELLANEOUS RULES #
352 ##############################################################################
356 rm -f *.o *.a *.s *.i *.la *.lo
357 rm -f *.$(SHLIB_SUFFIX) *.$(SHLIB_SUFFIX).*
360 .PHONY: distclean-common
362 # Makefile.depend is generated by 'make dep' and contains only dependencies
363 # that make parts get _rebuilt_ when parts upon which they depend change.
364 # It does not contain dependencies that are necessary to cause a part to
365 # get built in the first place. E.g. if foo.c uses bar.h and bar.h gets built
366 # by a make rule, you must put the dependency of foo.c on bar.h somewhere
367 # besides Makefile.depend.
369 # Because of this, a user doesn't need Makefile.depend, because he
370 # doesn't modify source files. A developer, on the other hand, must make his
371 # own Makefile.depend, because 'make dep' creates Makefile.depend with
372 # absolute pathnames, specific to the developer's system.
374 # So we empty out Makefile.depend here. The developer must do 'make dep' if
375 # he wants to edit and rebuild.
377 # Other projects have 'make distclean' _remove_ Makefile.depend and then
378 # have 'make' automatically build Makefile.depend. We have
379 # found that to be an utter disaster -- it's way too complicated and prone
380 # to failure, especially with built .h files. Better not to burden the user,
381 # who gains nothing from it, with that.
383 cat /dev/null >Makefile.depend
386 ifneq ($(OMIT_VERSION_H),Y)
390 .PHONY: distdir-common
392 @for file in $(DISTFILES); do \
394 if test -d $$d/$$file; then \
395 cp -pr $$d/$$file $(DISTDIR)/$$file; \
397 test -f $(DISTDIR)/$$file \
398 || ln $$d/$$file $(DISTDIR)/$$file 2> /dev/null \
399 || cp -p $$d/$$file $(DISTDIR)/$$file || :; \
403 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
406 list='$(SUBDIRS)'; for subdir in $$list; do \
407 if test "$$subdir" = .; then :; else \
408 test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
411 list='$(SOURCES) $(HEADERS)'; \
412 unique=`for i in $$list; do echo $$i; done | \
413 awk ' { files[$$0] = 1; } \
414 END { for (i in files) print i; }'`; \
415 test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
416 || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
418 DEP_SOURCES = $(wildcard *.c *.cpp)
420 # This is a filter to turn "foo.o:" rules into "foo.o foo.lo:" because Libtool
421 # uses .lo for object files. I'd like to purge the build of Libtool some day
422 # and eliminate this complication.
424 LIBTOOL_DEPEND_MASSAGER = perl -walnpe's{^(.*)\.o:}{$$1.o $$1.lo:}'
430 ifneq ($(DEP_SOURCES)x,x)
431 -$(CC) -MM -MG -I. $(INCLUDES) $(DEP_SOURCES) | \
432 $(LIBTOOL_DEPEND_MASSAGER) \
439 # The automatic dependency generation is a pain in the butt and
440 # totally unnecessary for people just installing the distributed code,
441 # so to avoid needless failures in the field and a complex build, the
442 # 'distclean' target simply makes Makefile.depend an empty file. A
443 # developer may do 'make dep' to create a Makefile.depend full of real
446 # Tell versions [3.59,3.63) of GNU make to not export all variables.
447 # Otherwise a system limit (for SysV at least) may be exceeded.
451 # Use the FORCE target as a dependency to force a target to get remade