1
2SUBDIRS = srclib os server modules support
3CLEAN_SUBDIRS = test
4
5PROGRAM_NAME         = $(progname)
6PROGRAM_SOURCES      = modules.c
7PROGRAM_LDADD        = buildmark.o $(HTTPD_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(PCRE_LIBS) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS)
8PROGRAM_PRELINK      = $(COMPILE) -c $(top_srcdir)/server/buildmark.c
9PROGRAM_DEPENDENCIES = \
10  server/libmain.la \
11  $(BUILTIN_LIBS) \
12  $(MPM_LIB) \
13  os/$(OS_DIR)/libos.la
14
15sbin_PROGRAMS   = $(PROGRAM_NAME)
16TARGETS         = $(sbin_PROGRAMS) $(shared_build) $(other_targets)
17INSTALL_TARGETS = install-conf install-htdocs install-error install-icons \
18	install-other install-cgi install-include install-suexec install-build \
19	install-man
20
21DISTCLEAN_TARGETS  = include/ap_config_auto.h include/ap_config_layout.h \
22	include/apache_probes.h \
23	modules.c config.cache config.log config.status build/config_vars.mk \
24	build/rules.mk docs/conf/httpd.conf docs/conf/extra/*.conf shlibtool \
25	build/pkg/pkginfo build/config_vars.sh
26EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in generated_lists \
27	httpd.spec
28
29include $(top_builddir)/build/rules.mk
30include $(top_srcdir)/build/program.mk
31
32install-conf:
33	@echo Installing configuration files
34	@$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir) $(DESTDIR)$(sysconfdir)/extra
35	@$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir)/original/extra
36	@cd $(top_srcdir)/docs/conf; \
37	for i in mime.types magic; do \
38	    if test ! -f $(DESTDIR)$(sysconfdir)/$$i; then \
39	        $(INSTALL_DATA) $$i $(DESTDIR)$(sysconfdir); \
40	    fi; \
41	done; \
42	for j in $(top_srcdir)/docs/conf $(top_builddir)/docs/conf ; do \
43	    cd $$j ; \
44	    for i in httpd.conf extra/*.conf; do \
45	    	if [ -f $$i ] ; then \
46	    	( \
47	    		n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
48	    		if test $$n_lm -eq 0 -o "x$(DSO_MODULES)" = "x"; then \
49	    			sed -e 's#@@ServerRoot@@#$(prefix)#g' \
50	    				-e 's#@@Port@@#$(PORT)#g' \
51	    				-e 's#@@SSLPort@@#$(SSLPORT)#g' \
52	    				-e '/@@LoadModule@@/d' \
53	    				< $$i; \
54	    		else \
55	    			sed -n -e '/@@LoadModule@@/q' \
56	    				-e 's#@@ServerRoot@@#$(prefix)#g' \
57	    				-e 's#@@Port@@#$(PORT)#g' \
58	    				-e 's#@@SSLPort@@#$(SSLPORT)#g' \
59	    				-e 'p' \
60	    				< $$i; \
61	    			for j in $(DSO_MODULES) "^EOL^"; do \
62	    				if test $$j != "^EOL^"; then \
63	    					if echo ",$(ENABLED_DSO_MODULES),"|$(EGREP) ",$$j," > /dev/null ; then \
64	    						loading_disabled=""; \
65	    					else \
66	    						loading_disabled="#"; \
67	    					fi; \
68	    					if test "$(LOAD_ALL_MODULES)" = "yes"; then \
69	    						loading_disabled=""; \
70	    					fi; \
71    						echo "$${loading_disabled}LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \
72	    				fi; \
73	    			done; \
74	    			sed -e '1,/@@LoadModule@@/d' \
75	    				-e '/@@LoadModule@@/d' \
76	    				-e 's#@@ServerRoot@@#$(prefix)#g' \
77	    				-e 's#@@Port@@#$(PORT)#g' \
78	    				-e 's#@@SSLPort@@#$(SSLPORT)#g' \
79	    				< $$i; \
80	    		fi \
81	    	) > $(DESTDIR)$(sysconfdir)/original/$$i; \
82	    	chmod 0644 $(DESTDIR)$(sysconfdir)/original/$$i; \
83	    	file=$$i; \
84	    	if [ "$$i" = "httpd.conf" ]; then \
85	    		file=`echo $$i|sed s/.*.conf/$(PROGRAM_NAME).conf/`; \
86	    	fi; \
87	    	if test ! -f $(DESTDIR)$(sysconfdir)/$$file; then \
88	    		$(INSTALL_DATA) $(DESTDIR)$(sysconfdir)/original/$$i $(DESTDIR)$(sysconfdir)/$$file; \
89	    	fi; \
90	    	fi; \
91	    done ; \
92	done ; \
93	if test -f "$(builddir)/envvars-std"; then \
94	    cp -p envvars-std $(DESTDIR)$(sbindir); \
95	    if test ! -f $(DESTDIR)$(sbindir)/envvars; then \
96	        cp -p envvars-std $(DESTDIR)$(sbindir)/envvars ; \
97	    fi ; \
98	fi
99
100# Create a sanitized config_vars.mk
101build/config_vars.out: build/config_vars.mk
102	@$(SHELL) build/config_vars.sh < build/config_vars.mk > build/config_vars.out
103
104install-build: build/config_vars.out
105	@echo Installing build system files 
106	@$(MKINSTALLDIRS) $(DESTDIR)$(installbuilddir) 
107	@for f in $(top_srcdir)/build/*.mk build/*.mk; do \
108	 $(INSTALL_DATA) $$f $(DESTDIR)$(installbuilddir); \
109	done
110	@for f in $(top_builddir)/config.nice \
111		  $(top_srcdir)/build/mkdir.sh \
112		  $(top_srcdir)/build/instdso.sh; do \
113	 $(INSTALL_PROGRAM) $$f $(DESTDIR)$(installbuilddir); \
114	done
115	@$(INSTALL_DATA) build/config_vars.out $(DESTDIR)$(installbuilddir)/config_vars.mk
116	@rm build/config_vars.out
117
118htdocs-srcdir = $(top_srcdir)/docs/docroot
119
120docs:
121	@if test -d $(top_srcdir)/docs/manual/build; then \
122	    cd $(top_srcdir)/docs/manual/build && ./build.sh all; \
123	else \
124	    echo 'For details on generating the docs, please read:'; \
125	    echo '  http://httpd.apache.org/docs-project/docsformat.html'; \
126	fi
127
128validate-xml:
129	@if test -d $(top_srcdir)/docs/manual/build; then \
130	    cd $(top_srcdir)/docs/manual/build && ./build.sh validate-xml; \
131	else \
132	    echo 'For details on generating the docs, please read:'; \
133	    echo '  http://httpd.apache.org/docs-project/docsformat.html'; \
134	fi
135
136dox:
137	doxygen $(top_srcdir)/docs/doxygen.conf
138
139install-htdocs:
140	-@if [ -d $(DESTDIR)$(htdocsdir) ]; then \
141           echo "[PRESERVING EXISTING HTDOCS SUBDIR: $(DESTDIR)$(htdocsdir)]"; \
142        else \
143	    echo Installing HTML documents ; \
144	    $(MKINSTALLDIRS) $(DESTDIR)$(htdocsdir) ; \
145	    if test -d $(htdocs-srcdir) && test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
146		$(RSYNC) --exclude .svn -rlpt --numeric-ids $(htdocs-srcdir)/ $(DESTDIR)$(htdocsdir)/; \
147	    else \
148		test -d $(htdocs-srcdir) && (cd $(htdocs-srcdir) && cp -rp * $(DESTDIR)$(htdocsdir)) ; \
149		cd $(DESTDIR)$(htdocsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
150	    fi; \
151	fi
152
153install-error:
154	-@if [ -d $(DESTDIR)$(errordir) ]; then \
155           echo "[PRESERVING EXISTING ERROR SUBDIR: $(DESTDIR)$(errordir)]"; \
156        else \
157	    echo Installing error documents ; \
158	    $(MKINSTALLDIRS) $(DESTDIR)$(errordir) ; \
159	    cd $(top_srcdir)/docs/error && cp -rp * $(DESTDIR)$(errordir) ; \
160	    test "x$(errordir)" != "x" && cd $(DESTDIR)$(errordir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
161	fi
162
163install-icons:
164	-@if [ -d $(DESTDIR)$(iconsdir) ]; then \
165           echo "[PRESERVING EXISTING ICONS SUBDIR: $(DESTDIR)$(iconsdir)]"; \
166        else \
167	    echo Installing icons ; \
168	    $(MKINSTALLDIRS) $(DESTDIR)$(iconsdir) ; \
169	    cd $(top_srcdir)/docs/icons && cp -rp * $(DESTDIR)$(iconsdir) ; \
170	    test "x$(iconsdir)" != "x" && cd $(DESTDIR)$(iconsdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
171	fi
172
173install-cgi:
174	-@if [ -d $(DESTDIR)$(cgidir) ];then \
175	    echo "[PRESERVING EXISTING CGI SUBDIR: $(DESTDIR)$(cgidir)]"; \
176	else \
177	   echo Installing CGIs ; \
178	   $(MKINSTALLDIRS) $(DESTDIR)$(cgidir) ; \
179	   cd $(top_srcdir)/docs/cgi-examples && cp -rp * $(DESTDIR)$(cgidir) ; \
180	   test "x$(cgidir)" != "x" && cd $(DESTDIR)$(cgidir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
181	fi
182
183install-other:
184	@test -d $(DESTDIR)$(logfiledir) || $(MKINSTALLDIRS) $(DESTDIR)$(logfiledir)
185	@test -d $(DESTDIR)$(runtimedir) || $(MKINSTALLDIRS) $(DESTDIR)$(runtimedir)
186	@for ext in dll x; do \
187		file=apachecore.$$ext; \
188		if test -f $$file; then \
189			cp -p $$file $(DESTDIR)$(libdir); \
190		fi; \
191	done; \
192	file=httpd.dll; \
193	if test -f $$file; then \
194		cp -p $$file $(DESTDIR)$(bindir); \
195	fi;
196
197INSTALL_HEADERS = \
198	include/*.h \
199	$(srcdir)/include/*.h \
200	$(srcdir)/os/$(OS_DIR)/os.h \
201	$(srcdir)/modules/arch/unix/mod_unixd.h \
202	$(srcdir)/modules/core/mod_so.h \
203	$(srcdir)/modules/core/mod_watchdog.h \
204	$(srcdir)/modules/cache/mod_cache.h \
205	$(srcdir)/modules/cache/cache_common.h \
206	$(srcdir)/modules/database/mod_dbd.h \
207	$(srcdir)/modules/dav/main/mod_dav.h \
208	$(srcdir)/modules/filters/mod_include.h \
209	$(srcdir)/modules/filters/mod_xml2enc.h \
210	$(srcdir)/modules/generators/mod_cgi.h \
211	$(srcdir)/modules/generators/mod_status.h \
212	$(srcdir)/modules/loggers/mod_log_config.h \
213	$(srcdir)/modules/mappers/mod_rewrite.h \
214	$(srcdir)/modules/proxy/mod_proxy.h \
215        $(srcdir)/modules/session/mod_session.h \
216	$(srcdir)/modules/ssl/mod_ssl.h \
217	$(srcdir)/os/$(OS_DIR)/*.h
218
219install-include:
220	@echo Installing header files
221	@$(MKINSTALLDIRS) $(DESTDIR)$(includedir)
222	@for hdr in $(INSTALL_HEADERS); do \
223	  $(INSTALL_DATA) $$hdr $(DESTDIR)$(includedir); \
224	done
225
226install-man:
227	@echo Installing man pages and online manual
228	@test -d $(DESTDIR)$(mandir)      || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)
229	@test -d $(DESTDIR)$(mandir)/man1 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man1
230	@test -d $(DESTDIR)$(mandir)/man8 || $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man8
231	@test -d $(DESTDIR)$(manualdir)   || $(MKINSTALLDIRS) $(DESTDIR)$(manualdir)
232	@cp -p $(top_srcdir)/docs/man/*.1 $(DESTDIR)$(mandir)/man1
233	@cp -p $(top_srcdir)/docs/man/*.8 $(DESTDIR)$(mandir)/man8
234	@if test "x$(RSYNC)" != "x" && test -x $(RSYNC) ; then \
235	  $(RSYNC) --exclude .svn -rlpt --numeric-ids $(top_srcdir)/docs/manual/ $(DESTDIR)$(manualdir)/; \
236	else \
237	  cd $(top_srcdir)/docs/manual && cp -rp * $(DESTDIR)$(manualdir); \
238	  cd $(DESTDIR)$(manualdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \
239	fi
240
241install-suexec:
242	@if test -f $(builddir)/support/suexec; then \
243            test -d $(DESTDIR)$(sbindir) || $(MKINSTALLDIRS) $(DESTDIR)$(sbindir); \
244            $(INSTALL_PROGRAM) $(top_builddir)/support/suexec $(DESTDIR)$(sbindir); \
245            chmod 4755 $(DESTDIR)$(sbindir)/suexec; \
246	fi
247
248suexec:
249	cd support && $(MAKE) suexec
250
251x-local-distclean:
252	@rm -rf autom4te.cache
253
254# XXX: This looks awfully platform-specific [read: bad form and style]
255include $(top_srcdir)/os/os2/core.mk
256