1## ====================================================================
2## The Apache Software License, Version 1.1
3##
4## Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
5## reserved.
6##
7## Redistribution and use in source and binary forms, with or without
8## modification, are permitted provided that the following conditions
9## are met:
10##
11## 1. Redistributions of source code must retain the above copyright
12##    notice, this list of conditions and the following disclaimer.
13##
14## 2. Redistributions in binary form must reproduce the above copyright
15##    notice, this list of conditions and the following disclaimer in
16##    the documentation and/or other materials provided with the
17##    distribution.
18##
19## 3. The end-user documentation included with the redistribution,
20##    if any, must include the following acknowledgment:
21##       "This product includes software developed by the
22##        Apache Software Foundation (http://www.apache.org/)."
23##    Alternately, this acknowledgment may appear in the software itself,
24##    if and wherever such third-party acknowledgments normally appear.
25##
26## 4. The names "Apache" and "Apache Software Foundation" must
27##    not be used to endorse or promote products derived from this
28##    software without prior written permission. For written
29##    permission, please contact apache@apache.org.
30##
31## 5. Products derived from this software may not be called "Apache",
32##    nor may "Apache" appear in their name, without prior written
33##    permission of the Apache Software Foundation.
34##
35## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37## OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38## DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46## SUCH DAMAGE.
47## ====================================================================
48##
49## This software consists of voluntary contributions made by many
50## individuals on behalf of the Apache Software Foundation.  For more
51## information on the Apache Software Foundation, please see
52## <http://www.apache.org/>.
53##
54## Portions of this software are based upon public domain software
55## originally written at the National Center for Supercomputing Applications,
56## University of Illinois, Urbana-Champaign.
57##
58##
59
60##
61##  Makefile -- Apache Autoconf-style Interface (APACI)
62##              top-level control Makefile for out-of-the-box
63##              build and installation procedure.
64##
65##  Written by Ralf S. Engelschall <rse@apache.org>
66##
67
68## ==================================================================
69##                              Options
70## ==================================================================
71
72#   safe environment
73SHELL           = @SHELL@
74
75#   what platform are we on
76PLATFORM	= @PLATFORM@
77
78#   paths to the source tree parts
79TOP             = .
80SRC             = @SRC@
81MKF             = @MKF@
82AUX             = @AUX@
83
84#   build tools
85CP              = cp
86LN              = ln
87RM              = rm -f
88MKDIR           = $(SHELL) $(TOP)/$(AUX)/mkdir.sh
89INSTALL         = $(SHELL) $(TOP)/$(AUX)/install.sh -c
90IFLAGS_PROGRAM  = @IFLAGS_PROGRAM@
91IFLAGS_CORE     = @IFLAGS_CORE@
92IFLAGS_DSO      = @IFLAGS_DSO@
93IFLAGS_SCRIPT   = @IFLAGS_SCRIPT@
94IFLAGS_DATA     = @IFLAGS_DATA@
95INSTALL_PROGRAM = $(INSTALL) $(IFLAGS_PROGRAM)
96INSTALL_CORE    = $(INSTALL) $(IFLAGS_CORE)
97INSTALL_DSO     = $(INSTALL) $(IFLAGS_DSO)
98INSTALL_SCRIPT  = $(INSTALL) $(IFLAGS_SCRIPT)
99INSTALL_DATA    = $(INSTALL) $(IFLAGS_DATA)
100PERL            = @PERL@
101TAR		= @TAR@
102TAROPT		= @TAROPT@
103
104#   installation name of Apache webserver
105TARGET          = @TARGET@
106
107#   installation root
108#   (overrideable by package maintainers for
109#   rolling packages without bristling the system)
110root            =
111
112#   installation paths
113prefix          = @prefix@
114exec_prefix     = @exec_prefix@
115bindir          = @bindir@
116sbindir         = @sbindir@
117libexecdir      = @libexecdir@
118mandir          = @mandir@
119sysconfdir      = @sysconfdir@
120datadir         = @datadir@
121iconsdir        = @iconsdir@
122htdocsdir       = @htdocsdir@
123manualdir       = @manualdir@
124cgidir          = @cgidir@
125includedir      = @includedir@
126localstatedir   = @localstatedir@
127runtimedir      = @runtimedir@
128logfiledir      = @logfiledir@
129proxycachedir   = @proxycachedir@
130
131libexecdir_relative   = @libexecdir_relative@
132
133#   suexec details (optional)
134suexec          = @suexec@
135suexec_caller   = @suexec_caller@
136suexec_docroot  = @suexec_docroot@
137suexec_logexec  = @suexec_logexec@
138suexec_userdir  = @suexec_userdir@
139suexec_uidmin   = @suexec_uidmin@
140suexec_gidmin   = @suexec_gidmin@
141suexec_safepath = @suexec_safepath@
142suexec_umask    = @suexec_umask@
143
144#  SSL (optional)
145ssl = @ssl@
146
147#   some substituted configuration parameters
148conf_user        = @conf_user@
149conf_group       = @conf_group@
150conf_port        = @conf_port@
151conf_port_ssl    = @conf_port_ssl@
152conf_serveradmin = @conf_serveradmin@
153conf_servername  = @conf_servername@
154
155#   usage of src/support stuff
156build-support     = @build_support@
157install-support   = @install_support@
158clean-support     = @clean_support@
159distclean-support = @distclean_support@
160
161#   `make certificate' parameters
162TYPE =
163ALGO =
164CRT  =
165KEY  =
166VIEW =
167
168#   forwarding arguments
169MFWD = root=$(root)
170
171## ==================================================================
172##                              Targets
173## ==================================================================
174
175#   default target
176all: build
177
178## ------------------------------------------------------------------
179##                           Build Target
180## ------------------------------------------------------------------
181
182#   build the package
183build:
184	@echo "===> $(SRC)"
185	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build-std
186	@if [ "x$(build-support)" != "x" ]; then \
187	    $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) $(build-support); \
188        fi
189	@touch $(TOP)/$(SRC)/.apaci.build.ok
190	@echo "<=== $(SRC)"
191
192#   the non-verbose variant for package maintainers
193build-quiet:
194	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 build
195
196#   build the standard stuff
197build-std:
198	@case "x$(PLATFORM)" in \
199	  x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
200	esac; \
201	cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ all
202
203#   build the additional support stuff
204build-support:
205	@echo "===> $(SRC)/support"; \
206	case "x$(PLATFORM)" in \
207	  x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
208	esac; \
209	cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) all || exit 1; \
210	if [ ".$(suexec)" = .1 ]; then \
211	    $(MAKE) $(MFLAGS) \
212		EXTRA_CFLAGS='\
213			$(suexec_umask) \
214			-DHTTPD_USER=\"$(suexec_caller)\" \
215			-DUID_MIN=$(suexec_uidmin) \
216			-DGID_MIN=$(suexec_gidmin) \
217			-DUSERDIR_SUFFIX=\"$(suexec_userdir)\" \
218			-DLOG_EXEC=\"$(suexec_logexec)\" \
219			-DDOC_ROOT=\"$(suexec_docroot)\" \
220			-DSAFE_PATH=\"$(suexec_safepath)\"' \
221		suexec; \
222	fi
223	@echo "<=== $(SRC)/support"
224
225#   SSL certificate generation
226build-certificate:
227	-@if [ ".$(ssl)" = .1 ]; then \
228		if [ ".`grep '(SKIPME)' $(TOP)/conf/ssl.crt/server.crt`" != . ]; then \
229			if [ ".$(QUIET)" != .1 ]; then \
230				echo "+---------------------------------------------------------------------+"; \
231				echo "| Before you install the package you now should prepare the SSL       |"; \
232				echo "| certificate system by running the 'make certificate' command.       |"; \
233				echo "| For different situations the following variants are provided:       |"; \
234				echo "|                                                                     |"; \
235				echo "| % make certificate TYPE=dummy    (dummy self-signed Snake Oil cert) |"; \
236				echo "| % make certificate TYPE=test     (test cert signed by Snake Oil CA) |"; \
237				echo "| % make certificate TYPE=custom   (custom cert signed by own CA)     |"; \
238				echo "| % make certificate TYPE=existing (existing cert)                    |"; \
239				echo "|        CRT=/path/to/your.crt [KEY=/path/to/your.key]                |"; \
240				echo "|                                                                     |"; \
241				echo "| Use TYPE=dummy    when you're a  vendor package maintainer,         |"; \
242				echo "| the TYPE=test     when you're an admin but want to do tests only,   |"; \
243				echo "| the TYPE=custom   when you're an admin willing to run a real server |"; \
244				echo "| and TYPE=existing when you're an admin who upgrades a server.       |"; \
245				echo "| (The default is TYPE=test)                                          |"; \
246				echo "|                                                                     |"; \
247				echo "| Additionally add ALGO=RSA (default) or ALGO=DSA to select           |"; \
248				echo "| the signature algorithm used for the generated certificate.         |"; \
249				echo "|                                                                     |"; \
250				echo "| Use 'make certificate VIEW=1' to display the generated data.        |"; \
251				echo "|                                                                     |"; \
252				echo "| Thanks for using Apache & mod_ssl.       Ralf S. Engelschall        |"; \
253				echo "|                                          rse@engelschall.com        |"; \
254				echo "|                                          www.engelschall.com        |"; \
255				echo "+---------------------------------------------------------------------+"; \
256			fi \
257		fi \
258	fi
259
260certificate:
261	@cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) certificate TYPE="$(TYPE)" ALGO="$(ALGO)" CRT="$(CRT)" KEY="$(KEY)" VIEW="$(VIEW)"
262
263## ------------------------------------------------------------------
264##                       Installation Targets
265## ------------------------------------------------------------------
266
267#   indirection step to avoid conflict with INSTALL document
268#   on case-insenstive filesystems, for instance on OS/2
269install: install-all
270
271#   the install target for installing the complete Apache
272#   package. This is implemented by running subtargets for the
273#   separate parts of the installation process.
274install-all:
275	@if [ ! -f $(TOP)/$(SRC)/.apaci.build.ok ]; then \
276		$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build; \
277	else \
278		:; \
279	fi
280	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) \
281		install-mktree install-programs $(install-support) \
282		install-include install-data install-config
283	-@$(RM) $(SRC)/.apaci.install.tmp
284	-@$(RM) $(SRC)/.apaci.install.conf
285	-@if [ ".$(QUIET)" != .1 ]; then \
286		if [ ".$(TARGET)" = .httpd ]; then \
287			apachectl='apachectl'; \
288		else \
289			apachectl="$(TARGET)ctl"; \
290		fi; \
291		echo "+--------------------------------------------------------+"; \
292		echo "| You now have successfully built and installed the      |"; \
293		echo "| Apache 1.3 HTTP server. To verify that Apache actually |"; \
294		echo "| works correctly you now should first check the         |"; \
295		echo "| (initially created or preserved) configuration files   |"; \
296		echo "|                                                        |"; \
297		echo "|   $(sysconfdir)/$(TARGET).conf"; \
298		echo "|                                                        |"; \
299		echo "| and then you should be able to immediately fire up     |"; \
300		echo "| Apache the first time by running:                      |"; \
301		echo "|                                                        |"; \
302		echo "|   $(sbindir)/$${apachectl} start"; \
303		echo "|                                                        |"; \
304		echo "| Or when you want to run it with SSL enabled use:       |"; \
305		echo "|                                                        |"; \
306		echo "|   $(sbindir)/$${apachectl} startssl"; \
307		echo "|                                                        |"; \
308		echo "| Thanks for using Apache.       The Apache Group        |"; \
309		echo "|                                http://www.apache.org/  |"; \
310		echo "+--------------------------------------------------------+"; \
311	fi
312
313#   the non-verbose variant for package maintainers
314install-quiet:
315	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 install-all
316
317#   create the installation tree
318install-mktree:
319	@echo "===> [mktree: Creating Apache installation tree]"
320	$(MKDIR) $(root)$(bindir)
321	$(MKDIR) $(root)$(sbindir)
322	$(MKDIR) $(root)$(libexecdir)
323	$(MKDIR) $(root)$(mandir)/man1
324	$(MKDIR) $(root)$(mandir)/man8
325	$(MKDIR) $(root)$(sysconfdir)
326	$(MKDIR) $(root)$(sysconfdir)/ssl.crt
327	$(MKDIR) $(root)$(sysconfdir)/ssl.crl
328	$(MKDIR) $(root)$(sysconfdir)/ssl.csr
329	$(MKDIR) $(root)$(sysconfdir)/ssl.key
330	$(MKDIR) $(root)$(sysconfdir)/ssl.prm
331	$(MKDIR) $(root)$(htdocsdir)
332	$(MKDIR) $(root)$(manualdir)
333	$(MKDIR) $(root)$(iconsdir)
334	$(MKDIR) $(root)$(cgidir)
335	$(MKDIR) $(root)$(includedir)
336	$(MKDIR) $(root)$(includedir)/xml
337	$(MKDIR) $(root)$(runtimedir)
338	$(MKDIR) $(root)$(logfiledir)
339	$(MKDIR) $(root)$(proxycachedir)
340	-@if [ "x`$(SHELL) $(AUX)/getuid.sh`" = "x0" ]; then \
341		echo "chown $(conf_user) $(root)$(proxycachedir)"; \
342		chown $(conf_user) $(root)$(proxycachedir); \
343		echo "chgrp $(conf_group) $(root)$(proxycachedir)"; \
344		chgrp "$(conf_group)" $(root)$(proxycachedir); \
345	fi
346	@echo "<=== [mktree]"
347
348#   install the server program and optionally corresponding
349#   shared object files.
350install-programs:
351	@echo "===> [programs: Installing Apache $(TARGET) program and shared objects]"
352	-@if [ ".`grep '^[ 	]*AddModule.*mod_so\.o' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
353		echo "$(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
354		$(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
355		SHLIB_EXPORT_FILES="`grep '^SHLIB_EXPORT_FILES=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
356		if [ ".$${SHLIB_EXPORT_FILES}" != . ]; then \
357			$(CP) $(TOP)/$(SRC)/support/httpd.exp $(root)$(libexecdir)/; \
358			chmod 644 $(root)$(libexecdir)/httpd.exp; \
359		fi; \
360	else \
361		echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
362		$(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
363	fi
364	-@if [ ".`grep 'SUBTARGET=target_shared' $(TOP)/$(SRC)/Makefile`" != . ]; then \
365		SHLIB_SUFFIX_NAME="`grep '^SHLIB_SUFFIX_NAME=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
366		SHLIB_SUFFIX_LIST="`grep '^SHLIB_SUFFIX_LIST=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
367		echo "$(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep"; \
368		$(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep; \
369		echo "$(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}"; \
370		$(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}; \
371		if [ ".$${SHLIB_SUFFIX_LIST}" != . ]; then \
372			echo "$(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*"; \
373			$(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*; \
374			for suffix in $${SHLIB_SUFFIX_LIST} ""; do \
375				[ ".$${suffix}" = . ] && continue; \
376				echo "$(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}"; \
377				$(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}; \
378			done; \
379		fi; \
380	fi
381	$(INSTALL_DATA) $(TOP)/$(SRC)/support/httpd.8 $(root)$(mandir)/man8/$(TARGET).8
382	-@$(RM) $(SRC)/.apaci.install.conf; touch $(SRC)/.apaci.install.conf
383	-@if [ ".`grep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
384		for mod in `egrep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci |\
385	                sed -e 's/^[ 	]*SharedModule[ 	]*//'`; do \
386			file=`echo $${mod} | sed -e 's;^.*/\([^/]*\);\1;'`; \
387			echo "$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}"; \
388			$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}; \
389			name=`$(SHELL) $(TOP)/$(AUX)/fmn.sh $(TOP)/$(SRC)/$${mod}`; \
390			if [ ".$$name" = .ssl_module ]; then \
391				echo "<IfDefine SSL>" >>$(SRC)/.apaci.install.conf; \
392			fi; \
393			echo dummy | awk '{ printf("LoadModule %-18s %s\n", modname, modpath); }' \
394			modname="$${name}" modpath="$(libexecdir_relative)$${file}" >>$(SRC)/.apaci.install.conf; \
395			if [ ".$$name" = .ssl_module ]; then \
396				echo "</IfDefine>" >>$(SRC)/.apaci.install.conf; \
397			fi; \
398		done; \
399		echo "" >>$(SRC)/.apaci.install.conf; \
400		echo "#  Reconstruction of the complete module list from all available modules" >>$(SRC)/.apaci.install.conf; \
401		echo "#  (static and shared ones) to achieve correct module execution order." >>$(SRC)/.apaci.install.conf; \
402		echo "#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]" >>$(SRC)/.apaci.install.conf; \
403		echo "ClearModuleList" >>$(SRC)/.apaci.install.conf; \
404		for mod in `egrep "^[ 	]*(Add|Shared)Module" $(SRC)/Configuration.apaci |\
405			sed	-e 's:[ 	]*SharedModule::' \
406				-e 's:[ 	]*AddModule::' \
407				-e 's:modules/[^/]*/::' \
408				-e 's:[ 	]lib: mod_:' \
409				-e 's:\.[dsoam]*$$:.c:'`; do \
410			if [ ".$$mod" = .mod_ssl.c ]; then \
411				echo "<IfDefine SSL>" >>$(SRC)/.apaci.install.conf; \
412			fi; \
413			echo "AddModule $$mod" >>$(SRC)/.apaci.install.conf; \
414			if [ ".$$mod" = .mod_ssl.c ]; then \
415				echo "</IfDefine>" >>$(SRC)/.apaci.install.conf; \
416			fi; \
417		done; \
418	fi
419	@echo "<=== [programs]"
420
421#   install the support programs and scripts
422install-support:
423	@echo "===> [support: Installing Apache support programs and scripts]"
424	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
425	$(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
426	@if [ ".$(TARGET)" = .httpd ]; then \
427		apachectl='apachectl'; \
428	else \
429		apachectl="$(TARGET)ctl"; \
430	fi; \
431	echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
432	sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
433		-e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
434		< $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
435		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
436	echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
437	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
438	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/checkgid $(root)$(bindir)/checkgid
439	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
440	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
441	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
442	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
443	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
444	sed -e 's;^#!/.*;#!$(PERL);' \
445		< $(TOP)/$(SRC)/support/dbmmanage > $(TOP)/$(SRC)/.apaci.install.tmp && \
446		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(bindir)/dbmmanage
447	$(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
448	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
449	$(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
450	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
451	$(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
452	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
453	sed -e 's;^#!/.*;#!$(PERL);' \
454		-e 's;\@prefix\@;$(prefix);' \
455		-e 's;\@sbindir\@;$(sbindir);' \
456		-e 's;\@libexecdir\@;$(libexecdir);' \
457		-e 's;\@includedir\@;$(includedir);' \
458		-e 's;\@sysconfdir\@;$(sysconfdir);' \
459		< $(TOP)/$(SRC)/support/apxs > $(TOP)/$(SRC)/.apaci.install.tmp && \
460		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/apxs
461	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
462	-@if [ ".$(suexec)" = .1 ]; then \
463	    echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
464	    $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
465	    echo "chown root $(root)$(sbindir)/suexec"; \
466	    chown root $(root)$(sbindir)/suexec; \
467	    echo "chmod 4711 $(root)$(sbindir)/suexec"; \
468	    chmod 4711 $(root)$(sbindir)/suexec; \
469	    echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
470	    $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
471	fi
472	@echo "<=== [support]"
473
474#   install the support programs and scripts for binary distribution
475install-binsupport:
476	@echo "===> [support: Installing Apache support programs and scripts for binary distribution]"
477	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
478	$(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
479	@if [ ".$(TARGET)" = .httpd ]; then \
480		apachectl='apachectl'; \
481	else \
482		apachectl="$(TARGET)ctl"; \
483	fi; \
484	echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
485	sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
486		-e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
487		< $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
488		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
489	echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
490	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
491	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/checkgid $(root)$(bindir)/checkgid
492	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
493	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
494	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
495	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
496	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
497	$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage $(root)$(bindir)/dbmmanage
498	$(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
499	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
500	$(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
501	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
502	$(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
503	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
504	$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs $(root)$(sbindir)/apxs
505	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
506	-@if [ ".$(suexec)" = .1 ]; then \
507	    echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
508	    $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
509	    echo "chown root $(root)$(sbindir)/suexec"; \
510	    chown root $(root)$(sbindir)/suexec; \
511	    echo "chmod 4711 $(root)$(sbindir)/suexec"; \
512	    chmod 4711 $(root)$(sbindir)/suexec; \
513	    echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
514	    $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
515	fi
516	@echo "<=== [support]"
517
518#   install the Apache C header files
519install-include:
520	@echo "===> [include: Installing Apache C header files]"
521	$(CP) $(TOP)/$(SRC)/include/*.h $(root)$(includedir)/
522	@osdir=`grep '^OSDIR=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^OSDIR=.*/os/:os/:'`; \
523		echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/"; \
524		$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/; \
525		echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/"; \
526		$(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/
527	chmod 644 $(root)$(includedir)/*.h $(root)$(includedir)/xml/*.h
528	@echo "<=== [include]"
529
530#   create an initial document root containing the Apache manual,
531#   icons and distributed CGI scripts.
532install-data:
533	@echo "===> [data: Installing initial data files]"
534	-@if [ -f $(root)$(htdocsdir)/index.html ] || [ -f $(root)$(htdocsdir)/index.html.en ]; then \
535		echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(htdocsdir)/]"; \
536	else \
537		echo "Copying tree $(TOP)/htdocs/ -> $(root)$(htdocsdir)/"; \
538		(cd $(TOP)/htdocs/ && $(TAR) $(TAROPT) - index* ) |\
539		(cd $(root)$(htdocsdir)/ && $(TAR) -xf -); \
540		find $(root)$(htdocsdir)/ -type d -exec chmod a+rx {} \; ; \
541		find $(root)$(htdocsdir)/ -type f -print | xargs chmod a+r ; \
542	fi
543	-@if [ -d $(TOP)/htdocs/manual ]; then \
544		echo "Copying tree $(TOP)/htdocs/manual -> $(root)/$(manualdir)/"; \
545		(cd $(TOP)/htdocs/manual/ && $(TAR) $(TAROPT) - *) |\
546		(cd $(root)$(manualdir)/ && $(TAR) -xf -); \
547		find $(root)$(manualdir)/ -type d -exec chmod a+rx {} \; ; \
548		find $(root)$(manualdir)/ -type f -print | xargs chmod a+r ; \
549	fi
550	-@if [ -f $(root)$(cgidir)/printenv ]; then \
551		echo "[PRESERVING EXISTING CGI SUBDIR: $(root)$(cgidir)/]"; \
552	else \
553		for script in printenv test-cgi; do \
554			cat $(TOP)/cgi-bin/$${script} |\
555			sed -e 's;^#!/.*perl;#!$(PERL);' \
556			> $(TOP)/$(SRC)/.apaci.install.tmp; \
557			echo "$(INSTALL_DATA) $(TOP)/conf/$${script}[*] $(root)$(cgidir)/$${script}"; \
558			$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(cgidir)/$${script}; \
559		done; \
560	fi
561	@echo "Copying tree $(TOP)/icons/ -> $(root)$(iconsdir)/"; \
562	(cd $(TOP)/icons/ && $(TAR) $(TAROPT) - *) |\
563	(cd $(root)$(iconsdir)/ && $(TAR) -xf -); \
564	find $(root)$(iconsdir)/ -type d -exec chmod a+rx {} \; ;\
565	find $(root)$(iconsdir)/ -type f -exec chmod a+r {} \;
566	@echo "<=== [data]"
567
568#   create the initial configuration by providing default files
569#   and initial config files while preserving existing ones.
570install-config:
571	@echo "===> [config: Installing Apache configuration files]"
572	-@for conf in httpd.conf access.conf srm.conf; do \
573		if [ .$$conf = .httpd.conf ]; then \
574			target_conf="$(TARGET).conf"; \
575		else \
576			target_conf="$$conf"; \
577		fi; \
578		if [ ".$(TARGET)" = .httpd ]; then \
579			target_prefix=""; \
580		else \
581			target_prefix="$(TARGET)_"; \
582		fi; \
583		(echo "##"; \
584		 echo "## $${target_conf} -- Apache HTTP server configuration file"; \
585		 echo "##"; \
586		 echo ""; \
587		 cat $(TOP)/conf/$${conf}-dist ) |\
588		 sed -e '/# LoadModule/r $(TOP)/$(SRC)/.apaci.install.conf' \
589			-e "s;logs/ssl_mutex;$(runtimedir)/$${target_prefix}ssl_mutex;" \
590			-e "s;logs/ssl_scache;$(runtimedir)/$${target_prefix}ssl_scache;" \
591			-e "s;logs/ssl_engine_log;$(logfiledir)/$${target_prefix}ssl_engine_log;" \
592			-e "s;logs/ssl_request_log;$(logfiledir)/$${target_prefix}ssl_request_log;" \
593			-e 's;@@ServerRoot@@/conf/ssl.crt;$(sysconfdir)/ssl.crt;' \
594			-e 's;@@ServerRoot@@/conf/ssl.crl;$(sysconfdir)/ssl.crl;' \
595			-e 's;@@ServerRoot@@/conf/ssl.csr;$(sysconfdir)/ssl.csr;' \
596			-e 's;@@ServerRoot@@/conf/ssl.key;$(sysconfdir)/ssl.key;' \
597			-e 's;@@ServerRoot@@/conf/ssl.prm;$(sysconfdir)/ssl.prm;' \
598			-e 's;@@ServerRoot@@/htdocs/manual;$(manualdir);' \
599			-e 's;@@ServerRoot@@/htdocs;$(htdocsdir);' \
600			-e 's;@@ServerRoot@@/icons;$(iconsdir);' \
601			-e 's;@@ServerRoot@@/cgi-bin;$(cgidir);' \
602			-e 's;@@ServerRoot@@/proxy;$(proxycachedir);' \
603			-e 's;@@ServerRoot@@;$(prefix);g' \
604			-e 's;httpd\.conf;$(TARGET).conf;' \
605			-e 's;logs/accept\.lock;$(runtimedir)/$(TARGET).lock;' \
606			-e 's;logs/apache_runtime_status;$(runtimedir)/$(TARGET).scoreboard;' \
607			-e 's;logs/httpd\.pid;$(runtimedir)/$(TARGET).pid;' \
608			-e "s;logs/access_log;$(logfiledir)/$${target_prefix}access_log;" \
609			-e "s;logs/error_log;$(logfiledir)/$${target_prefix}error_log;" \
610			-e "s;logs/referer_log;$(logfiledir)/$${target_prefix}referer_log;" \
611			-e "s;logs/agent_log;$(logfiledir)/$${target_prefix}agent_log;" \
612			-e 's;conf/magic;$(sysconfdir)/magic;' \
613			-e 's;conf/srm.conf;$(sysconfdir)/srm.conf;' \
614			-e 's;conf/access.conf;$(sysconfdir)/access.conf;' \
615			-e 's;conf/mime\.types;$(sysconfdir)/mime.types;' \
616			-e 's;User nobody;User $(conf_user);' \
617			-e 's;Group #-1;Group $(conf_group);' \
618			-e 's;^Group "#-1";Group $(conf_group);' \
619			-e 's;Port 80;Port $(conf_port);' \
620			-e 's;Listen 80;Listen $(conf_port);' \
621			-e 's;Listen 443;Listen $(conf_port_ssl);' \
622			-e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
623			-e 's;ServerName new.host.name;ServerName $(conf_servername);' \
624			-e 's;VirtualHost _default_:443;VirtualHost _default_:$(conf_port_ssl);' \
625        	> $(TOP)/$(SRC)/.apaci.install.tmp && \
626		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}.default"; \
627		$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}.default; \
628		if [ ! -f "$(root)$(sysconfdir)/$${target_conf}" ]; then \
629			echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}"; \
630			$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}; \
631		else \
632			echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${target_conf}]"; \
633		fi; \
634	done
635	-@for conf in mime.types magic; do \
636		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default"; \
637		$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default; \
638		if [ ! -f "$(root)$(sysconfdir)/$${conf}" ]; then \
639			echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}"; \
640			$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}; \
641		else \
642			echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${conf}]"; \
643		fi; \
644	done
645	-@if [ ".$(ssl)" = .1 ]; then \
646		echo "chmod 755 $(root)$(sysconfdir)/ssl.crt"; \
647		chmod 755 $(root)$(sysconfdir)/ssl.crt; \
648		echo "chmod 755 $(root)$(sysconfdir)/ssl.crl"; \
649		chmod 755 $(root)$(sysconfdir)/ssl.crl; \
650		echo "chmod 755 $(root)$(sysconfdir)/ssl.csr"; \
651		chmod 755 $(root)$(sysconfdir)/ssl.csr; \
652		echo "chmod 700 $(root)$(sysconfdir)/ssl.key"; \
653		chmod 700 $(root)$(sysconfdir)/ssl.key; \
654		echo "chmod 755 $(root)$(sysconfdir)/ssl.prm"; \
655		chmod 755 $(root)$(sysconfdir)/ssl.prm; \
656		if [ ! -f "$(root)$(sysconfdir)/ssl.crt/README.CRT" ]; then \
657			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crt/README.CRT $(root)$(sysconfdir)/ssl.crt/README.CRT"; \
658			$(INSTALL) $(TOP)/conf/ssl.crt/README.CRT $(root)$(sysconfdir)/ssl.crt/README.CRT; \
659			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crt/Makefile $(root)$(sysconfdir)/ssl.crt/Makefile"; \
660			$(INSTALL) $(TOP)/conf/ssl.crt/Makefile $(root)$(sysconfdir)/ssl.crt/Makefile; \
661			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/ca-bundle.crt $(root)$(sysconfdir)/ssl.crt/ca-bundle.crt"; \
662			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/ca-bundle.crt $(root)$(sysconfdir)/ssl.crt/ca-bundle.crt; \
663			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-rsa.crt"; \
664			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-rsa.crt; \
665			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-dsa.crt"; \
666			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-dsa.crt; \
667			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-rsa.crt"; \
668			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-rsa.crt; \
669			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-dsa.crt"; \
670			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-dsa.crt; \
671			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/server.crt $(root)$(sysconfdir)/ssl.crt/server.crt"; \
672			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/server.crt $(root)$(sysconfdir)/ssl.crt/server.crt; \
673			if [ -f "$(TOP)/conf/ssl.crt/ca.crt" ]; then \
674				echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/ca.crt $(root)$(sysconfdir)/ssl.crt/ca.crt"; \
675				$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/ca.crt $(root)$(sysconfdir)/ssl.crt/ca.crt; \
676			fi; \
677		else \
678			echo "[PRESERVING EXISTING CERTIFICATE FILES: $(root)$(sysconfdir)/ssl.crt/*]"; \
679		fi; \
680		echo "Updating hash symlinks in $(root)$(sysconfdir)/ssl.crt/:"; \
681		SSL_PROGRAM="`grep '^SSL_PROGRAM=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^.*=::'`"; \
682		(cd $(root)$(sysconfdir)/ssl.crt/ && $(MAKE) $(MFLAGS) SSL_PROGRAM=$$SSL_PROGRAM); \
683		if [ ! -f "$(root)$(sysconfdir)/ssl.csr/README.CSR" ]; then \
684			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.csr/README.CSR $(root)$(sysconfdir)/ssl.csr/README.CSR"; \
685			$(INSTALL) $(TOP)/conf/ssl.csr/README.CSR $(root)$(sysconfdir)/ssl.csr/README.CSR; \
686			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.csr/server.csr $(root)$(sysconfdir)/ssl.csr/server.csr"; \
687			$(INSTALL) -m 400 $(TOP)/conf/ssl.csr/server.csr $(root)$(sysconfdir)/ssl.csr/server.csr; \
688		else \
689			echo "[PRESERVING EXISTING CSR FILES: $(root)$(sysconfdir)/ssl.csr/*]"; \
690		fi; \
691		if [ ! -f "$(root)$(sysconfdir)/ssl.crl/README.CRL" ]; then \
692			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crl/README.CRL $(root)$(sysconfdir)/ssl.crl/README.CRL"; \
693			$(INSTALL) $(TOP)/conf/ssl.crl/README.CRL $(root)$(sysconfdir)/ssl.crl/README.CRL; \
694			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crl/Makefile $(root)$(sysconfdir)/ssl.crl/Makefile"; \
695			$(INSTALL) $(TOP)/conf/ssl.crl/Makefile $(root)$(sysconfdir)/ssl.crl/Makefile; \
696		else \
697			echo "[PRESERVING EXISTING CRL FILES: $(root)$(sysconfdir)/ssl.crl/*]"; \
698		fi; \
699		if [ ! -f "$(root)$(sysconfdir)/ssl.key/README.KEY" ]; then \
700			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.key/README.KEY $(root)$(sysconfdir)/ssl.key/README.KEY"; \
701			$(INSTALL) $(TOP)/conf/ssl.key/README.KEY $(root)$(sysconfdir)/ssl.key/README.KEY; \
702			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-rsa.key"; \
703			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-rsa.key; \
704			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-dsa.key"; \
705			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-dsa.key; \
706			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-rsa.key"; \
707			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-rsa.key; \
708			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-dsa.key"; \
709			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-dsa.key; \
710			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/server.key $(root)$(sysconfdir)/ssl.key/server.key"; \
711			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/server.key $(root)$(sysconfdir)/ssl.key/server.key; \
712			if [ -f "$(TOP)/conf/ssl.key/ca.key" ]; then \
713				echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/ca.key $(root)$(sysconfdir)/ssl.key/ca.key"; \
714				$(INSTALL) -m 400 $(TOP)/conf/ssl.key/ca.key $(root)$(sysconfdir)/ssl.key/ca.key; \
715			fi; \
716		else \
717			echo "[PRESERVING EXISTING KEY FILES: $(root)$(sysconfdir)/ssl.key/*]"; \
718		fi; \
719		if [ ! -f "$(root)$(sysconfdir)/ssl.prm/README.PRM" ]; then \
720			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.prm/README.PRM $(root)$(sysconfdir)/ssl.prm/README.PRM"; \
721			$(INSTALL) $(TOP)/conf/ssl.prm/README.PRM $(root)$(sysconfdir)/ssl.prm/README.PRM; \
722			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.prm/snakeoil-ca-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-ca-dsa.prm"; \
723			$(INSTALL) -m 400 $(TOP)/conf/ssl.prm/snakeoil-ca-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-ca-dsa.prm; \
724			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.prm/snakeoil-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-dsa.prm"; \
725			$(INSTALL) -m 400 $(TOP)/conf/ssl.prm/snakeoil-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-dsa.prm; \
726		else \
727			echo "[PRESERVING EXISTING PRM FILES: $(root)$(sysconfdir)/ssl.prm/*]"; \
728		fi; \
729	fi
730	@echo "<=== [config]"
731
732
733## ------------------------------------------------------------------
734##                       Cleanup Targets
735## ------------------------------------------------------------------
736
737#   cleanup the source tree by removing anything which was
738#   created by the build target
739clean:
740	@echo "===> $(SRC)"
741	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) clean-std $(clean-support)
742	@echo "<=== $(SRC)"
743	@$(RM) $(TOP)/$(SRC)/.apaci.build.ok
744
745#   clean the standard stuff
746clean-std:
747	@cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ clean
748
749#   clean additional support stuff
750clean-support:
751	@echo "===> $(SRC)/support"; \
752	cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) clean; \
753	if [ ".$(suexec)" = .1 ]; then \
754		echo "$(RM) suexec"; \
755		$(RM) suexec; \
756	fi; \
757	echo "<=== $(SRC)/support"
758
759#   cleanup the source tree by removing anything which was
760#   created by the configure step and the build target.
761#   When --shadow is used we just remove the complete shadow tree.
762distclean:
763	@if [ ".$(SRC)" = .src ]; then \
764		$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-normal; \
765	else \
766		$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-shadow; \
767	fi
768
769distclean-normal:
770	@echo "===> $(SRC)"
771	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-std $(distclean-support)
772	@echo "<=== $(SRC)"
773	-$(RM) $(SRC)/Configuration.apaci
774	-$(RM) $(SRC)/apaci
775	@$(RM) $(SRC)/.apaci.build.ok
776	-$(RM) Makefile
777	-$(RM) config.status
778
779#   clean the standard stuff
780distclean-std:
781	@cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ distclean
782
783distclean-support:
784	@echo "===> $(SRC)/support"; \
785	cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) distclean; \
786	if [ ".$(suexec)" = .1 ]; then \
787	    echo "$(RM) suexec"; \
788	    $(RM) suexec; \
789	fi; \
790	echo "<=== $(SRC)/support"
791
792distclean-shadow:
793	$(RM) -r $(SRC)
794	$(RM) $(TOP)/$(MKF)
795	-@if [ ".`ls $(TOP)/src.* 2>/dev/null`" = . ]; then \
796		echo "$(RM) Makefile"; \
797		$(RM) Makefile; \
798	fi
799