2 SUBDIRS = srclib os server modules support
5 PROGRAM_NAME = $(progname)
6 PROGRAM_SOURCES = modules.c
7 PROGRAM_LDADD = buildmark.o $(HTTPD_LDFLAGS) $(PROGRAM_LDDEPS) $(HTTPD_LIBS) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS)
8 PROGRAM_PRELINK = $(COMPILE) -c $(top_srcdir)/server/buildmark.c
14 PROGRAM_DEPENDENCIES = \
20 sbin_PROGRAMS = $(PROGRAM_NAME)
21 TARGETS = $(sbin_PROGRAMS) $(shared_build) $(other_targets)
22 INSTALL_TARGETS = install-conf install-htdocs install-error install-icons \
23 install-other install-cgi install-include install-suexec install-build \
26 CLEAN_TARGETS = check/bin/* check/build/config_vars.mk \
27 check/conf/$(PROGRAM_NAME).conf check/conf/magic check/conf/mime.types \
28 check/conf/extra/* check/include/* $(testcase_OBJECTS) $(testcase_STUBS) \
29 test/httpdunit.cases test/unit/*.o
30 DISTCLEAN_TARGETS = include/ap_config_auto.h include/ap_config_layout.h \
31 include/apache_probes.h \
32 modules.c config.cache config.log config.status build/config_vars.mk \
33 build/rules.mk docs/conf/httpd.conf docs/conf/extra/*.conf shlibtool \
34 build/pkg/pkginfo build/config_vars.sh bsd_converted
35 EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in generated_lists \
37 PHONY_TARGETS := check check-conf check-dirs check-include unittest-objdir
41 include $(top_builddir)/build/rules.mk
42 include $(top_srcdir)/build/program.mk
45 @echo Installing configuration files
46 @$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir) $(DESTDIR)$(sysconfdir)/extra
47 @$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir)/original/extra
48 @cd $(top_srcdir)/docs/conf; \
49 for i in mime.types magic; do \
50 if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \
51 $(INSTALL_DATA) $$i $(DESTDIR)$(sysconfdir); \
54 for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
56 for i in httpd.conf extra/*.conf; do \
57 if [ -f $$i ] ; then \
59 n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
60 if test $$n_lm -eq 0 -o "x$(MPM_MODULES)$(DSO_MODULES)" = "x"; then \
61 sed -e 's#@@ServerRoot@@#$(prefix)#g' \
62 -e 's#@@Port@@#$(PORT)#g' \
63 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
64 -e '/@@LoadModule@@/d' \
67 sed -n -e '/@@LoadModule@@/q' \
68 -e 's#@@ServerRoot@@#$(prefix)#g' \
69 -e 's#@@Port@@#$(PORT)#g' \
70 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
73 if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
78 if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
83 for j in $(MPM_MODULES) "^EOL^"; do \
84 if test $$j != "^EOL^"; then \
85 if echo ",$(ENABLED_MPM_MODULE),"|$(EGREP) ",$$j," > /dev/null ; then \
86 loading_disabled=""; \
88 loading_disabled="#"; \
90 echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
93 for j in $(DSO_MODULES) "^EOL^"; do \
94 if test $$j != "^EOL^"; then \
95 if echo ",$(ENABLED_DSO_MODULES),"|$(EGREP) ",$$j," > /dev/null ; then \
96 loading_disabled=""; \
98 loading_disabled="#"; \
99 if test "$(LOAD_ALL_MODULES)" = "yes"; then \
100 loading_disabled=""; \
103 if test $$j = "cgid" -a "$$have_cgi" = "1"; then \
104 echo "<IfModule !mpm_prefork_module>"; \
105 echo " $${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
106 echo "</IfModule>"; \
107 elif test $$j = "cgi" -a "$$have_cgid" = "1"; then \
108 echo "<IfModule mpm_prefork_module>"; \
109 echo " $${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
110 echo "</IfModule>"; \
112 echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
116 sed -e '1,/@@LoadModule@@/d' \
117 -e '/@@LoadModule@@/d' \
118 -e 's#@@ServerRoot@@#$(prefix)#g' \
119 -e 's#@@Port@@#$(PORT)#g' \
120 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
123 ) > $(DESTDIR)$(sysconfdir)/original/$$i; \
124 chmod 0644 $(DESTDIR)$(sysconfdir)/original/$$i; \
126 if [ "$$i" = "httpd.conf" ]; then \
127 file=`echo $$i|sed s/.*.conf/$(PROGRAM_NAME).conf/`; \
129 if test ! -f $(DESTDIR)$(sysconfdir)/$$file; then \
130 $(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/original/$$i $(DESTDIR)$(sysconfdir)/$$file; \
135 if test -f "$(builddir)/envvars-std"; then \
136 cp -p envvars-std $(DESTDIR)$(sbindir); \
137 if test ! -f $(DESTDIR)$(sbindir)/envvars; then \
138 cp -p envvars-std $(DESTDIR)$(sbindir)/envvars ; \
142 # Create a sanitized config_vars.mk
143 build/config_vars.out: build/config_vars.mk build/config_vars.sh
144 @$(SHELL) build/config_vars.sh < build/config_vars.mk > build/config_vars.out
146 install-build: build/config_vars.out
147 @echo Installing build system files
148 @$(MKINSTALLDIRS) $(DESTDIR)$(installbuilddir)
149 @$(INSTALL_DATA) $(top_srcdir)/build/*.mk build/*.mk \
150 $(DESTDIR)$(installbuilddir)
151 @$(INSTALL_PROGRAM) $(top_builddir)/config.nice \
152 $(top_srcdir)/build/mkdir.sh \
153 $(top_srcdir)/build/instdso.sh \
154 $(DESTDIR)$(installbuilddir)
155 @$(INSTALL_DATA) build/config_vars.out $(DESTDIR)$(installbuilddir)/config_vars.mk
156 @rm build/config_vars.out
158 htdocs-srcdir = $(top_srcdir)/docs/docroot
161 @if test -d $(top_srcdir)/docs/manual/build; then \
162 cd $(top_srcdir)/docs/manual/build && ./build.sh all; \
164 echo 'For details on generating the docs, please read:'; \
165 echo ' http://httpd.apache.org/docs-project/docsformat.html'; \
169 @if test -d $(top_srcdir)/docs/manual/build; then \
170 cd $(top_srcdir)/docs/manual/build && ./build.sh validate-xml; \
172 echo 'For details on generating the docs, please read:'; \
173 echo ' http://httpd.apache.org/docs-project/docsformat.html'; \
177 doxygen $(top_srcdir)/docs/doxygen.conf
180 -@if [ -d $(DESTDIR)$(htdocsdir) ]; then \
181 echo "[PRESERVING EXISTING HTDOCS SUBDIR: $(DESTDIR)$(htdocsdir)]"; \
183 echo Installing HTML documents ; \
184 $(MKINSTALLDIRS) $(DESTDIR)$(htdocsdir) ; \
185 if test -d $(htdocs-srcdir) && test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
186 $(RSYNC) --exclude .svn -rlpt --numeric-ids $(htdocs-srcdir)/ $(DESTDIR)$(htdocsdir)/; \
188 test -d $(htdocs-srcdir) && (cd $(htdocs-srcdir) && cp -rp * $(DESTDIR)$(htdocsdir)) ; \
189 cd $(DESTDIR)$(htdocsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
194 -@if [ -d $(DESTDIR)$(errordir) ]; then \
195 echo "[PRESERVING EXISTING ERROR SUBDIR: $(DESTDIR)$(errordir)]"; \
197 echo Installing error documents ; \
198 $(MKINSTALLDIRS) $(DESTDIR)$(errordir) ; \
199 cd $(top_srcdir)/docs/error && cp -rp * $(DESTDIR)$(errordir) ; \
200 test "x$(errordir)" != "x" && cd $(DESTDIR)$(errordir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
204 -@if [ -d $(DESTDIR)$(iconsdir) ]; then \
205 echo "[PRESERVING EXISTING ICONS SUBDIR: $(DESTDIR)$(iconsdir)]"; \
207 echo Installing icons ; \
208 $(MKINSTALLDIRS) $(DESTDIR)$(iconsdir) ; \
209 cd $(top_srcdir)/docs/icons && cp -rp * $(DESTDIR)$(iconsdir) ; \
210 test "x$(iconsdir)" != "x" && cd $(DESTDIR)$(iconsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
214 -@if [ -d $(DESTDIR)$(cgidir) ];then \
215 echo "[PRESERVING EXISTING CGI SUBDIR: $(DESTDIR)$(cgidir)]"; \
217 echo Installing CGIs ; \
218 $(MKINSTALLDIRS) $(DESTDIR)$(cgidir) ; \
219 cd $(top_srcdir)/docs/cgi-examples && cp -rp * $(DESTDIR)$(cgidir) ; \
220 test "x$(cgidir)" != "x" && cd $(DESTDIR)$(cgidir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
224 @test -d $(DESTDIR)$(logfiledir) || $(MKINSTALLDIRS) $(DESTDIR)$(logfiledir)
225 @test -d $(DESTDIR)$(runtimedir) || $(MKINSTALLDIRS) $(DESTDIR)$(runtimedir)
226 @test -d $(DESTDIR)$(statedir) || $(MKINSTALLDIRS) $(DESTDIR)$(statedir)
227 @for ext in dll x; do \
228 file=apachecore.$$ext; \
229 if test -f $$file; then \
230 cp -p $$file $(DESTDIR)$(libdir); \
234 if test -f $$file; then \
235 cp -p $$file $(DESTDIR)$(bindir); \
240 $(srcdir)/include/*.h \
241 $(srcdir)/os/$(OS_DIR)/os.h \
242 $(srcdir)/modules/arch/unix/mod_unixd.h \
243 $(srcdir)/modules/core/mod_so.h \
244 $(srcdir)/modules/core/mod_watchdog.h \
245 $(srcdir)/modules/cache/mod_cache.h \
246 $(srcdir)/modules/cache/cache_common.h \
247 $(srcdir)/modules/database/mod_dbd.h \
248 $(srcdir)/modules/dav/main/mod_dav.h \
249 $(srcdir)/modules/http2/mod_http2.h \
250 $(srcdir)/modules/filters/mod_include.h \
251 $(srcdir)/modules/filters/mod_xml2enc.h \
252 $(srcdir)/modules/generators/mod_cgi.h \
253 $(srcdir)/modules/generators/mod_status.h \
254 $(srcdir)/modules/loggers/mod_log_config.h \
255 $(srcdir)/modules/mappers/mod_rewrite.h \
256 $(srcdir)/modules/proxy/mod_proxy.h \
257 $(srcdir)/modules/proxy/mod_serf.h \
258 $(srcdir)/modules/session/mod_session.h \
259 $(srcdir)/modules/ssl/mod_ssl.h \
260 $(srcdir)/modules/ssl/mod_ssl_openssl.h \
261 $(srcdir)/os/$(OS_DIR)/*.h
264 @echo Installing header files
265 @$(MKINSTALLDIRS) $(DESTDIR)$(includedir)
266 @$(INSTALL_DATA) $(INSTALL_HEADERS) $(DESTDIR)$(includedir)
269 @echo Installing man pages and online manual
270 @test -d $(DESTDIR)$(mandir) || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)
271 @test -d $(DESTDIR)$(mandir)/man1 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man1
272 @test -d $(DESTDIR)$(mandir)/man8 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man8
273 @test -d $(DESTDIR)$(manualdir) || $(MKINSTALLDIRS) $(DESTDIR)$(manualdir)
274 @cp -p $(top_srcdir)/docs/man/*.1 $(DESTDIR)$(mandir)/man1
275 @cp -p $(top_srcdir)/docs/man/*.8 $(DESTDIR)$(mandir)/man8
276 @if test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
277 $(RSYNC) --exclude .svn -rlpt --numeric-ids $(top_srcdir)/docs/manual/ $(DESTDIR)$(manualdir)/; \
279 cd $(top_srcdir)/docs/manual && cp -rp * $(DESTDIR)$(manualdir); \
280 cd $(DESTDIR)$(manualdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
283 install-suexec: install-suexec-$(INSTALL_SUEXEC)
285 install-suexec-binary:
286 @if test -f $(builddir)/support/suexec; then \
287 test -d $(DESTDIR)$(sbindir) || $(MKINSTALLDIRS) $(DESTDIR)$(sbindir); \
288 $(INSTALL_PROGRAM) $(top_builddir)/support/suexec $(DESTDIR)$(sbindir); \
291 install-suexec-setuid: install-suexec-binary
292 @if test -f $(builddir)/support/suexec; then \
293 chmod 4755 $(DESTDIR)$(sbindir)/suexec; \
296 install-suexec-caps: install-suexec-binary
297 @if test -f $(builddir)/support/suexec; then \
298 setcap 'cap_setuid,cap_setgid+pe' $(DESTDIR)$(sbindir)/suexec; \
302 cd support && $(MAKE) suexec
305 @rm -rf autom4te.cache
307 update-log-tags update-log-msg-tags:
308 find server modules os -name \*.c|xargs perl \
309 docs/log-message-tags/update-log-msg-tags
311 # XXX: This looks awfully platform-specific [read: bad form and style]
312 include $(top_srcdir)/os/os2/core.mk
318 # Installs the include/ header files into the ./check/ directory so we can use
319 # them during `make check`.
320 check-include: override includedir:=$(top_builddir)/check/include
321 check-include: install-include
323 # This is basically the same as install-conf, but we only care about the files
324 # necessary to run the test suite, and the LoadModule lines point back to the
325 # build tree. Configuration files will be installed to ./check/conf and pointed
326 # to by ./check/apxs.
328 @mkdir -p check/conf/extra; \
329 cd $(top_srcdir)/docs/conf; \
330 for i in mime.types magic; do \
331 $(INSTALL_DATA) $$i $(top_builddir)/check/conf; \
333 for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
335 for i in httpd.conf extra/*.conf; do \
336 if [ -f $$i ] ; then \
338 n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
339 if test $$n_lm -eq 0 -o "x$(MPM_MODULES)$(DSO_MODULES)" = "x"; then \
340 sed -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
341 -e 's#@@Port@@#$(PORT)#g' \
342 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
343 -e 's#$(prefix)#$(top_builddir)/check#g' \
344 -e 's/^#ServerName /ServerName /' \
345 -e '/@@LoadModule@@/d' \
348 sed -n -e '/@@LoadModule@@/q' \
349 -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
350 -e 's#@@Port@@#$(PORT)#g' \
351 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
352 -e 's#$(prefix)#$(top_builddir)/check#g' \
353 -e 's/^#ServerName /ServerName /' \
356 if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
361 if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
366 for j in $(MPM_MODULES) "^EOL^"; do \
367 path=$$(find "$(top_builddir)/server" -name "mod_$$j.so"); \
368 if test $$j != "^EOL^"; then \
369 if echo ",$(ENABLED_MPM_MODULE),"|$(EGREP) ",$$j," > /dev/null ; then \
370 loading_disabled=""; \
372 loading_disabled="#"; \
374 echo "$${loading_disabled}LoadModule $${j}_module $${path}"; \
377 for j in $(DSO_MODULES) "^EOL^"; do \
378 path=$$(find "$(top_builddir)/modules" -name "mod_$$j.so"); \
379 if test $$j != "^EOL^"; then \
380 if test $$j = "cgid" -a "$$have_cgi" = "1"; then \
381 echo "<IfModule !mpm_prefork_module>"; \
382 echo " LoadModule $${j}_module $${path}"; \
383 echo "</IfModule>"; \
384 elif test $$j = "cgi" -a "$$have_cgid" = "1"; then \
385 echo "<IfModule mpm_prefork_module>"; \
386 echo " LoadModule $${j}_module $${path}"; \
387 echo "</IfModule>"; \
389 echo "LoadModule $${j}_module $${path}"; \
393 sed -e '1,/@@LoadModule@@/d' \
394 -e '/@@LoadModule@@/d' \
395 -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
396 -e 's#@@Port@@#$(PORT)#g' \
397 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
398 -e 's#$(prefix)#$(top_builddir)/check#g' \
399 -e 's/^#ServerName /ServerName /' \
402 ) > $(top_builddir)/check/conf/$$i; \
403 chmod 0644 $(top_builddir)/check/conf/$$i; \
404 if [ "$$i" = "httpd.conf" ]; then \
405 mv "$(top_builddir)/check/conf/$$i" "$(top_builddir)/check/conf/$(PROGRAM_NAME).conf"; \
411 # Sometimes (e.g. when MPM DSOs are enabled) the test suite runs a full
412 # configuration check on our in-tree build. To pass, we have to have all of the
413 # correct directories, even though they won't be used.
415 @mkdir -p check/htdocs check/logs check/bin
417 check-binaries: check/bin/apxs check/bin/httpd check/bin/ab
420 ln -s $(top_builddir)/httpd check/bin/httpd
423 ln -s $(top_builddir)/support/ab check/bin/ab
425 # A version of apxs with the PREFIX overridden to point inside the install root
428 sed -e 's#$(prefix)#$(top_builddir)/check#g' support/apxs > $@
431 # A version of config_vars.mk with PREFIX and SBINDIR and BINDIR overridden.
432 check/build/config_vars.mk: build/config_vars.out
435 echo "prefix = $(top_builddir)/check" >> $@
436 echo "sbindir = $(top_builddir)/check/bin" >> $@
437 echo "bindir = $(top_builddir)/check/bin" >> $@
439 # Generate config & modules etc from scratch any time a header file is
440 # touched, so e.g. we don't get MMN mismatch against the modules built
442 $(TEST_SUITE_LOCATION)/Makefile: $(TEST_SUITE_LOCATION)/Makefile.PL $(INSTALL_HEADERS)
443 cd "$(TEST_SUITE_LOCATION)" && \
444 perl Makefile.PL -apxs "$(top_builddir)/check/bin/apxs" && \
448 check-make: $(TEST_SUITE_LOCATION)/Makefile
451 @echo 'Re-run configure with the --with-test-suite option to enable in-tree tests.'
454 check-yes: check-include check-dirs check-conf check/build/config_vars.mk \
455 check-binaries $(TEST_SUITE_LOCATION)/Makefile
456 cd $(TEST_SUITE_LOCATION) && $(MAKE) && ./t/TEST $(TESTS)
458 # Run the Apache::Test suite if it has been configured with --with-test-suite.
459 check: check-$(WITH_TEST_SUITE)
465 # Make sure the object subdirectories we use exist in the build directory during
470 # Normally I don't like wildcard sources, but for tests, autodiscovery is the
472 testcase_SOURCES := $(patsubst $(top_srcdir)/%,%,$(wildcard $(top_srcdir)/test/unit/*.c))
473 testcase_OBJECTS := $(testcase_SOURCES:%.c=%.lo)
474 testcase_STUBS := $(testcase_SOURCES:%.c=%.tests)
476 # Each testcase depends on the source file as well as the autogenerated .tests
478 $(testcase_OBJECTS): %.lo: %.c %.tests | unittest-objdir
480 $(testcase_STUBS): %.tests: %.c
481 $(top_srcdir)/build/httpdunit_gen_stubs.pl < "$<" > "$@"
483 test/httpdunit.cases: $(testcase_SOURCES) | unittest-objdir
484 cat $^ | $(top_srcdir)/build/httpdunit_gen_cases.pl --declaration > $@
485 cat $^ | $(top_srcdir)/build/httpdunit_gen_cases.pl >> $@
487 test/httpdunit.lo: test/httpdunit.c test/httpdunit.cases | unittest-objdir
489 # httpdunit is only added to $(other_targets) if configure detects a working
490 # libcheck on the system.
491 httpdunit_OBJECTS := test/httpdunit.lo $(testcase_OBJECTS)
492 $(httpdunit_OBJECTS): override LTCFLAGS += $(UNITTEST_CFLAGS)
493 test/httpdunit: $(httpdunit_OBJECTS) $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS)
494 $(LINK) $(httpdunit_OBJECTS) $(PROGRAM_OBJECTS) $(UNITTEST_LIBS) $(PROGRAM_LDADD)