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