2
0

common.mk 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. # This file contains rules and variable settings for the convenience
  2. # of every other make file in the package.
  3. # No make file is required to use this file, but it usually saves a lot
  4. # of duplication.
  5. # The following make variables are meaningful as input to this file:
  6. #
  7. # SRCDIR: Name of directory which is the top of the Xmlrpc-c source tree.
  8. # BLDDIR: Name of directory which is the top of the Xmlrpc-c build tree.
  9. include $(SRCDIR)/version.mk
  10. # .DELETE_ON_ERROR is a special predefined Make target that says to delete
  11. # the target if a command in the rule for it fails. That's important,
  12. # because we don't want a half-made target sitting around looking like it's
  13. # fully made.
  14. .DELETE_ON_ERROR:
  15. GCC_WARNINGS = -Wall -W -Wno-uninitialized -Wundef -Wimplicit -Winline \
  16. -Wno-unknown-pragmas
  17. # We need -Wwrite-strings after we fix all the missing consts
  18. #
  19. # -Wuninitialized catches some great bugs, but it also flags a whole lot
  20. # of perfectly good code that can't be written any better. Too bad there's
  21. # no way to annotate particular variables as being OK, so we could turn
  22. # on -Wuninitialized for all the others.
  23. GCC_C_WARNINGS = $(GCC_WARNINGS) \
  24. -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes
  25. GCC_CXX_WARNINGS = $(GCC_WARNINGS) -Wsynth
  26. # Before 09.05.20, we had -Woverloaded-virtual, but it doesn't seem to do
  27. # anything useful. It causes a warning that a method was hidden, but
  28. # experiments show nothing is actually hidden. The GCC manual's description
  29. # of what it does does not match empirical evidence. The option causes
  30. # warnings when a derived class of xmlrpc_c::method2 overrides one of the
  31. # execute() methods and not the other (as cpp/test/registry.cpp does), but the
  32. # code works fine.
  33. # The NDEBUG macro says not to build code that assumes there are no bugs.
  34. # This makes the code go faster. The main thing it does is tell the C library
  35. # to make assert() a no-op as opposed to generating code to check the
  36. # assertion and crash the program if it isn't really true. You can add
  37. # -UNDEBUG (in any of various ways) to override this.
  38. #
  39. CFLAGS_COMMON = -DNDEBUG
  40. CXXFLAGS_COMMON = -DNDEBUG
  41. ifeq ($(C_COMPILER_GNU),yes)
  42. CFLAGS_COMMON += $(GCC_C_WARNINGS) -fno-common -g -O3
  43. endif
  44. ifeq ($(CXX_COMPILER_GNU),yes)
  45. CXXFLAGS_COMMON += $(GCC_CXX_WARNINGS) -g
  46. endif
  47. DISTDIR = $(BLDDIR)/$(PACKAGE)-$(VERSION)/$(SUBDIR)
  48. # MIN is the minor version number for shared libraries.
  49. # MAJ is the major version number, but is set separately by
  50. # individual make files so that the major number of one library can change
  51. # from one release to another while the major number of another does not.
  52. MIN = $(XMLRPC_MINOR_RELEASE)
  53. # CURDIR was introduced in GNU Make 3.77.
  54. ifeq ($(CURDIR)x,x)
  55. CURDIR := $(shell /bin/pwd)
  56. endif
  57. # The package XmlRpc++ on Sourceforge includes a library named
  58. # libxmlrpc++ just as Xmlrpc-c does. To use them both, you may need
  59. # to rename one. To rename the Xmlrpc-c one, set the make variable
  60. # LIBXMLRPCPP_NAME, e.g. on the 'make' command line.
  61. ifeq ($(LIBXMLRPCPP_NAME),)
  62. LIBXMLRPCPP_NAME := xmlrpc++
  63. endif
  64. ##############################################################################
  65. # STATIC LINK LIBRARY RULES #
  66. ##############################################################################
  67. # To use this rule, the including make file must set a target-specific
  68. # variable LIBOBJECTS (and declare dependencies that include LIBOBJECTS).
  69. # Example:
  70. # FOO_OBJECTS = foo1.o foo2.o
  71. # libfoo.a: LIBOBJECTS = $(FOO_OBJECTS)
  72. # libfoo.a: $(FOO_OBJECTS)
  73. # TARGET_LIBRARY_NAMES = libfoo
  74. TARGET_STATIC_LIBRARIES = \
  75. $(TARGET_LIBRARY_NAMES:%=%.a) $(TARGET_LIB_NAMES_PP:%=%.a)
  76. $(TARGET_STATIC_LIBRARIES):
  77. -rm -f $@
  78. $(AR) cru $@ $(LIBOBJECTS)
  79. $(RANLIB) $@
  80. ##############################################################################
  81. # SHARED LIBRARY RULES, VARIABLES #
  82. ##############################################################################
  83. ifeq ($(SHARED_LIB_TYPE),unix)
  84. include $(SRCDIR)/unix-common.mk
  85. endif
  86. ifeq ($(SHARED_LIB_TYPE),irix)
  87. include $(SRCDIR)/irix-common.mk
  88. endif
  89. ifeq ($(SHARED_LIB_TYPE),dll)
  90. include $(SRCDIR)/dll-common.mk
  91. endif
  92. ifeq ($(SHARED_LIB_TYPE),dylib)
  93. include $(SRCDIR)/dylib-common.mk
  94. endif
  95. ifeq ($(SHARED_LIB_TYPE),NONE)
  96. install-shared-libraries:
  97. endif
  98. # To use this rule, the including make file must set a target-specific
  99. # variable LIBOBJECTS (and declare dependencies that include LIBOBJECTS).
  100. # Analogous to static library rule above.
  101. # Optionally, including make file can set LIBDEP (probably
  102. # target-specific) to the -L and -l options necessary to declare the
  103. # libraries the target uses at run time. (This information gets built
  104. # into the shared library so that the runtime library loader will load
  105. # the specified libraries when asked to load the target library).
  106. ifeq ($(MUST_BUILD_SHLIB),Y)
  107. TARGET_SHARED_LIBRARIES = $(call shlibfn, $(TARGET_LIBRARY_NAMES))
  108. TARGET_SHARED_LIBS_PP = $(call shlibfn, $(TARGET_LIB_NAMES_PP))
  109. ifeq ($(MUST_BUILD_SHLIBLE),Y)
  110. TARGET_SHARED_LE_LIBS = \
  111. $(call shliblefn, $(TARGET_LIBRARY_NAMES) $(TARGET_LIB_NAMES_PP))
  112. else
  113. TARGET_SHARED_LE_LIBS =
  114. endif
  115. else
  116. TARGET_SHARED_LIBRARIES =
  117. TARGET_SHARED_LIBS_PP =
  118. TARGET_SHARED_LE_LIBS =
  119. endif
  120. #------ the actual rules ----------------------------------------------------
  121. $(TARGET_SHARED_LIBRARIES) dummyshlib:
  122. $(CCLD) $(LADD) $(LDFLAGS_SHLIB) $(LIBOBJECTS) $(LIBDEP) -o $@
  123. $(TARGET_SHARED_LIBS_PP) dummyshlibpp:
  124. $(CXXLD) $(LADD) $(LDFLAGS_SHLIB) $(LIBOBJECTS) $(LIBDEP) -o $@
  125. #----------------------------------------------------------------------------
  126. LIBXMLRPC_UTIL_DIR = $(BLDDIR)/lib/libutil
  127. ifneq ($(OMIT_LIBXMLRPC_UTIL_RULE),Y)
  128. LIBXMLRPC_UTIL = \
  129. $(call shliblefn, $(LIBXMLRPC_UTIL_DIR)/libxmlrpc_util)
  130. LIBXMLRPC_UTIL_A = $(LIBXMLRPC_UTIL_DIR)/libxmlrpc_util.a
  131. endif
  132. ifneq ($(OMIT_XMLRPC_LIB_RULE),Y)
  133. LIBXMLRPC = \
  134. $(call shliblefn, $(BLDDIR)/src/libxmlrpc)
  135. LIBXMLRPC_CLIENT = \
  136. $(call shliblefn, $(BLDDIR)/src/libxmlrpc_client)
  137. LIBXMLRPC_SERVER = \
  138. $(call shliblefn, $(BLDDIR)/src/libxmlrpc_server)
  139. LIBXMLRPC_SERVER_ABYSS = \
  140. $(call shliblefn, $(BLDDIR)/src/libxmlrpc_server_abyss)
  141. LIBXMLRPC_SERVER_CGI = \
  142. $(call shliblefn, $(BLDDIR)/src/libxmlrpc_server_cgi)
  143. LIBXMLRPC_A = $(BLDDIR)/src/libxmlrpc.a
  144. LIBXMLRPC_CLIENT_A = $(BLDDIR)/src/libxmlrpc_client.a
  145. LIBXMLRPC_SERVER_A = $(BLDDIR)/src/libxmlrpc_server.a
  146. LIBXMLRPC_SERVER_ABYSS_A = $(BLDDIR)/src/libxmlrpc_server_abyss.a
  147. LIBXMLRPC_SERVER_CGI_A = $(BLDDIR)/src/libxmlrpc_server_cgi.a
  148. endif
  149. LIBXMLRPC_XMLTOK_DIR = $(BLDDIR)/lib/expat/xmltok
  150. ifneq ($(OMIT_XMLTOK_LIB_RULE),Y)
  151. LIBXMLRPC_XMLTOK = \
  152. $(call shliblefn, $(LIBXMLRPC_XMLTOK_DIR)/libxmlrpc_xmltok)
  153. LIBXMLRPC_XMLTOK_A = $(LIBXMLRPC_XMLTOK_DIR)/libxmlrpc_xmltok.a
  154. endif
  155. LIBXMLRPC_XMLPARSE_DIR = $(BLDDIR)/lib/expat/xmlparse
  156. ifneq ($(OMIT_XMLPARSE_LIB_RULE),Y)
  157. LIBXMLRPC_XMLPARSE = \
  158. $(call shliblefn, $(LIBXMLRPC_XMLPARSE_DIR)/libxmlrpc_xmlparse)
  159. LIBXMLRPC_XMLPARSE_A = $(LIBXMLRPC_XMLPARSE_DIR)/libxmlrpc_xmlparse.a
  160. endif
  161. LIBXMLRPC_ABYSS_DIR = $(BLDDIR)/lib/abyss/src
  162. ifneq ($(OMIT_ABYSS_LIB_RULE),Y)
  163. LIBXMLRPC_ABYSS = \
  164. $(call shliblefn, $(LIBXMLRPC_ABYSS_DIR)/libxmlrpc_abyss)
  165. LIBXMLRPC_ABYSS_A = $(LIBXMLRPC_ABYSS_DIR)/libxmlrpc_abyss.a
  166. endif
  167. LIBXMLRPC_CPP = \
  168. $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_cpp)
  169. LIBXMLRPC_CPP_A = $(BLDDIR)/src/cpp/libxmlrpc_cpp.a
  170. LIBXMLRPCPP = \
  171. $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc++)
  172. LIBXMLRPCPP_A = $(BLDDIR)/src/cpp/libxmlrpc++.a
  173. LIBXMLRPC_PACKETSOCKET = \
  174. $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_packetsocket)
  175. LIBXMLRPC_PACKETSOCKET_A = $(BLDDIR)/src/cpp/libxmlrpc_packetsocket.a
  176. LIBXMLRPC_CLIENTPP = \
  177. $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_client++)
  178. LIBXMLRPC_CLIENTPP_A = $(BLDDIR)/src/cpp/libxmlrpc_client++.a
  179. LIBXMLRPC_SERVERPP = \
  180. $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_server++)
  181. LIBXMLRPC_SERVERPP_A = $(BLDDIR)/src/cpp/libxmlrpc_server++.a
  182. LIBXMLRPC_SERVER_ABYSSPP = \
  183. $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_server_abyss++)
  184. LIBXMLRPC_SERVER_ABYSSPP_A = $(BLDDIR)/src/cpp/libxmlrpc_server_abyss++.a
  185. LIBXMLRPC_SERVER_PSTREAMPP = \
  186. $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_server_pstream++)
  187. LIBXMLRPC_SERVER_PSTREAMPP_A = $(BLDDIR)/src/cpp/libxmlrpc_server_pstream++.a
  188. # LIBXMLRPC_XML is the list of Xmlrpc-c libraries we need to parse
  189. # XML. If we're using an external library to parse XML, this is null.
  190. # LDLIBS_XML is the corresponding -L/-l options
  191. ifneq ($(ENABLE_LIBXML2_BACKEND),yes)
  192. # We're using the internal Expat XML parser
  193. LIBXMLRPC_XML = $(LIBXMLRPC_XMLPARSE) $(LIBXMLRPC_XMLTOK)
  194. LDLIBS_XML = \
  195. -L$(BLDDIR)/lib/expat/xmlparse -lxmlrpc_xmlparse \
  196. -L$(BLDDIR)/lib/expat/xmltok -lxmlrpc_xmltok
  197. else
  198. LDLIBS_XML = $(shell xml2-config --libs)
  199. endif
  200. ##############################################################################
  201. # RULES TO BUILD OBJECT FILES TO LINK INTO LIBRARIES #
  202. ##############################################################################
  203. # The including make file sets TARGET_MODS to a list of all modules that
  204. # might go into a library. Its a list of the bare module names. The
  205. # including make file also sets INCLUDES, in a target-dependent manner,
  206. # to the string of -I options needed for each target. Example:
  207. # TARGET_MODS = foo bar
  208. #
  209. # foo.o foo.osh: INCLUDES = -Iinclude -I/usr/include/foostuff
  210. # bar.o bar.osh: INCLUDES = -Iinclude -I/usr/include/barstuff
  211. #
  212. # include common.mk
  213. #
  214. # The above generates rules to build foo.o, bar.o, foo.osh, and bar.osh
  215. #
  216. # For C++ source files, use TARGET_MODS_PP instead.
  217. # CFLAGS and CXXFLAGS are designed to be picked up as environment
  218. # variables. The user may use them to add inclusion search directories
  219. # (-I) or control 32/64 bitness or the like. Using these is always
  220. # iffy, because the options one might include can interact in unpredictable
  221. # ways with what the make file is trying to do. But at least some users
  222. # get useful results.
  223. CFLAGS_ALL = $(CFLAGS_COMMON) $(CFLAGS_LOCAL) $(CFLAGS) \
  224. $(INCLUDES) $(CFLAGS_PERSONAL) $(CADD)
  225. CXXFLAGS_ALL = $(CXXFLAGS_COMMON) $(CFLAGS_LOCAL) $(CXXFLAGS) \
  226. $(INCLUDES) $(CFLAGS_PERSONAL) $(CADD)
  227. $(TARGET_MODS:%=%.o):%.o:%.c
  228. $(CC) -c -o $@ $(CFLAGS_ALL) $<
  229. $(TARGET_MODS:%=%.osh): CFLAGS_COMMON += $(CFLAGS_SHLIB)
  230. $(TARGET_MODS:%=%.osh):%.osh:%.c
  231. $(CC) -c -o $@ $(INCLUDES) $(CFLAGS_ALL) $(CFLAGS_SHLIB) $<
  232. $(TARGET_MODS_PP:%=%.o):%.o:%.cpp
  233. $(CXX) -c -o $@ $(INCLUDES) $(CXXFLAGS_ALL) $<
  234. $(TARGET_MODS_PP:%=%.osh): CXXFLAGS_COMMON += $(CFLAGS_SHLIB)
  235. $(TARGET_MODS_PP:%=%.osh):%.osh:%.cpp
  236. $(CXX) -c -o $@ $(INCLUDES) $(CXXFLAGS_ALL) $<
  237. ##############################################################################
  238. # MISC BUILD RULES #
  239. ##############################################################################
  240. # We use the srcdir symbolic link simply to make the make
  241. # rules easier to read in the make output. We could use the $(SRCDIR)
  242. # variable, but that makes the compile and link commands
  243. # a mile long. Note that Make sometime figures that a directory which
  244. # is a dependency is newer than the symbolic link pointing to it and wants
  245. # to rebuild the symbolic link. So we don't make $(SRCDIR) a
  246. # dependency of 'srcdir'.
  247. srcdir:
  248. $(LN_S) $(SRCDIR) $@
  249. blddir:
  250. $(LN_S) $(BLDDIR) $@
  251. ##############################################################################
  252. # RECURSIVE SUBDIRECTORY BUILD RULES #
  253. ##############################################################################
  254. .PHONY: $(SUBDIRS:%=%/all)
  255. $(SUBDIRS:%=%/all): %/all: $(CURDIR)/%
  256. $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
  257. $(notdir $@)
  258. .PHONY: $(SUBDIRS:%=%/install)
  259. $(SUBDIRS:%=%/install): %/install: $(CURDIR)/%
  260. $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
  261. $(notdir $@)
  262. .PHONY: $(SUBDIRS:%=%/clean)
  263. $(SUBDIRS:%=%/clean): %/clean: $(CURDIR)/%
  264. $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
  265. $(notdir $@)
  266. .PHONY: $(SUBDIRS:%=%/distclean)
  267. $(SUBDIRS:%=%/distclean): %/distclean: $(CURDIR)/%
  268. $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
  269. $(notdir $@)
  270. .PHONY: $(SUBDIRS:%=%/check)
  271. $(SUBDIRS:%=%/check): %/check: $(CURDIR)/%
  272. $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
  273. $(notdir $@)
  274. .PHONY: $(SUBDIRS:%=%/distdir)
  275. $(SUBDIRS:%=%/distdir): %/distdir: $(CURDIR)/%
  276. $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
  277. $(notdir $@)
  278. .PHONY: $(SUBDIRS:%=%/dep)
  279. $(SUBDIRS:%=%/dep): %/dep: $(CURDIR)/%
  280. $(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
  281. $(notdir $@)
  282. ##############################################################################
  283. # CROSS-COMPONENT BUILD RULES #
  284. ##############################################################################
  285. ifneq ($(OMIT_WININET_TRANSPORT_RULE),Y)
  286. $(BLDDIR)/lib/wininet_transport/xmlrpc_wininet_transport.o \
  287. $(BLDDIR)/lib/wininet_transport/xmlrpc_wininet_transport.osh \
  288. : FORCE
  289. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/wininet_transport/Makefile \
  290. $(notdir $@)
  291. endif
  292. ifneq ($(OMIT_CURL_TRANSPORT_RULE),Y)
  293. $(BLDDIR)/lib/curl_transport/xmlrpc_curl_transport.o \
  294. $(BLDDIR)/lib/curl_transport/xmlrpc_curl_transport.osh \
  295. $(BLDDIR)/lib/curl_transport/curltransaction.o \
  296. $(BLDDIR)/lib/curl_transport/curltransaction.osh \
  297. $(BLDDIR)/lib/curl_transport/curlmulti.o \
  298. $(BLDDIR)/lib/curl_transport/curlmulti.osh \
  299. $(BLDDIR)/lib/curl_transport/lock_pthread.o \
  300. $(BLDDIR)/lib/curl_transport/lock_pthread.osh \
  301. : FORCE
  302. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/curl_transport/Makefile \
  303. $(notdir $@)
  304. endif
  305. ifneq ($(OMIT_LIBWWW_TRANSPORT_RULE),Y)
  306. $(BLDDIR)/lib/libwww_transport/xmlrpc_libwww_transport.o \
  307. $(BLDDIR)/lib/libwww_transport/xmlrpc_libwww_transport.osh \
  308. : FORCE
  309. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/libwww_transport/Makefile \
  310. $(notdir $@)
  311. endif
  312. $(LIBXMLRPC) \
  313. $(LIBXMLRPC_CLIENT) \
  314. $(LIBXMLRPC_SERVER) \
  315. $(LIBXMLRPC_SERVER_ABYSS) \
  316. $(LIBXMLRPC_SERVER_CGI) \
  317. $(LIBXMLRPC_A) \
  318. $(LIBXMLRPC_CLIENT_A) \
  319. $(LIBXMLRPC_SERVER_A) \
  320. $(LIBXMLRPC_SERVER_ABYSS_A) \
  321. $(LIBXMLRPC_SERVER_CGI_A): FORCE
  322. $(MAKE) -C $(dir $@) -f $(SRCDIR)/src/Makefile \
  323. $(notdir $@)
  324. $(LIBXMLRPC_UTIL) $(LIBXMLRPC_UTIL_A) : FORCE
  325. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/libutil/Makefile \
  326. $(notdir $@)
  327. $(LIBXMLRPC_XMLPARSE) $(LIBXMLRPC_XMLPARSE_A) : FORCE
  328. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/expat/xmlparse/Makefile \
  329. $(notdir $@)
  330. $(LIBXMLRPC_XMLTOK) $(LIBXMLRPC_XMLTOK_A) : FORCE
  331. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/expat/xmltok/Makefile \
  332. $(notdir $@)
  333. $(LIBXMLRPC_ABYSS) $(LIBXMLRPC_ABYSS_A): FORCE
  334. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/abyss/src/Makefile \
  335. $(notdir $@)
  336. ifneq ($(OMIT_CPP_LIB_RULES),Y)
  337. $(LIBXMLRPCPP) $(LIBXMLRPCPP_A) \
  338. $(LIBXMLRPC_PACKETSOCKET) $(LIBXMLRPC_PACKETSOCKET_A) \
  339. $(LIBXMLRPC_CLIENTPP) $(LIBXMLRPC_CLIENTPP_A) \
  340. $(LIBXMLRPC_SERVERPP) $(LIBXMLRPC_SERVERPP_A) \
  341. $(LIBXMLRPC_SERVER_ABYSSPP) $(LIBXMLRPC_SERVER_ABYSSPP_A) \
  342. $(LIBXMLRPC_SERVER_PSTREAMPP) $(LIBXMLRPC_SERVER_PSTREAMPP_A) \
  343. $(LIBXMLRPC_CPP) $(LIBXMLRPC_CPP_A) : FORCE
  344. $(MAKE) -C $(dir $@) -f $(SRCDIR)/src/cpp/Makefile \
  345. $(notdir $@)
  346. endif
  347. # For the following utilities, we don't bother with a library -- we
  348. # just explicitly link the object file we need. This is to save
  349. # complexity. If the list gets too big, we may need a library just to
  350. # keep link commands short.
  351. UTIL_DIR = $(BLDDIR)/lib/util
  352. UTILS = \
  353. casprintf.o \
  354. cmdline_parser.o \
  355. cmdline_parser_cpp.o \
  356. getoptx.o \
  357. stripcaseeq.o \
  358. string_parser.o \
  359. ifneq ($(OMIT_UTILS_RULE),Y)
  360. $(UTILS:%=$(UTIL_DIR)/%): FORCE
  361. $(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/util/Makefile \
  362. $(notdir $@)
  363. endif
  364. CASPRINTF = $(UTIL_DIR)/casprintf.o
  365. # About version.h: This is a built header file, which means it is a supreme
  366. # pain in the ass. The biggest problem is that when we automatically make
  367. # dependencies (depend.mk), it doesn't exist yet. This means Gcc
  368. # generates a dependency on it being in the local directory. Therefore,
  369. # we generate it in the local directory, as a symbolic link, wherever it
  370. # is needed. But the original is always in the top level directory,
  371. # generated by a rule in that directory's make file. Problem 2 is that
  372. # the top directory's make file includes common.mk, so the rules
  373. # below conflict with it. That's what OMIT_VERSION_H is for.
  374. ifneq ($(OMIT_VERSION_H),Y)
  375. $(BLDDIR)/version.h:
  376. $(MAKE) -C $(dir $@) -f $(SRCDIR)/GNUmakefile $(notdir $@)
  377. version.h: $(BLDDIR)/version.h
  378. $(LN_S) $< $@
  379. endif
  380. ifneq ($(OMIT_CONFIG_H_RULE),Y)
  381. $(BLDDIR)/include/xmlrpc-c/config.h:
  382. $(MAKE) -C $(BLDDIR)/include -f $(SRCDIR)/include/Makefile \
  383. xmlrpc-c/config.h
  384. endif
  385. ifneq ($(OMIT_TRANSPORT_CONFIG_H),Y)
  386. $(BLDDIR)/transport_config.h:
  387. $(MAKE) -C $(dir $@) -f $(SRCDIR)/GNUmakefile $(notdir $@)
  388. endif
  389. ifneq ($(OMIT_XMLRPC_C_CONFIG_TEST),Y)
  390. $(BLDDIR)/xmlrpc-c-config.test:
  391. $(MAKE) -C $(dir $@) -f $(SRCDIR)/GNUmakefile $(notdir $@)
  392. endif
  393. $(TARGET_MODS:%=%.o) $(TARGET_MODS:%=%.osh): \
  394. $(BLDDIR)/include/xmlrpc-c/config.h
  395. # With a separate build directory, you have to make the directory itself
  396. # before you can make anything in it. Here's the rule to do that.
  397. $(SUBDIRS:%=$(CURDIR)/%):
  398. mkdir $@
  399. ##############################################################################
  400. # INSTALL RULES #
  401. # (except shared libraries) #
  402. ##############################################################################
  403. MKINSTALLDIRS = $(SHELL) $(SRCDIR)/mkinstalldirs
  404. .PHONY: install-common install-headers install-bin install-man
  405. install-common: \
  406. install-static-libraries install-shared-libraries \
  407. install-headers install-bin install-man
  408. INSTALL_LIB_CMD = $(INSTALL_DATA) $$p $(DESTDIR)$(LIBINST_DIR)/$$p
  409. RANLIB_CMD = $(RANLIB) $(DESTDIR)$(LIBINST_DIR)/$$p
  410. install-static-libraries: $(STATIC_LIBRARIES_TO_INSTALL)
  411. $(MKINSTALLDIRS) $(DESTDIR)$(LIBINST_DIR)
  412. @list='$(STATIC_LIBRARIES_TO_INSTALL)'; for p in $$list; do \
  413. if test -f $$p; then \
  414. echo " $(INSTALL_LIB_CMD)"; \
  415. $(INSTALL_LIB_CMD); \
  416. else :; fi; \
  417. done
  418. @$(POST_INSTALL)
  419. @list='$(STATIC_LIBRARIES_TO_INSTALL)'; for p in $$list; do \
  420. if test -f $$p; then \
  421. echo " $(RANLIB_CMD)"; \
  422. $(RANLIB_CMD); \
  423. else :; fi; \
  424. done
  425. HEADERDESTDIR = $(DESTDIR)$(HEADERINST_DIR)
  426. INSTALL_HDR_CMD = $(INSTALL_DATA) $$d$$p $(HEADERDESTDIR)/$$p
  427. install-headers: $(HEADERS_TO_INSTALL)
  428. $(MKINSTALLDIRS) $(HEADERDESTDIR)
  429. $(MKINSTALLDIRS) $(HEADERDESTDIR)/xmlrpc-c
  430. @list='$(HEADERS_TO_INSTALL)'; for p in $$list; do \
  431. if test -f "$$p"; then d= ; else d="$(SRCDIR)/$(SUBDIR)/"; fi; \
  432. echo " $(INSTALL_HDR_CMD)"; \
  433. $(INSTALL_HDR_CMD); \
  434. done
  435. INSTALL_PROGRAM_CMD = $(INSTALL_PROGRAM) $$p $(DESTDIR)$(PROGRAMINST_DIR)/$$p
  436. install-bin: $(PROGRAMS_TO_INSTALL) $(DESTDIR)$(PROGRAMINST_DIR)
  437. @list='$(PROGRAMS_TO_INSTALL)'; \
  438. for p in $$list; do \
  439. echo "$(INSTALL_PROGRAM_CMD)"; \
  440. $(INSTALL_PROGRAM_CMD); \
  441. done
  442. $(DESTDIR)$(PROGRAMINST_DIR):
  443. $(MKINSTALLDIRS) $@
  444. MANDESTDIR = $(DESTDIR)$(MANINST_DIR)
  445. INSTALL_MAN_CMD = $(INSTALL_DATA) $$p $(MANDESTDIR)/$$p
  446. install-man: $(MAN_FILES_TO_INSTALL)
  447. $(MKINSTALLDIRS) $(MANDESTDIR)
  448. @list='$(MAN_FILES_TO_INSTALL)'; \
  449. for p in $$list; do \
  450. echo "$(MAN_FILES_TO_INSTALL)"; \
  451. $(INSTALL_MAN_CMD); \
  452. done
  453. ##############################################################################
  454. # MISCELLANEOUS RULES #
  455. ##############################################################################
  456. .PHONY: clean-common
  457. clean-common:
  458. rm -f *.o *.osh *.a *.s *.i *.la *.lo
  459. rm -f *.$(SHLIB_SUFFIX) *.$(SHLIB_SUFFIX).*
  460. rm -rf .libs
  461. ifneq ($(OMIT_VERSION_H),Y)
  462. rm -f version.h
  463. endif
  464. .PHONY: distclean-common
  465. distclean-common:
  466. # depend.mk is generated by 'make dep' and contains only dependencies
  467. # that make parts get _rebuilt_ when parts upon which they depend change.
  468. # It does not contain dependencies that are necessary to cause a part to
  469. # get built in the first place. E.g. if foo.c uses bar.h and bar.h gets built
  470. # by a make rule, you must put the dependency of foo.c on bar.h somewhere
  471. # besides depend.mk.
  472. #
  473. # Because of this, a user doesn't need depend.mk, because he
  474. # doesn't modify source files. A developer, on the other hand, must make his
  475. # own depend.mk, because 'make dep' creates depend.mk with
  476. # absolute pathnames, specific to the developer's system.
  477. #
  478. # So we obliterate depend.mk here. The build will automatically
  479. # create an empty depend.mk when it is needed for the user. The
  480. # developer must do 'make dep' if he wants to edit and rebuild.
  481. #
  482. # Other projects have the build automatically build a true
  483. # depend.mk, suitable for a developer. We have found that to be
  484. # an utter disaster -- it's way too complicated and prone to failure,
  485. # especially with built .h files. Better not to burden the user, who
  486. # gains nothing from it, with that.
  487. #
  488. rm -f depend.mk
  489. rm -f Makefile.depend # We used to create a file by this name
  490. rm -f srcdir blddir
  491. .PHONY: distdir-common
  492. distdir-common:
  493. @for file in $(DISTFILES); do \
  494. d=$(SRCDIR); \
  495. if test -d $$d/$$file; then \
  496. cp -pr $$d/$$file $(DISTDIR)/$$file; \
  497. else \
  498. test -f $(DISTDIR)/$$file \
  499. || ln $$d/$$file $(DISTDIR)/$$file 2> /dev/null \
  500. || cp -p $$d/$$file $(DISTDIR)/$$file || :; \
  501. fi; \
  502. done
  503. DEP_SOURCES = $(wildcard *.c *.cpp)
  504. # This is a filter to turn "foo.o:" rules into "foo.o foo.lo foo.osh:"
  505. # to make dependencies for all the various forms of object file out of
  506. # a file made by a depedency generator that knows only about .o.
  507. DEPEND_MASSAGER = perl -walnpe's{^(.*)\.o:}{$$1.o $$1.lo $$1.osh:}'
  508. .PHONY: dep-common
  509. dep-common: FORCE
  510. ifneq ($(DEP_SOURCES)x,x)
  511. -$(CC) -MM -MG -I. $(INCLUDES) $(DEP_SOURCES) | \
  512. $(DEPEND_MASSAGER) \
  513. >depend.mk
  514. endif
  515. depend.mk:
  516. cat /dev/null >$@
  517. # The automatic dependency generation is a pain in the butt and
  518. # totally unnecessary for people just installing the distributed code,
  519. # so to avoid needless failures in the field and a complex build, the
  520. # 'distclean' target simply makes depend.mk an empty file. A
  521. # developer may do 'make dep' to create a depend.mk full of real
  522. # dependencies.
  523. # Tell versions [3.59,3.63) of GNU make to not export all variables.
  524. # Otherwise a system limit (for SysV at least) may be exceeded.
  525. .NOEXPORT:
  526. # Use the FORCE target as a dependency to force a target to get remade
  527. FORCE: