2 SUBDIRS = srclib os server modules support
5 PROGRAM_NAME = $(progname)
6 PROGRAM_SOURCES = modules.c
7 PROGRAM_LDADD = buildmark.o $(HTTPD_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(HTTPD_LIBS) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS)
8 PROGRAM_PRELINK = $(COMPILE) -c $(top_srcdir)/server/buildmark.c
9 PROGRAM_DEPENDENCIES = \
15 sbin_PROGRAMS = $(PROGRAM_NAME)
16 TARGETS = $(sbin_PROGRAMS) $(shared_build) $(other_targets)
17 INSTALL_TARGETS = install-conf install-htdocs install-error install-icons \
18 install-other install-cgi install-include install-suexec install-build \
21 CLEAN_TARGETS = check/bin/* check/build/config_vars.mk \
22 check/conf/$(PROGRAM_NAME).conf check/conf/magic check/conf/mime.types \
23 check/conf/extra/* check/include/* $(testcase_OBJECTS) $(testcase_STUBS) \
24 test/httpdunit.cases test/unit/*.o
25 DISTCLEAN_TARGETS = include/ap_config_auto.h include/ap_config_layout.h \
26 include/apache_probes.h \
27 modules.c config.cache config.log config.status build/config_vars.mk \
28 build/rules.mk docs/conf/httpd.conf docs/conf/extra/*.conf shlibtool \
29 build/pkg/pkginfo build/config_vars.sh bsd_converted
30 EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in generated_lists \
32 PHONY_TARGETS := check check-conf check-dirs check-include unittest-objdir
36 include $(top_builddir)/build/rules.mk
37 include $(top_srcdir)/build/program.mk
40 @echo Installing configuration files
41 @$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir) $(DESTDIR)$(sysconfdir)/extra
42 @$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir)/original/extra
43 @cd $(top_srcdir)/docs/conf; \
44 for i in mime.types magic; do \
45 if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \
46 $(INSTALL_DATA) $$i $(DESTDIR)$(sysconfdir); \
49 for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
51 for i in httpd.conf extra/*.conf; do \
52 if [ -f $$i ] ; then \
54 n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
55 if test $$n_lm -eq 0 -o "x$(MPM_MODULES)$(DSO_MODULES)" = "x"; then \
56 sed -e 's#@@ServerRoot@@#$(prefix)#g' \
57 -e 's#@@Port@@#$(PORT)#g' \
58 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
59 -e '/@@LoadModule@@/d' \
62 sed -n -e '/@@LoadModule@@/q' \
63 -e 's#@@ServerRoot@@#$(prefix)#g' \
64 -e 's#@@Port@@#$(PORT)#g' \
65 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
68 if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
73 if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
78 for j in $(MPM_MODULES) "^EOL^"; do \
79 if test $$j != "^EOL^"; then \
80 if echo ",$(ENABLED_MPM_MODULE),"|$(EGREP) ",$$j," > /dev/null ; then \
81 loading_disabled=""; \
83 loading_disabled="#"; \
85 echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
88 for j in $(DSO_MODULES) "^EOL^"; do \
89 if test $$j != "^EOL^"; then \
90 if echo ",$(ENABLED_DSO_MODULES),"|$(EGREP) ",$$j," > /dev/null ; then \
91 loading_disabled=""; \
93 loading_disabled="#"; \
94 if test "$(LOAD_ALL_MODULES)" = "yes"; then \
95 loading_disabled=""; \
98 if test $$j = "cgid" -a "$$have_cgi" = "1"; then \
99 echo "<IfModule !mpm_prefork_module>"; \
100 echo " $${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
101 echo "</IfModule>"; \
102 elif test $$j = "cgi" -a "$$have_cgid" = "1"; then \
103 echo "<IfModule mpm_prefork_module>"; \
104 echo " $${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
105 echo "</IfModule>"; \
107 echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
111 sed -e '1,/@@LoadModule@@/d' \
112 -e '/@@LoadModule@@/d' \
113 -e 's#@@ServerRoot@@#$(prefix)#g' \
114 -e 's#@@Port@@#$(PORT)#g' \
115 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
118 ) > $(DESTDIR)$(sysconfdir)/original/$$i; \
119 chmod 0644 $(DESTDIR)$(sysconfdir)/original/$$i; \
121 if [ "$$i" = "httpd.conf" ]; then \
122 file=`echo $$i|sed s/.*.conf/$(PROGRAM_NAME).conf/`; \
124 if test ! -f $(DESTDIR)$(sysconfdir)/$$file; then \
125 $(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/original/$$i $(DESTDIR)$(sysconfdir)/$$file; \
130 if test -f "$(builddir)/envvars-std"; then \
131 cp -p envvars-std $(DESTDIR)$(sbindir); \
132 if test ! -f $(DESTDIR)$(sbindir)/envvars; then \
133 cp -p envvars-std $(DESTDIR)$(sbindir)/envvars ; \
137 # Create a sanitized config_vars.mk
138 build/config_vars.out: build/config_vars.mk build/config_vars.sh
139 @$(SHELL) build/config_vars.sh < build/config_vars.mk > build/config_vars.out
141 install-build: build/config_vars.out
142 @echo Installing build system files
143 @$(MKINSTALLDIRS) $(DESTDIR)$(installbuilddir)
144 @$(INSTALL_DATA) $(top_srcdir)/build/*.mk build/*.mk \
145 $(DESTDIR)$(installbuilddir)
146 @$(INSTALL_PROGRAM) $(top_builddir)/config.nice \
147 $(top_srcdir)/build/mkdir.sh \
148 $(top_srcdir)/build/instdso.sh \
149 $(DESTDIR)$(installbuilddir)
150 @$(INSTALL_DATA) build/config_vars.out $(DESTDIR)$(installbuilddir)/config_vars.mk
151 @rm build/config_vars.out
153 htdocs-srcdir = $(top_srcdir)/docs/docroot
156 @if test -d $(top_srcdir)/docs/manual/build; then \
157 cd $(top_srcdir)/docs/manual/build && ./build.sh all; \
159 echo 'For details on generating the docs, please read:'; \
160 echo ' http://httpd.apache.org/docs-project/docsformat.html'; \
164 @if test -d $(top_srcdir)/docs/manual/build; then \
165 cd $(top_srcdir)/docs/manual/build && ./build.sh validate-xml; \
167 echo 'For details on generating the docs, please read:'; \
168 echo ' http://httpd.apache.org/docs-project/docsformat.html'; \
172 doxygen $(top_srcdir)/docs/doxygen.conf
175 -@if [ -d $(DESTDIR)$(htdocsdir) ]; then \
176 echo "[PRESERVING EXISTING HTDOCS SUBDIR: $(DESTDIR)$(htdocsdir)]"; \
178 echo Installing HTML documents ; \
179 $(MKINSTALLDIRS) $(DESTDIR)$(htdocsdir) ; \
180 if test -d $(htdocs-srcdir) && test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
181 $(RSYNC) --exclude .svn -rlpt --numeric-ids $(htdocs-srcdir)/ $(DESTDIR)$(htdocsdir)/; \
183 test -d $(htdocs-srcdir) && (cd $(htdocs-srcdir) && cp -rp * $(DESTDIR)$(htdocsdir)) ; \
184 cd $(DESTDIR)$(htdocsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
189 -@if [ -d $(DESTDIR)$(errordir) ]; then \
190 echo "[PRESERVING EXISTING ERROR SUBDIR: $(DESTDIR)$(errordir)]"; \
192 echo Installing error documents ; \
193 $(MKINSTALLDIRS) $(DESTDIR)$(errordir) ; \
194 cd $(top_srcdir)/docs/error && cp -rp * $(DESTDIR)$(errordir) ; \
195 test "x$(errordir)" != "x" && cd $(DESTDIR)$(errordir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
199 -@if [ -d $(DESTDIR)$(iconsdir) ]; then \
200 echo "[PRESERVING EXISTING ICONS SUBDIR: $(DESTDIR)$(iconsdir)]"; \
202 echo Installing icons ; \
203 $(MKINSTALLDIRS) $(DESTDIR)$(iconsdir) ; \
204 cd $(top_srcdir)/docs/icons && cp -rp * $(DESTDIR)$(iconsdir) ; \
205 test "x$(iconsdir)" != "x" && cd $(DESTDIR)$(iconsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
209 -@if [ -d $(DESTDIR)$(cgidir) ];then \
210 echo "[PRESERVING EXISTING CGI SUBDIR: $(DESTDIR)$(cgidir)]"; \
212 echo Installing CGIs ; \
213 $(MKINSTALLDIRS) $(DESTDIR)$(cgidir) ; \
214 cd $(top_srcdir)/docs/cgi-examples && cp -rp * $(DESTDIR)$(cgidir) ; \
215 test "x$(cgidir)" != "x" && cd $(DESTDIR)$(cgidir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
219 @test -d $(DESTDIR)$(logfiledir) || $(MKINSTALLDIRS) $(DESTDIR)$(logfiledir)
220 @test -d $(DESTDIR)$(runtimedir) || $(MKINSTALLDIRS) $(DESTDIR)$(runtimedir)
221 @for ext in dll x; do \
222 file=apachecore.$$ext; \
223 if test -f $$file; then \
224 cp -p $$file $(DESTDIR)$(libdir); \
228 if test -f $$file; then \
229 cp -p $$file $(DESTDIR)$(bindir); \
234 $(srcdir)/include/*.h \
235 $(srcdir)/os/$(OS_DIR)/os.h \
236 $(srcdir)/modules/arch/unix/mod_unixd.h \
237 $(srcdir)/modules/core/mod_so.h \
238 $(srcdir)/modules/core/mod_watchdog.h \
239 $(srcdir)/modules/cache/mod_cache.h \
240 $(srcdir)/modules/cache/cache_common.h \
241 $(srcdir)/modules/database/mod_dbd.h \
242 $(srcdir)/modules/dav/main/mod_dav.h \
243 $(srcdir)/modules/http2/mod_http2.h \
244 $(srcdir)/modules/filters/mod_include.h \
245 $(srcdir)/modules/filters/mod_xml2enc.h \
246 $(srcdir)/modules/generators/mod_cgi.h \
247 $(srcdir)/modules/generators/mod_status.h \
248 $(srcdir)/modules/loggers/mod_log_config.h \
249 $(srcdir)/modules/mappers/mod_rewrite.h \
250 $(srcdir)/modules/proxy/mod_proxy.h \
251 $(srcdir)/modules/proxy/mod_serf.h \
252 $(srcdir)/modules/session/mod_session.h \
253 $(srcdir)/modules/ssl/mod_ssl.h \
254 $(srcdir)/modules/ssl/mod_ssl_openssl.h \
255 $(srcdir)/os/$(OS_DIR)/*.h
258 @echo Installing header files
259 @$(MKINSTALLDIRS) $(DESTDIR)$(includedir)
260 @$(INSTALL_DATA) $(INSTALL_HEADERS) $(DESTDIR)$(includedir)
263 @echo Installing man pages and online manual
264 @test -d $(DESTDIR)$(mandir) || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)
265 @test -d $(DESTDIR)$(mandir)/man1 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man1
266 @test -d $(DESTDIR)$(mandir)/man8 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man8
267 @test -d $(DESTDIR)$(manualdir) || $(MKINSTALLDIRS) $(DESTDIR)$(manualdir)
268 @cp -p $(top_srcdir)/docs/man/*.1 $(DESTDIR)$(mandir)/man1
269 @cp -p $(top_srcdir)/docs/man/*.8 $(DESTDIR)$(mandir)/man8
270 @if test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
271 $(RSYNC) --exclude .svn -rlpt --numeric-ids $(top_srcdir)/docs/manual/ $(DESTDIR)$(manualdir)/; \
273 cd $(top_srcdir)/docs/manual && cp -rp * $(DESTDIR)$(manualdir); \
274 cd $(DESTDIR)$(manualdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
277 install-suexec: install-suexec-$(INSTALL_SUEXEC)
279 install-suexec-binary:
280 @if test -f $(builddir)/support/suexec; then \
281 test -d $(DESTDIR)$(sbindir) || $(MKINSTALLDIRS) $(DESTDIR)$(sbindir); \
282 $(INSTALL_PROGRAM) $(top_builddir)/support/suexec $(DESTDIR)$(sbindir); \
285 install-suexec-setuid: install-suexec-binary
286 @if test -f $(builddir)/support/suexec; then \
287 chmod 4755 $(DESTDIR)$(sbindir)/suexec; \
290 install-suexec-caps: install-suexec-binary
291 @if test -f $(builddir)/support/suexec; then \
292 setcap 'cap_setuid,cap_setgid+pe' $(DESTDIR)$(sbindir)/suexec; \
296 cd support && $(MAKE) suexec
299 @rm -rf autom4te.cache
301 update-log-tags update-log-msg-tags:
302 find server modules os -name \*.c|xargs perl \
303 docs/log-message-tags/update-log-msg-tags
305 # XXX: This looks awfully platform-specific [read: bad form and style]
306 include $(top_srcdir)/os/os2/core.mk
312 # Installs the include/ header files into the ./check/ directory so we can use
313 # them during `make check`.
314 check-include: override includedir:=$(top_builddir)/check/include
315 check-include: install-include
317 # This is basically the same as install-conf, but we only care about the files
318 # necessary to run the test suite, and the LoadModule lines point back to the
319 # build tree. Configuration files will be installed to ./check/conf and pointed
320 # to by ./check/apxs.
322 @mkdir -p check/conf/extra; \
323 cd $(top_srcdir)/docs/conf; \
324 for i in mime.types magic; do \
325 $(INSTALL_DATA) $$i $(top_builddir)/check/conf; \
327 for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
329 for i in httpd.conf extra/*.conf; do \
330 if [ -f $$i ] ; then \
332 n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
333 if test $$n_lm -eq 0 -o "x$(MPM_MODULES)$(DSO_MODULES)" = "x"; then \
334 sed -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
335 -e 's#@@Port@@#$(PORT)#g' \
336 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
337 -e 's#$(prefix)#$(top_builddir)/check#g' \
338 -e 's/^#ServerName /ServerName /' \
339 -e '/@@LoadModule@@/d' \
342 sed -n -e '/@@LoadModule@@/q' \
343 -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
344 -e 's#@@Port@@#$(PORT)#g' \
345 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
346 -e 's#$(prefix)#$(top_builddir)/check#g' \
347 -e 's/^#ServerName /ServerName /' \
350 if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
355 if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
360 for j in $(MPM_MODULES) "^EOL^"; do \
361 path=$$(find "$(top_builddir)/server" -name "mod_$$j.so"); \
362 if test $$j != "^EOL^"; then \
363 if echo ",$(ENABLED_MPM_MODULE),"|$(EGREP) ",$$j," > /dev/null ; then \
364 loading_disabled=""; \
366 loading_disabled="#"; \
368 echo "$${loading_disabled}LoadModule $${j}_module $${path}"; \
371 for j in $(DSO_MODULES) "^EOL^"; do \
372 path=$$(find "$(top_builddir)/modules" -name "mod_$$j.so"); \
373 if test $$j != "^EOL^"; then \
374 if test $$j = "cgid" -a "$$have_cgi" = "1"; then \
375 echo "<IfModule !mpm_prefork_module>"; \
376 echo " LoadModule $${j}_module $${path}"; \
377 echo "</IfModule>"; \
378 elif test $$j = "cgi" -a "$$have_cgid" = "1"; then \
379 echo "<IfModule mpm_prefork_module>"; \
380 echo " LoadModule $${j}_module $${path}"; \
381 echo "</IfModule>"; \
383 echo "LoadModule $${j}_module $${path}"; \
387 sed -e '1,/@@LoadModule@@/d' \
388 -e '/@@LoadModule@@/d' \
389 -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
390 -e 's#@@Port@@#$(PORT)#g' \
391 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
392 -e 's#$(prefix)#$(top_builddir)/check#g' \
393 -e 's/^#ServerName /ServerName /' \
396 ) > $(top_builddir)/check/conf/$$i; \
397 chmod 0644 $(top_builddir)/check/conf/$$i; \
398 if [ "$$i" = "httpd.conf" ]; then \
399 mv "$(top_builddir)/check/conf/$$i" "$(top_builddir)/check/conf/$(PROGRAM_NAME).conf"; \
405 # Sometimes (e.g. when MPM DSOs are enabled) the test suite runs a full
406 # configuration check on our in-tree build. To pass, we have to have all of the
407 # correct directories, even though they won't be used.
409 @mkdir -p check/htdocs check/logs check/bin
411 check-binaries: check/bin/apxs check/bin/httpd check/bin/ab
414 ln -s $(top_builddir)/httpd check/bin/httpd
417 ln -s $(top_builddir)/support/ab check/bin/ab
419 # A version of apxs with the PREFIX overridden to point inside the install root
422 sed -e 's#$(prefix)#$(top_builddir)/check#g' support/apxs > $@
425 # A version of config_vars.mk with PREFIX and SBINDIR and BINDIR overridden.
426 check/build/config_vars.mk: build/config_vars.out
429 echo "prefix = $(top_builddir)/check" >> $@
430 echo "sbindir = $(top_builddir)/check/bin" >> $@
431 echo "bindir = $(top_builddir)/check/bin" >> $@
433 # Generate config & modules etc from scratch any time a header file is
434 # touched, so e.g. we don't get MMN mismatch against the modules built
436 $(TEST_SUITE_LOCATION)/Makefile: $(TEST_SUITE_LOCATION)/Makefile.PL $(INSTALL_HEADERS)
437 cd "$(TEST_SUITE_LOCATION)" && \
438 perl Makefile.PL -apxs "$(top_builddir)/check/bin/apxs" && \
442 check-make: $(TEST_SUITE_LOCATION)/Makefile
445 @echo 'Re-run configure with the --with-test-suite option to enable in-tree tests.'
448 check-yes: check-include check-dirs check-conf check/build/config_vars.mk \
449 check-binaries $(TEST_SUITE_LOCATION)/Makefile
450 cd $(TEST_SUITE_LOCATION) && ./t/TEST $(TESTS)
452 # Run the Apache::Test suite if it has been configured with --with-test-suite.
453 check: check-$(WITH_TEST_SUITE)
459 # Make sure the object subdirectories we use exist in the build directory during
464 # Normally I don't like wildcard sources, but for tests, autodiscovery is the
466 testcase_SOURCES := $(patsubst $(top_srcdir)/%,%,$(wildcard $(top_srcdir)/test/unit/*.c))
467 testcase_OBJECTS := $(testcase_SOURCES:%.c=%.lo)
468 testcase_STUBS := $(testcase_SOURCES:%.c=%.tests)
470 # Each testcase depends on the source file as well as the autogenerated .tests
472 $(testcase_OBJECTS): %.lo: %.c %.tests | unittest-objdir
474 $(testcase_STUBS): %.tests: %.c
475 $(top_srcdir)/build/httpdunit_gen_stubs.pl < "$<" > "$@"
477 test/httpdunit.cases: $(testcase_SOURCES) | unittest-objdir
478 cat $^ | $(top_srcdir)/build/httpdunit_gen_cases.pl --declaration > $@
479 cat $^ | $(top_srcdir)/build/httpdunit_gen_cases.pl >> $@
481 test/httpdunit.lo: test/httpdunit.c test/httpdunit.cases | unittest-objdir
483 # httpdunit is only added to $(other_targets) if configure detects a working
484 # libcheck on the system.
485 httpdunit_OBJECTS := test/httpdunit.lo $(testcase_OBJECTS)
486 $(httpdunit_OBJECTS): override LTCFLAGS += $(UNITTEST_CFLAGS)
487 test/httpdunit: $(httpdunit_OBJECTS) $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS)
488 $(LINK) $(httpdunit_OBJECTS) $(PROGRAM_OBJECTS) $(UNITTEST_LIBS) $(PROGRAM_LDADD)