]> granicus.if.org Git - apache/blob - Makefile.in
* Make it obsolete to supply a starting pool
[apache] / Makefile.in
1
2 SUBDIRS = srclib os server modules support
3 CLEAN_SUBDIRS = test
4
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
9 PROGRAM_LDDEPS = \
10   $(BUILTIN_LIBS) \
11   $(MPM_LIB) \
12   $(LIBMAIN_LIB) \
13   os/$(OS_DIR)/libos.la
14 PROGRAM_DEPENDENCIES = \
15   $(BUILTIN_LIBS) \
16   $(MPM_LIB) \
17   server/libmain.la \
18   os/$(OS_DIR)/libos.la
19
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 \
24         install-man
25
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 \
36         httpd.spec
37 PHONY_TARGETS := check check-conf check-dirs check-include unittest-objdir
38
39 TESTS = 
40
41 include $(top_builddir)/build/rules.mk
42 include $(top_srcdir)/build/program.mk
43
44 install-conf:
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); \
52             fi; \
53         done; \
54         for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
55             cd $$j ; \
56             for i in httpd.conf extra/*.conf; do \
57                 if [ -f $$i ] ; then \
58                 ( \
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' \
65                                         < $$i; \
66                         else \
67                                 sed -n -e '/@@LoadModule@@/q' \
68                                         -e 's#@@ServerRoot@@#$(prefix)#g' \
69                                         -e 's#@@Port@@#$(PORT)#g' \
70                                         -e 's#@@SSLPort@@#$(SSLPORT)#g' \
71                                         -e 'p' \
72                                         < $$i; \
73                                 if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
74                                         have_cgi="1"; \
75                                 else \
76                                         have_cgi="0"; \
77                                 fi; \
78                                 if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
79                                         have_cgid="1"; \
80                                 else \
81                                         have_cgid="0"; \
82                                 fi; \
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=""; \
87                                                 else \
88                                                         loading_disabled="#"; \
89                                                 fi; \
90                                                 echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
91                                         fi; \
92                                 done; \
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=""; \
97                                                 else \
98                                                         loading_disabled="#"; \
99                                                         if test "$(LOAD_ALL_MODULES)" = "yes"; then \
100                                                                 loading_disabled=""; \
101                                                         fi; \
102                                                 fi; \
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>"; \
111                                                 else \
112                                                         echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
113                                                 fi; \
114                                         fi; \
115                                 done; \
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' \
121                                         < $$i; \
122                         fi \
123                 ) > $(DESTDIR)$(sysconfdir)/original/$$i; \
124                 chmod 0644 $(DESTDIR)$(sysconfdir)/original/$$i; \
125                 file=$$i; \
126                 if [ "$$i" = "httpd.conf" ]; then \
127                         file=`echo $$i|sed s/.*.conf/$(PROGRAM_NAME).conf/`; \
128                 fi; \
129                 if test ! -f $(DESTDIR)$(sysconfdir)/$$file; then \
130                         $(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/original/$$i $(DESTDIR)$(sysconfdir)/$$file; \
131                 fi; \
132                 fi; \
133             done ; \
134         done ; \
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 ; \
139             fi ; \
140         fi
141
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
145
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
157
158 htdocs-srcdir = $(top_srcdir)/docs/docroot
159
160 docs:
161         @if test -d $(top_srcdir)/docs/manual/build; then \
162             cd $(top_srcdir)/docs/manual/build && ./build.sh all; \
163         else \
164             echo 'For details on generating the docs, please read:'; \
165             echo '  http://httpd.apache.org/docs-project/docsformat.html'; \
166         fi
167
168 validate-xml:
169         @if test -d $(top_srcdir)/docs/manual/build; then \
170             cd $(top_srcdir)/docs/manual/build && ./build.sh validate-xml; \
171         else \
172             echo 'For details on generating the docs, please read:'; \
173             echo '  http://httpd.apache.org/docs-project/docsformat.html'; \
174         fi
175
176 dox:
177         doxygen $(top_srcdir)/docs/doxygen.conf
178
179 install-htdocs:
180         -@if [ -d $(DESTDIR)$(htdocsdir) ]; then \
181            echo "[PRESERVING EXISTING HTDOCS SUBDIR: $(DESTDIR)$(htdocsdir)]"; \
182         else \
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)/; \
187             else \
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; \
190             fi; \
191         fi
192
193 install-error:
194         -@if [ -d $(DESTDIR)$(errordir) ]; then \
195            echo "[PRESERVING EXISTING ERROR SUBDIR: $(DESTDIR)$(errordir)]"; \
196         else \
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; \
201         fi
202
203 install-icons:
204         -@if [ -d $(DESTDIR)$(iconsdir) ]; then \
205            echo "[PRESERVING EXISTING ICONS SUBDIR: $(DESTDIR)$(iconsdir)]"; \
206         else \
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; \
211         fi
212
213 install-cgi:
214         -@if [ -d $(DESTDIR)$(cgidir) ];then \
215             echo "[PRESERVING EXISTING CGI SUBDIR: $(DESTDIR)$(cgidir)]"; \
216         else \
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; \
221         fi
222
223 install-other:
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); \
231                 fi; \
232         done; \
233         file=httpd.dll; \
234         if test -f $$file; then \
235                 cp -p $$file $(DESTDIR)$(bindir); \
236         fi;
237
238 INSTALL_HEADERS = \
239         include/*.h \
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
262
263 install-include:
264         @echo Installing header files
265         @$(MKINSTALLDIRS) $(DESTDIR)$(includedir)
266         @$(INSTALL_DATA) $(INSTALL_HEADERS) $(DESTDIR)$(includedir)
267
268 install-man:
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)/; \
278         else \
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; \
281         fi
282
283 install-suexec: install-suexec-$(INSTALL_SUEXEC)
284
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); \
289         fi
290
291 install-suexec-setuid: install-suexec-binary
292         @if test -f $(builddir)/support/suexec; then \
293             chmod 4755 $(DESTDIR)$(sbindir)/suexec; \
294         fi
295
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; \
299         fi
300
301 suexec:
302         cd support && $(MAKE) suexec
303
304 x-local-distclean:
305         @rm -rf autom4te.cache
306
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
310
311 # XXX: This looks awfully platform-specific [read: bad form and style]
312 include $(top_srcdir)/os/os2/core.mk
313
314 #
315 # In-tree Testing
316 #
317
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
322
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.
327 check-conf:
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; \
332         done; \
333         for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
334             cd $$j ; \
335             for i in httpd.conf extra/*.conf; do \
336                 if [ -f $$i ] ; then \
337                 ( \
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' \
346                             < $$i; \
347                     else \
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 /' \
354                             -e 'p' \
355                             < $$i; \
356                         if echo " $(DSO_MODULES) "|$(EGREP) " cgi " > /dev/null ; then \
357                             have_cgi="1"; \
358                         else \
359                             have_cgi="0"; \
360                         fi; \
361                         if echo " $(DSO_MODULES) "|$(EGREP) " cgid " > /dev/null ; then \
362                             have_cgid="1"; \
363                         else \
364                             have_cgid="0"; \
365                         fi; \
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=""; \
371                                 else \
372                                     loading_disabled="#"; \
373                                 fi; \
374                             echo "$${loading_disabled}LoadModule $${j}_module $${path}"; \
375                         fi; \
376                         done; \
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>"; \
388                                 else \
389                                     echo "LoadModule $${j}_module $${path}"; \
390                                 fi; \
391                             fi; \
392                         done; \
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 /' \
400                             < $$i; \
401                     fi \
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"; \
406                 fi; \
407                 fi; \
408             done ; \
409         done ;
410
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.
414 check-dirs:
415         @mkdir -p check/htdocs check/logs check/bin
416
417 check-binaries: check/bin/apxs check/bin/httpd check/bin/ab
418
419 check/bin/httpd:
420         ln -s $(top_builddir)/httpd check/bin/httpd
421
422 check/bin/ab:
423         ln -s $(top_builddir)/support/ab check/bin/ab
424
425 # A version of apxs with the PREFIX overridden to point inside the install root
426 check/bin/apxs:
427         mkdir -p check
428         sed -e 's#$(prefix)#$(top_builddir)/check#g' support/apxs > $@
429         chmod +x $@
430
431 # A version of config_vars.mk with PREFIX and SBINDIR and BINDIR overridden.
432 check/build/config_vars.mk: build/config_vars.out
433         mkdir -p check/build
434         cp $< $@
435         echo "prefix = $(top_builddir)/check" >> $@
436         echo "sbindir = $(top_builddir)/check/bin" >> $@
437         echo "bindir = $(top_builddir)/check/bin" >> $@
438
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
441 # in .../c-modules.
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" && \
445             ./t/TEST -clean && \
446             ./t/TEST -config
447
448 check-make: $(TEST_SUITE_LOCATION)/Makefile
449
450 check-no:
451         @echo 'Re-run configure with the --with-test-suite option to enable in-tree tests.'
452         @false
453
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)
457
458 # Run the Apache::Test suite if it has been configured with --with-test-suite.
459 check: check-$(WITH_TEST_SUITE)
460
461 #
462 # Unit Test Suite
463 #
464
465 # Make sure the object subdirectories we use exist in the build directory during
466 # VPATH builds.
467 unittest-objdir:
468         @mkdir -p test/unit
469
470 # Normally I don't like wildcard sources, but for tests, autodiscovery is the
471 # way to go.
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)
475
476 # Each testcase depends on the source file as well as the autogenerated .tests
477 # stub.
478 $(testcase_OBJECTS): %.lo: %.c %.tests | unittest-objdir
479
480 $(testcase_STUBS): %.tests: %.c
481         $(top_srcdir)/build/httpdunit_gen_stubs.pl < "$<" > "$@"
482
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 >> $@
486
487 test/httpdunit.lo: test/httpdunit.c test/httpdunit.cases | unittest-objdir
488
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)