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/apxs 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
34 include $(top_builddir)/build/rules.mk
35 include $(top_srcdir)/build/program.mk
38 @echo Installing configuration files
39 @$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir) $(DESTDIR)$(sysconfdir)/extra
40 @$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir)/original/extra
41 @cd $(top_srcdir)/docs/conf; \
42 for i in mime.types magic; do \
43 if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \
44 $(INSTALL_DATA) $$i $(DESTDIR)$(sysconfdir); \
47 for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
49 for i in httpd.conf extra/*.conf; do \
50 if [ -f $$i ] ; then \
52 n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
53 if test $$n_lm -eq 0 -o "x$(MPM_MODULE)$(DSO_MODULES)" = "x"; then \
54 sed -e 's#@@ServerRoot@@#$(prefix)#g' \
55 -e 's#@@Port@@#$(PORT)#g' \
56 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
57 -e '/@@LoadModule@@/d' \
60 sed -n -e '/@@LoadModule@@/q' \
61 -e 's#@@ServerRoot@@#$(prefix)#g' \
62 -e 's#@@Port@@#$(PORT)#g' \
63 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
66 if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
71 if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
76 for j in $(MPM_MODULES) "^EOL^"; do \
77 if test $$j != "^EOL^"; then \
78 if echo ",$(ENABLED_MPM_MODULE),"|$(EGREP) ",$$j," > /dev/null ; then \
79 loading_disabled=""; \
81 loading_disabled="#"; \
83 echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
86 for j in $(DSO_MODULES) "^EOL^"; do \
87 if test $$j != "^EOL^"; then \
88 if echo ",$(ENABLED_DSO_MODULES),"|$(EGREP) ",$$j," > /dev/null ; then \
89 loading_disabled=""; \
91 loading_disabled="#"; \
92 if test "$(LOAD_ALL_MODULES)" = "yes"; then \
93 loading_disabled=""; \
96 if test $$j = "cgid" -a "$$have_cgi" = "1"; then \
97 echo "<IfModule !mpm_prefork_module>"; \
98 echo " $${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
100 elif test $$j = "cgi" -a "$$have_cgid" = "1"; then \
101 echo "<IfModule mpm_prefork_module>"; \
102 echo " $${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
103 echo "</IfModule>"; \
105 echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
109 sed -e '1,/@@LoadModule@@/d' \
110 -e '/@@LoadModule@@/d' \
111 -e 's#@@ServerRoot@@#$(prefix)#g' \
112 -e 's#@@Port@@#$(PORT)#g' \
113 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
116 ) > $(DESTDIR)$(sysconfdir)/original/$$i; \
117 chmod 0644 $(DESTDIR)$(sysconfdir)/original/$$i; \
119 if [ "$$i" = "httpd.conf" ]; then \
120 file=`echo $$i|sed s/.*.conf/$(PROGRAM_NAME).conf/`; \
122 if test ! -f $(DESTDIR)$(sysconfdir)/$$file; then \
123 $(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/original/$$i $(DESTDIR)$(sysconfdir)/$$file; \
128 if test -f "$(builddir)/envvars-std"; then \
129 cp -p envvars-std $(DESTDIR)$(sbindir); \
130 if test ! -f $(DESTDIR)$(sbindir)/envvars; then \
131 cp -p envvars-std $(DESTDIR)$(sbindir)/envvars ; \
135 # Create a sanitized config_vars.mk
136 build/config_vars.out: build/config_vars.mk
137 @$(SHELL) build/config_vars.sh < build/config_vars.mk > build/config_vars.out
139 install-build: build/config_vars.out
140 @echo Installing build system files
141 @$(MKINSTALLDIRS) $(DESTDIR)$(installbuilddir)
142 @$(INSTALL_DATA) $(top_srcdir)/build/*.mk build/*.mk \
143 $(DESTDIR)$(installbuilddir)
144 @$(INSTALL_PROGRAM) $(top_builddir)/config.nice \
145 $(top_srcdir)/build/mkdir.sh \
146 $(top_srcdir)/build/instdso.sh \
147 $(DESTDIR)$(installbuilddir)
148 @$(INSTALL_DATA) build/config_vars.out $(DESTDIR)$(installbuilddir)/config_vars.mk
149 @rm build/config_vars.out
151 htdocs-srcdir = $(top_srcdir)/docs/docroot
154 @if test -d $(top_srcdir)/docs/manual/build; then \
155 cd $(top_srcdir)/docs/manual/build && ./build.sh all; \
157 echo 'For details on generating the docs, please read:'; \
158 echo ' http://httpd.apache.org/docs-project/docsformat.html'; \
162 @if test -d $(top_srcdir)/docs/manual/build; then \
163 cd $(top_srcdir)/docs/manual/build && ./build.sh validate-xml; \
165 echo 'For details on generating the docs, please read:'; \
166 echo ' http://httpd.apache.org/docs-project/docsformat.html'; \
170 doxygen $(top_srcdir)/docs/doxygen.conf
173 -@if [ -d $(DESTDIR)$(htdocsdir) ]; then \
174 echo "[PRESERVING EXISTING HTDOCS SUBDIR: $(DESTDIR)$(htdocsdir)]"; \
176 echo Installing HTML documents ; \
177 $(MKINSTALLDIRS) $(DESTDIR)$(htdocsdir) ; \
178 if test -d $(htdocs-srcdir) && test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
179 $(RSYNC) --exclude .svn -rlpt --numeric-ids $(htdocs-srcdir)/ $(DESTDIR)$(htdocsdir)/; \
181 test -d $(htdocs-srcdir) && (cd $(htdocs-srcdir) && cp -rp * $(DESTDIR)$(htdocsdir)) ; \
182 cd $(DESTDIR)$(htdocsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
187 -@if [ -d $(DESTDIR)$(errordir) ]; then \
188 echo "[PRESERVING EXISTING ERROR SUBDIR: $(DESTDIR)$(errordir)]"; \
190 echo Installing error documents ; \
191 $(MKINSTALLDIRS) $(DESTDIR)$(errordir) ; \
192 cd $(top_srcdir)/docs/error && cp -rp * $(DESTDIR)$(errordir) ; \
193 test "x$(errordir)" != "x" && cd $(DESTDIR)$(errordir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
197 -@if [ -d $(DESTDIR)$(iconsdir) ]; then \
198 echo "[PRESERVING EXISTING ICONS SUBDIR: $(DESTDIR)$(iconsdir)]"; \
200 echo Installing icons ; \
201 $(MKINSTALLDIRS) $(DESTDIR)$(iconsdir) ; \
202 cd $(top_srcdir)/docs/icons && cp -rp * $(DESTDIR)$(iconsdir) ; \
203 test "x$(iconsdir)" != "x" && cd $(DESTDIR)$(iconsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
207 -@if [ -d $(DESTDIR)$(cgidir) ];then \
208 echo "[PRESERVING EXISTING CGI SUBDIR: $(DESTDIR)$(cgidir)]"; \
210 echo Installing CGIs ; \
211 $(MKINSTALLDIRS) $(DESTDIR)$(cgidir) ; \
212 cd $(top_srcdir)/docs/cgi-examples && cp -rp * $(DESTDIR)$(cgidir) ; \
213 test "x$(cgidir)" != "x" && cd $(DESTDIR)$(cgidir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
217 @test -d $(DESTDIR)$(logfiledir) || $(MKINSTALLDIRS) $(DESTDIR)$(logfiledir)
218 @test -d $(DESTDIR)$(runtimedir) || $(MKINSTALLDIRS) $(DESTDIR)$(runtimedir)
219 @for ext in dll x; do \
220 file=apachecore.$$ext; \
221 if test -f $$file; then \
222 cp -p $$file $(DESTDIR)$(libdir); \
226 if test -f $$file; then \
227 cp -p $$file $(DESTDIR)$(bindir); \
232 $(srcdir)/include/*.h \
233 $(srcdir)/os/$(OS_DIR)/os.h \
234 $(srcdir)/modules/arch/unix/mod_unixd.h \
235 $(srcdir)/modules/core/mod_so.h \
236 $(srcdir)/modules/core/mod_watchdog.h \
237 $(srcdir)/modules/cache/mod_cache.h \
238 $(srcdir)/modules/cache/cache_common.h \
239 $(srcdir)/modules/database/mod_dbd.h \
240 $(srcdir)/modules/dav/main/mod_dav.h \
241 $(srcdir)/modules/http2/mod_http2.h \
242 $(srcdir)/modules/filters/mod_include.h \
243 $(srcdir)/modules/filters/mod_xml2enc.h \
244 $(srcdir)/modules/generators/mod_cgi.h \
245 $(srcdir)/modules/generators/mod_status.h \
246 $(srcdir)/modules/loggers/mod_log_config.h \
247 $(srcdir)/modules/mappers/mod_rewrite.h \
248 $(srcdir)/modules/proxy/mod_proxy.h \
249 $(srcdir)/modules/proxy/mod_serf.h \
250 $(srcdir)/modules/session/mod_session.h \
251 $(srcdir)/modules/ssl/mod_ssl.h \
252 $(srcdir)/modules/ssl/mod_ssl_openssl.h \
253 $(srcdir)/os/$(OS_DIR)/*.h
256 @echo Installing header files
257 @$(MKINSTALLDIRS) $(DESTDIR)$(includedir)
258 @$(INSTALL_DATA) $(INSTALL_HEADERS) $(DESTDIR)$(includedir)
261 @echo Installing man pages and online manual
262 @test -d $(DESTDIR)$(mandir) || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)
263 @test -d $(DESTDIR)$(mandir)/man1 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man1
264 @test -d $(DESTDIR)$(mandir)/man8 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man8
265 @test -d $(DESTDIR)$(manualdir) || $(MKINSTALLDIRS) $(DESTDIR)$(manualdir)
266 @cp -p $(top_srcdir)/docs/man/*.1 $(DESTDIR)$(mandir)/man1
267 @cp -p $(top_srcdir)/docs/man/*.8 $(DESTDIR)$(mandir)/man8
268 @if test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
269 $(RSYNC) --exclude .svn -rlpt --numeric-ids $(top_srcdir)/docs/manual/ $(DESTDIR)$(manualdir)/; \
271 cd $(top_srcdir)/docs/manual && cp -rp * $(DESTDIR)$(manualdir); \
272 cd $(DESTDIR)$(manualdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
275 install-suexec: install-suexec-binary install-suexec-$(INSTALL_SUEXEC)
277 install-suexec-binary:
278 @if test -f $(builddir)/support/suexec; then \
279 test -d $(DESTDIR)$(sbindir) || $(MKINSTALLDIRS) $(DESTDIR)$(sbindir); \
280 $(INSTALL_PROGRAM) $(top_builddir)/support/suexec $(DESTDIR)$(sbindir); \
283 install-suexec-setuid:
284 @if test -f $(builddir)/support/suexec; then \
285 chmod 4755 $(DESTDIR)$(sbindir)/suexec; \
289 @if test -f $(builddir)/support/suexec; then \
290 setcap 'cap_setuid,cap_setgid+pe' $(DESTDIR)$(sbindir)/suexec; \
294 cd support && $(MAKE) suexec
297 @rm -rf autom4te.cache
299 update-log-tags update-log-msg-tags:
300 find server modules os -name \*.c|xargs perl \
301 docs/log-message-tags/update-log-msg-tags
303 # XXX: This looks awfully platform-specific [read: bad form and style]
304 include $(top_srcdir)/os/os2/core.mk
310 # Installs the include/ header files into the ./check/ directory so we can use
311 # them during `make check`.
312 check-include: override includedir:=$(top_builddir)/check/include
313 check-include: install-include
315 # This is basically the same as install-conf, but we only care about the files
316 # necessary to run the test suite, and the LoadModule lines point back to the
317 # build tree. Configuration files will be installed to ./check/conf and pointed
318 # to by ./check/apxs.
320 @mkdir -p check/conf/extra; \
321 cd $(top_srcdir)/docs/conf; \
322 for i in mime.types magic; do \
323 $(INSTALL_DATA) $$i $(top_builddir)/check/conf; \
325 for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
327 for i in httpd.conf extra/*.conf; do \
328 if [ -f $$i ] ; then \
330 n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
331 if test $$n_lm -eq 0 -o "x$(MPM_MODULE)$(DSO_MODULES)" = "x"; then \
332 sed -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
333 -e 's#@@Port@@#$(PORT)#g' \
334 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
335 -e 's#$(prefix)#$(top_builddir)/check#g' \
336 -e 's/^#ServerName /ServerName /' \
337 -e '/@@LoadModule@@/d' \
340 sed -n -e '/@@LoadModule@@/q' \
341 -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
342 -e 's#@@Port@@#$(PORT)#g' \
343 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
344 -e 's#$(prefix)#$(top_builddir)/check#g' \
345 -e 's/^#ServerName /ServerName /' \
348 if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
353 if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
358 for j in $(MPM_MODULES) "^EOL^"; do \
359 path=$$(find "$(top_builddir)/server" -name "mod_$$j.so"); \
360 if test $$j != "^EOL^"; then \
361 if echo ",$(ENABLED_MPM_MODULE),"|$(EGREP) ",$$j," > /dev/null ; then \
362 loading_disabled=""; \
364 loading_disabled="#"; \
366 echo "$${loading_disabled}LoadModule $${j}_module $${path}"; \
369 for j in $(DSO_MODULES) "^EOL^"; do \
370 path=$$(find "$(top_builddir)/modules" -name "mod_$$j.so"); \
371 if test $$j != "^EOL^"; then \
372 if test $$j = "cgid" -a "$$have_cgi" = "1"; then \
373 echo "<IfModule !mpm_prefork_module>"; \
374 echo " LoadModule $${j}_module $${path}"; \
375 echo "</IfModule>"; \
376 elif test $$j = "cgi" -a "$$have_cgid" = "1"; then \
377 echo "<IfModule mpm_prefork_module>"; \
378 echo " LoadModule $${j}_module $${path}"; \
379 echo "</IfModule>"; \
381 echo "LoadModule $${j}_module $${path}"; \
385 sed -e '1,/@@LoadModule@@/d' \
386 -e '/@@LoadModule@@/d' \
387 -e 's#@@ServerRoot@@#$(top_builddir)/check#g' \
388 -e 's#@@Port@@#$(PORT)#g' \
389 -e 's#@@SSLPort@@#$(SSLPORT)#g' \
390 -e 's#$(prefix)#$(top_builddir)/check#g' \
391 -e 's/^#ServerName /ServerName /' \
394 ) > $(top_builddir)/check/conf/$$i; \
395 chmod 0644 $(top_builddir)/check/conf/$$i; \
396 if [ "$$i" = "httpd.conf" ]; then \
397 mv "$(top_builddir)/check/conf/$$i" "$(top_builddir)/check/conf/$(PROGRAM_NAME).conf"; \
403 # Sometimes (e.g. when MPM DSOs are enabled) the test suite runs a full
404 # configuration check on our in-tree build. To pass, we have to have all of the
405 # correct directories, even though they won't be used.
407 @mkdir -p check/htdocs
410 # A version of apxs with the PREFIX overridden to point inside the build tree.
413 sed -e 's#$(prefix)#$(top_builddir)/check#g' support/apxs > $@
416 # A version of config_vars.mk with the PREFIX and SBINDIR overridden to point
417 # inside the build tree.
418 check/build/config_vars.mk: build/config_vars.out
421 echo "prefix = $(top_builddir)/check" >> $@
422 echo "sbindir = $(top_builddir)" >> $@
424 # Run the Apache::Test suite if it has been configured with --with-test-suite.
425 check: check-include check-dirs check-conf check/build/config_vars.mk check/apxs
426 @if test "x$(TEST_SUITE_LOCATION)" = "xno"; then \
427 echo 'Re-run configure with the --with-test-suite option to enable in-tree tests.'; \
430 cd "$(TEST_SUITE_LOCATION)" && \
431 perl Makefile.PL -apxs "$(top_builddir)/check/apxs" && \
433 ./t/TEST -config && \
440 # Make sure the object subdirectories we use exist in the build directory during
445 # Normally I don't like wildcard sources, but for tests, autodiscovery is the
447 testcase_SOURCES := $(patsubst $(top_srcdir)/%,%,$(wildcard $(top_srcdir)/test/unit/*.c))
448 testcase_OBJECTS := $(testcase_SOURCES:%.c=%.lo)
449 testcase_STUBS := $(testcase_SOURCES:%.c=%.tests)
451 # Each testcase depends on the source file as well as the autogenerated .tests
453 $(testcase_OBJECTS): %.lo: %.c %.tests | unittest-objdir
455 $(testcase_STUBS): %.tests: %.c
456 $(top_srcdir)/build/httpdunit_gen_stubs.pl < "$<" > "$@"
458 test/httpdunit.cases: $(testcase_SOURCES) | unittest-objdir
459 cat $^ | $(top_srcdir)/build/httpdunit_gen_cases.pl --declaration > $@
460 cat $^ | $(top_srcdir)/build/httpdunit_gen_cases.pl >> $@
462 test/httpdunit.lo: test/httpdunit.c test/httpdunit.cases | unittest-objdir
464 # httpdunit is only added to $(other_targets) if configure detects a working
465 # libcheck on the system.
466 httpdunit_OBJECTS := test/httpdunit.lo $(testcase_OBJECTS)
467 $(httpdunit_OBJECTS): override LTCFLAGS += $(UNITTEST_CFLAGS)
468 test/httpdunit: $(httpdunit_OBJECTS) $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS)
469 $(LINK) $(httpdunit_OBJECTS) $(PROGRAM_OBJECTS) $(UNITTEST_LIBS) $(PROGRAM_LDADD)