GNUmakefile 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. include srcdir.mk
  2. BLDDIR = $(CURDIR)
  3. SUBDIR =
  4. export SRCDIR
  5. export BLDDIR
  6. include $(BLDDIR)/config.mk
  7. SUBDIRS = include lib src tools examples
  8. # The reason we don't build tools and examples by default is that they
  9. # contain executables, which require significantly more from the
  10. # environment to build than libraries. Ergo, they are signficantly
  11. # more likely to fail to build. Indeed, when 'tools' was built by
  12. # default, the majority of the reported build problems were with that.
  13. # Since they are ancillary to the package, building them by default is
  14. # not worth causing the whole build to fail.
  15. # As with any subdirectory, to build 'tools' or 'examples', cd to the
  16. # subdirectory and make there.
  17. DEFAULT_SUBDIRS = include lib src
  18. ifeq ($(BUILD_TOOLS),yes)
  19. DEFAULT_SUBDIRS += tools
  20. endif
  21. PROGRAMS_TO_INSTALL = xmlrpc-c-config
  22. default: xmlrpc-c-config xmlrpc-c-config.test $(DEFAULT_SUBDIRS:%=%/all)
  23. # We don't want common.mk's rule for version.h
  24. OMIT_VERSION_H = Y
  25. # We don't want common.mk's rule for transport_config.h
  26. OMIT_TRANSPORT_CONFIG_H = Y
  27. # We don't want common.mk's rule for xmlrpc-c-config.test:
  28. OMIT_XMLRPC_C_CONFIG_TEST = Y
  29. include $(SRCDIR)/common.mk
  30. .PHONY: all
  31. all: xmlrpc-c-config xmlrpc-c-config.test $(SUBDIRS:%=%/all)
  32. # The examples subdirectory is special, because even the make file in there
  33. # is designed to be an example. So it has to be simple and as close as
  34. # possible to something a person could use outside of the Xmlrpc-c source
  35. # tree. One ramification of that is that it does not specify dependencies
  36. # on other parts of the Xmlrpc-c build. That means we must separately
  37. # ensure that the Xmlrpc-c libraries are built before making the example
  38. # programs.
  39. #
  40. # It also means that you have to manually clean the examples directory
  41. # in order to get the examples rebuilt after you modify the Xmlrpc-c
  42. # libraries.
  43. examples/all: xmlrpc-c-config.test lib/all src/all include/all
  44. # Parallel make (make --jobs) is not smart enough to coordinate builds
  45. # between submakes, so a naive parallel make would cause certain
  46. # targets to get built multiple times simultaneously. That is usually
  47. # unacceptable. So we introduce extra dependencies here just to make
  48. # sure such targets are already up to date before the submake starts,
  49. # for the benefit of parallel make. Note that we ensure that parallel
  50. # make works for 'make all' in the top directory, but it may still fail
  51. # for the aforementioned reason for other invocations.
  52. tools/all: include/all lib/all src/all
  53. src/all lib/all: include/all
  54. src/all: lib/all
  55. MAJOR := $(XMLRPC_MAJOR_RELEASE)
  56. MINOR := $(XMLRPC_MINOR_RELEASE)
  57. POINT := $(XMLRPC_POINT_RELEASE)
  58. version.h: $(SRCDIR)/version.mk
  59. rm -f $@
  60. echo "/* Generated by make file rule */" >>$@
  61. echo "#define XMLRPC_C_VERSION" \"$(MAJOR).$(MINOR).$(POINT)"\"" >>$@
  62. echo "#define XMLRPC_VERSION_MAJOR $(MAJOR)" >>$@
  63. echo "#define XMLRPC_VERSION_MINOR $(MINOR)" >>$@
  64. echo "#define XMLRPC_VERSION_POINT $(POINT)" >>$@
  65. include transport_config.mk
  66. # shell_config is a fragment to place inside a Bourne shell program that
  67. # sets variables that tell how the build is configured.
  68. shell_config: $(BLDDIR)/config.mk
  69. rm -f $@
  70. @echo "Lots of echoes to '$@' suppressed here ..."
  71. @echo '#' >>$@
  72. @echo '#######################################################' >>$@
  73. @echo "# From '$@'" >>$@
  74. @echo '#######################################################' >>$@
  75. @echo 'ENABLE_ABYSS_THREADS="$(ENABLE_ABYSS_THREADS)"' >>$@
  76. @echo 'ENABLE_LIBXML2_BACKEND="$(ENABLE_LIBXML2_BACKEND)"' >>$@
  77. @echo 'MUST_BUILD_WININET_CLIENT="$(MUST_BUILD_WININET_CLIENT)"'>>$@
  78. @echo 'MUST_BUILD_CURL_CLIENT="$(MUST_BUILD_CURL_CLIENT)"' >>$@
  79. @echo 'MUST_BUILD_LIBWWW_CLIENT="$(MUST_BUILD_LIBWWW_CLIENT)"' >>$@
  80. @echo 'NEED_RPATH="$(NEED_RPATH)"' >>$@
  81. @echo 'NEED_WL_RPATH="$(NEED_WL_RPATH)"' >>$@
  82. @echo 'LIBXMLRPCPP_NAME="$(LIBXMLRPCPP_NAME)"' >>$@
  83. @echo 'LSOCKET="$(LSOCKET)"' >>$@
  84. @echo 'WININET_LDADD="$(WININET_LDADD)"' >>$@
  85. @echo 'WININET_LIBDIR="$(WININET_LIBDIR)"' >>$@
  86. @echo 'CURL_LDADD="$(CURL_LDADD)"' >>$@
  87. @echo 'CURL_LIBDIR="$(CURL_LIBDIR)"' >>$@
  88. @echo 'LIBWWW_LDADD="$(LIBWWW_LDADD)"' >>$@
  89. @echo 'LIBWWW_LIBDIR="$(LIBWWW_LIBDIR)"' >>$@
  90. @echo 'XMLRPC_MAJOR_RELEASE="$(XMLRPC_MAJOR_RELEASE)"' >>$@
  91. @echo 'XMLRPC_MINOR_RELEASE="$(XMLRPC_MINOR_RELEASE)"' >>$@
  92. @echo 'XMLRPC_POINT_RELEASE="$(XMLRPC_POINT_RELEASE)"' >>$@
  93. @echo 'FEATURE_LIST="$(FEATURE_LIST)"' >>$@
  94. @echo 'PREFIX="$(PREFIX)"' >>$@
  95. @echo 'HEADERINST_DIR="$(HEADERINST_DIR)"' >>$@
  96. @echo 'LIBINST_DIR="$(LIBINST_DIR)"' >>$@
  97. @echo 'BLDDIR="$(BLDDIR)"' >>$@
  98. @echo 'ABS_SRCDIR="$(ABS_SRCDIR)"' >>$@
  99. @echo '#######################################################' >>$@
  100. xmlrpc-c-config xmlrpc-c-config.test:%: %.main shell_config
  101. rm -f $@
  102. @echo "Echoes to '$@' suppressed here ..."
  103. @echo '#! /bin/sh' >>$@
  104. @echo '#' >>$@
  105. @echo '# This file was generated by a make rule' >>$@
  106. @echo '#' >>$@
  107. cat shell_config >>$@
  108. cat $< >>$@
  109. chmod a+rx $@
  110. .PHONY: clean clean-local
  111. clean: $(SUBDIRS:%=%/clean) clean-common clean-local
  112. clean-local:
  113. rm -f transport_config.h version.h
  114. .PHONY: distclean distclean-local
  115. distclean: $(SUBDIRS:%=%/distclean) distclean-common distclean-local
  116. distclean-local: clean-local
  117. rm -f config.log config.status config.mk srcdir.mk
  118. rm -f xmlrpc_config.h xmlrpc_amconfig.h stamp-h
  119. rm -f shell_config xmlrpc-c-config xmlrpc-c-config.test
  120. rm -f TAGS
  121. check: $(SUBDIRS:%=%/check)
  122. DISTFILES =
  123. .PHONY: distdir
  124. distdir: distdir-common
  125. .PHONY: install
  126. install: $(DEFAULT_SUBDIRS:%=%/install) install-common
  127. .PHONY: dep
  128. dep: version.h $(BLDDIR)/include/xmlrpc-c/config.h $(SUBDIRS:%=%/dep)
  129. xmlrpc_config.h xmlrpc_amconfig.h \
  130. :%:%.in $(SRCDIR)/configure
  131. $(SRCDIR)/configure
  132. # A trick to catch a common user error. When you don't run 'configure',
  133. # you don't have a srcdir.mk, which means $(SRCDIR) is null.
  134. /common.mk:
  135. @echo =======================================
  136. @echo = You must run Configure before Make. =
  137. @echo =======================================
  138. false
  139. # 'tags' generates/updates an Emacs tags file, anmed TAGS, in the current
  140. # directory. Use with Emacs command 'find-tag'.
  141. .PHONY: tags
  142. tags:
  143. find . -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" | \
  144. etags -