summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/Makefile.tmpl
blob: e696df7d5ac5a6a5bbdee8724c32231739054f37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
## ====================================================================
## The Apache Software License, Version 1.1
##
## Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
## reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
##
## 1. Redistributions of source code must retain the above copyright
##    notice, this list of conditions and the following disclaimer.
##
## 2. Redistributions in binary form must reproduce the above copyright
##    notice, this list of conditions and the following disclaimer in
##    the documentation and/or other materials provided with the
##    distribution.
##
## 3. The end-user documentation included with the redistribution,
##    if any, must include the following acknowledgment:
##       "This product includes software developed by the
##        Apache Software Foundation (http://www.apache.org/)."
##    Alternately, this acknowledgment may appear in the software itself,
##    if and wherever such third-party acknowledgments normally appear.
##
## 4. The names "Apache" and "Apache Software Foundation" must
##    not be used to endorse or promote products derived from this
##    software without prior written permission. For written
##    permission, please contact apache@apache.org.
##
## 5. Products derived from this software may not be called "Apache",
##    nor may "Apache" appear in their name, without prior written
##    permission of the Apache Software Foundation.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
## DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
## ====================================================================
##
## This software consists of voluntary contributions made by many
## individuals on behalf of the Apache Software Foundation.  For more
## information on the Apache Software Foundation, please see
## <http://www.apache.org/>.
##
## Portions of this software are based upon public domain software
## originally written at the National Center for Supercomputing Applications,
## University of Illinois, Urbana-Champaign.
##
##

##
##  Makefile -- Apache Autoconf-style Interface (APACI)
##              top-level control Makefile for out-of-the-box
##              build and installation procedure.
##
##  Written by Ralf S. Engelschall <rse@apache.org>
##

## ==================================================================
##                              Options
## ==================================================================

#   safe environment
SHELL           = @SHELL@

#   what platform are we on
PLATFORM	= @PLATFORM@

#   paths to the source tree parts
TOP             = .
SRC             = @SRC@
MKF             = @MKF@
AUX             = @AUX@

#   build tools
CP              = cp
LN              = ln
RM              = rm -f
MKDIR           = $(SHELL) $(TOP)/$(AUX)/mkdir.sh
INSTALL         = $(SHELL) $(TOP)/$(AUX)/install.sh -c
IFLAGS_PROGRAM  = @IFLAGS_PROGRAM@
IFLAGS_CORE     = @IFLAGS_CORE@
IFLAGS_DSO      = @IFLAGS_DSO@
IFLAGS_SCRIPT   = @IFLAGS_SCRIPT@
IFLAGS_DATA     = @IFLAGS_DATA@
INSTALL_PROGRAM = $(INSTALL) $(IFLAGS_PROGRAM)
INSTALL_CORE    = $(INSTALL) $(IFLAGS_CORE)
INSTALL_DSO     = $(INSTALL) $(IFLAGS_DSO)
INSTALL_SCRIPT  = $(INSTALL) $(IFLAGS_SCRIPT)
INSTALL_DATA    = $(INSTALL) $(IFLAGS_DATA)
PERL            = @PERL@
TAR		= @TAR@
TAROPT		= @TAROPT@

#   installation name of Apache webserver
TARGET          = @TARGET@

#   installation root 
#   (overrideable by package maintainers for
#   rolling packages without bristling the system)
root            =

#   installation paths
prefix          = @prefix@
exec_prefix     = @exec_prefix@
bindir          = @bindir@
sbindir         = @sbindir@
libexecdir      = @libexecdir@
mandir          = @mandir@
sysconfdir      = @sysconfdir@
datadir         = @datadir@
iconsdir        = @iconsdir@
htdocsdir       = @htdocsdir@
manualdir       = @manualdir@
cgidir          = @cgidir@
includedir      = @includedir@
localstatedir   = @localstatedir@
runtimedir      = @runtimedir@
logfiledir      = @logfiledir@
proxycachedir   = @proxycachedir@

libexecdir_relative   = @libexecdir_relative@

#   suexec details (optional)
suexec          = @suexec@
suexec_caller   = @suexec_caller@
suexec_docroot  = @suexec_docroot@
suexec_logexec  = @suexec_logexec@
suexec_userdir  = @suexec_userdir@
suexec_uidmin   = @suexec_uidmin@
suexec_gidmin   = @suexec_gidmin@
suexec_safepath = @suexec_safepath@
suexec_umask    = @suexec_umask@

#  SSL (optional)
ssl = @ssl@

#   some substituted configuration parameters
conf_user        = @conf_user@
conf_group       = @conf_group@
conf_port        = @conf_port@
conf_port_ssl    = @conf_port_ssl@
conf_serveradmin = @conf_serveradmin@
conf_servername  = @conf_servername@

#   usage of src/support stuff
build-support     = @build_support@
install-support   = @install_support@
clean-support     = @clean_support@
distclean-support = @distclean_support@

#   `make certificate' parameters
TYPE =
ALGO =
CRT  =
KEY  =
VIEW =

#   forwarding arguments
MFWD = root=$(root)

## ==================================================================
##                              Targets
## ==================================================================

#   default target
all: build

## ------------------------------------------------------------------
##                           Build Target
## ------------------------------------------------------------------

#   build the package
build:
	@echo "===> $(SRC)"
	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build-std
	@if [ "x$(build-support)" != "x" ]; then \
	    $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) $(build-support); \
        fi
	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build-certificate
	@touch $(TOP)/$(SRC)/.apaci.build.ok
	@echo "<=== $(SRC)"

#   the non-verbose variant for package maintainers
build-quiet:
	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 build

#   build the standard stuff
build-std:
	@case "x$(PLATFORM)" in \
	  x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
	esac; \
	cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ all

#   build the additional support stuff
build-support:
	@echo "===> $(SRC)/support"; \
	case "x$(PLATFORM)" in \
	  x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
	esac; \
	cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) all || exit 1; \
	if [ ".$(suexec)" = .1 ]; then \
	    $(MAKE) $(MFLAGS) \
		EXTRA_CFLAGS='\
			$(suexec_umask) \
			-DHTTPD_USER=\"$(suexec_caller)\" \
			-DUID_MIN=$(suexec_uidmin) \
			-DGID_MIN=$(suexec_gidmin) \
			-DUSERDIR_SUFFIX=\"$(suexec_userdir)\" \
			-DLOG_EXEC=\"$(suexec_logexec)\" \
			-DDOC_ROOT=\"$(suexec_docroot)\" \
			-DSAFE_PATH=\"$(suexec_safepath)\"' \
		suexec; \
	fi
	@echo "<=== $(SRC)/support"

#   SSL certificate generation
build-certificate:
	-@if [ ".$(ssl)" = .1 ]; then \
		if [ ".`grep '(SKIPME)' $(TOP)/conf/ssl.crt/server.crt`" != . ]; then \
			if [ ".$(QUIET)" != .1 ]; then \
				echo "+---------------------------------------------------------------------+"; \
				echo "| Before you install the package you now should prepare the SSL       |"; \
				echo "| certificate system by running the 'make certificate' command.       |"; \
				echo "| For different situations the following variants are provided:       |"; \
				echo "|                                                                     |"; \
				echo "| % make certificate TYPE=dummy    (dummy self-signed Snake Oil cert) |"; \
				echo "| % make certificate TYPE=test     (test cert signed by Snake Oil CA) |"; \
				echo "| % make certificate TYPE=custom   (custom cert signed by own CA)     |"; \
				echo "| % make certificate TYPE=existing (existing cert)                    |"; \
				echo "|        CRT=/path/to/your.crt [KEY=/path/to/your.key]                |"; \
				echo "|                                                                     |"; \
				echo "| Use TYPE=dummy    when you're a  vendor package maintainer,         |"; \
				echo "| the TYPE=test     when you're an admin but want to do tests only,   |"; \
				echo "| the TYPE=custom   when you're an admin willing to run a real server |"; \
				echo "| and TYPE=existing when you're an admin who upgrades a server.       |"; \
				echo "| (The default is TYPE=test)                                          |"; \
				echo "|                                                                     |"; \
				echo "| Additionally add ALGO=RSA (default) or ALGO=DSA to select           |"; \
				echo "| the signature algorithm used for the generated certificate.         |"; \
				echo "|                                                                     |"; \
				echo "| Use 'make certificate VIEW=1' to display the generated data.        |"; \
				echo "|                                                                     |"; \
				echo "| Thanks for using Apache & mod_ssl.       Ralf S. Engelschall        |"; \
				echo "|                                          rse@engelschall.com        |"; \
				echo "|                                          www.engelschall.com        |"; \
				echo "+---------------------------------------------------------------------+"; \
			fi \
		fi \
	fi

certificate:
	@cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) certificate TYPE="$(TYPE)" ALGO="$(ALGO)" CRT="$(CRT)" KEY="$(KEY)" VIEW="$(VIEW)"

## ------------------------------------------------------------------
##                       Installation Targets
## ------------------------------------------------------------------

#   indirection step to avoid conflict with INSTALL document 
#   on case-insenstive filesystems, for instance on OS/2
install: install-all

#   the install target for installing the complete Apache
#   package. This is implemented by running subtargets for the
#   separate parts of the installation process.
install-all:
	@if [ ! -f $(TOP)/$(SRC)/.apaci.build.ok ]; then \
		$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build; \
	else \
		:; \
	fi
	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) \
		install-mktree install-programs $(install-support) \
		install-include install-data install-config
	-@$(RM) $(SRC)/.apaci.install.tmp
	-@$(RM) $(SRC)/.apaci.install.conf
	-@if [ ".$(QUIET)" != .1 ]; then \
		if [ ".$(TARGET)" = .httpd ]; then \
			apachectl='apachectl'; \
		else \
			apachectl="$(TARGET)ctl"; \
		fi; \
		echo "+--------------------------------------------------------+"; \
		echo "| You now have successfully built and installed the      |"; \
		echo "| Apache 1.3 HTTP server. To verify that Apache actually |"; \
		echo "| works correctly you now should first check the         |"; \
		echo "| (initially created or preserved) configuration files   |"; \
		echo "|                                                        |"; \
		echo "|   $(sysconfdir)/$(TARGET).conf"; \
		echo "|                                                        |"; \
		echo "| and then you should be able to immediately fire up     |"; \
		echo "| Apache the first time by running:                      |"; \
		echo "|                                                        |"; \
		echo "|   $(sbindir)/$${apachectl} start"; \
		echo "|                                                        |"; \
		echo "| Or when you want to run it with SSL enabled use:       |"; \
		echo "|                                                        |"; \
		echo "|   $(sbindir)/$${apachectl} startssl"; \
		echo "|                                                        |"; \
		echo "| Thanks for using Apache.       The Apache Group        |"; \
		echo "|                                http://www.apache.org/  |"; \
		echo "+--------------------------------------------------------+"; \
	fi

#   the non-verbose variant for package maintainers
install-quiet:
	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 install-all

#   create the installation tree
install-mktree:
	@echo "===> [mktree: Creating Apache installation tree]"
	$(MKDIR) $(root)$(bindir)
	$(MKDIR) $(root)$(sbindir)
	$(MKDIR) $(root)$(libexecdir)
	$(MKDIR) $(root)$(mandir)/man1
	$(MKDIR) $(root)$(mandir)/man8
	$(MKDIR) $(root)$(sysconfdir)
	$(MKDIR) $(root)$(sysconfdir)/ssl.crt
	$(MKDIR) $(root)$(sysconfdir)/ssl.crl
	$(MKDIR) $(root)$(sysconfdir)/ssl.csr
	$(MKDIR) $(root)$(sysconfdir)/ssl.key
	$(MKDIR) $(root)$(sysconfdir)/ssl.prm
	$(MKDIR) $(root)$(htdocsdir)
	$(MKDIR) $(root)$(manualdir)
	$(MKDIR) $(root)$(iconsdir)
	$(MKDIR) $(root)$(cgidir)
	$(MKDIR) $(root)$(includedir)
	$(MKDIR) $(root)$(includedir)/xml
	$(MKDIR) $(root)$(runtimedir)
	$(MKDIR) $(root)$(logfiledir)
	$(MKDIR) $(root)$(proxycachedir)
	-@if [ "x`$(SHELL) $(AUX)/getuid.sh`" = "x0" ]; then \
		echo "chown $(conf_user) $(root)$(proxycachedir)"; \
		chown $(conf_user) $(root)$(proxycachedir); \
		echo "chgrp $(conf_group) $(root)$(proxycachedir)"; \
		chgrp "$(conf_group)" $(root)$(proxycachedir); \
	fi
	@echo "<=== [mktree]"

#   install the server program and optionally corresponding
#   shared object files.
install-programs:
	@echo "===> [programs: Installing Apache $(TARGET) program and shared objects]"
	-@if [ ".`grep '^[ 	]*AddModule.*mod_so\.o' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
		echo "$(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
		$(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
		SHLIB_EXPORT_FILES="`grep '^SHLIB_EXPORT_FILES=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
		if [ ".$${SHLIB_EXPORT_FILES}" != . ]; then \
			$(CP) $(TOP)/$(SRC)/support/httpd.exp $(root)$(libexecdir)/; \
			chmod 644 $(root)$(libexecdir)/httpd.exp; \
		fi; \
	else \
		echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
		$(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
	fi
	-@if [ ".`grep 'SUBTARGET=target_shared' $(TOP)/$(SRC)/Makefile`" != . ]; then \
		SHLIB_SUFFIX_NAME="`grep '^SHLIB_SUFFIX_NAME=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
		SHLIB_SUFFIX_LIST="`grep '^SHLIB_SUFFIX_LIST=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
		echo "$(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep"; \
		$(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep; \
		echo "$(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}"; \
		$(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}; \
		if [ ".$${SHLIB_SUFFIX_LIST}" != . ]; then \
			echo "$(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*"; \
			$(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*; \
			for suffix in $${SHLIB_SUFFIX_LIST} ""; do \
				[ ".$${suffix}" = . ] && continue; \
				echo "$(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}"; \
				$(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}; \
			done; \
		fi; \
	fi
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/httpd.8 $(root)$(mandir)/man8/$(TARGET).8
	-@$(RM) $(SRC)/.apaci.install.conf; touch $(SRC)/.apaci.install.conf
	-@if [ ".`grep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
		for mod in `egrep '^[ 	]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci |\
	                sed -e 's/^[ 	]*SharedModule[ 	]*//'`; do \
			file=`echo $${mod} | sed -e 's;^.*/\([^/]*\);\1;'`; \
			echo "$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}"; \
			$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}; \
			name=`$(SHELL) $(TOP)/$(AUX)/fmn.sh $(TOP)/$(SRC)/$${mod}`; \
			if [ ".$$name" = .ssl_module ]; then \
				echo "<IfDefine SSL>" >>$(SRC)/.apaci.install.conf; \
			fi; \
			echo dummy | awk '{ printf("LoadModule %-18s %s\n", modname, modpath); }' \
			modname="$${name}" modpath="$(libexecdir_relative)$${file}" >>$(SRC)/.apaci.install.conf; \
			if [ ".$$name" = .ssl_module ]; then \
				echo "</IfDefine>" >>$(SRC)/.apaci.install.conf; \
			fi; \
		done; \
		echo "" >>$(SRC)/.apaci.install.conf; \
		echo "#  Reconstruction of the complete module list from all available modules" >>$(SRC)/.apaci.install.conf; \
		echo "#  (static and shared ones) to achieve correct module execution order." >>$(SRC)/.apaci.install.conf; \
		echo "#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]" >>$(SRC)/.apaci.install.conf; \
		echo "ClearModuleList" >>$(SRC)/.apaci.install.conf; \
		for mod in `egrep "^[ 	]*(Add|Shared)Module" $(SRC)/Configuration.apaci |\
		            sed	-e 's:[ 	]*SharedModule::' \
		                -e 's:[ 	]*AddModule::' \
		                -e 's:modules/[^/]*/::' \
		                -e 's:[ 	]lib: mod_:' \
		                -e 's:\.[soam]*$$:.c:'`; do \
			if [ ".$$mod" = .mod_ssl.c ]; then \
				echo "<IfDefine SSL>" >>$(SRC)/.apaci.install.conf; \
			fi; \
			echo "AddModule $$mod" >>$(SRC)/.apaci.install.conf; \
			if [ ".$$mod" = .mod_ssl.c ]; then \
				echo "</IfDefine>" >>$(SRC)/.apaci.install.conf; \
			fi; \
		done; \
	fi
	@echo "<=== [programs]"

#   install the support programs and scripts
install-support:
	@echo "===> [support: Installing Apache support programs and scripts]"
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
	@if [ ".$(TARGET)" = .httpd ]; then \
		apachectl='apachectl'; \
	else \
		apachectl="$(TARGET)ctl"; \
	fi; \
	echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
	sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
		-e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
		< $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
	echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/checkgid $(root)$(bindir)/checkgid
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
	sed -e 's;^#!/.*;#!$(PERL);' \
		< $(TOP)/$(SRC)/support/dbmmanage > $(TOP)/$(SRC)/.apaci.install.tmp && \
		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(bindir)/dbmmanage
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
	sed -e 's;^#!/.*;#!$(PERL);' \
		-e 's;\@prefix\@;$(prefix);' \
		-e 's;\@sbindir\@;$(sbindir);' \
		-e 's;\@libexecdir\@;$(libexecdir);' \
		-e 's;\@includedir\@;$(includedir);' \
		-e 's;\@sysconfdir\@;$(sysconfdir);' \
		< $(TOP)/$(SRC)/support/apxs > $(TOP)/$(SRC)/.apaci.install.tmp && \
		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/apxs
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
	-@if [ ".$(suexec)" = .1 ]; then \
	    echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
	    $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
	    echo "chown root $(root)$(sbindir)/suexec"; \
	    chown root $(root)$(sbindir)/suexec; \
	    echo "chmod 4711 $(root)$(sbindir)/suexec"; \
	    chmod 4711 $(root)$(sbindir)/suexec; \
	    echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
	    $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
	fi
	@echo "<=== [support]"

#   install the support programs and scripts for binary distribution
install-binsupport:
	@echo "===> [support: Installing Apache support programs and scripts for binary distribution]"
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
	@if [ ".$(TARGET)" = .httpd ]; then \
		apachectl='apachectl'; \
	else \
		apachectl="$(TARGET)ctl"; \
	fi; \
	echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
	sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
		-e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
		< $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
		$(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
	echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/checkgid $(root)$(bindir)/checkgid
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
	$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage $(root)$(bindir)/dbmmanage
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
	$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
	@echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
	$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs $(root)$(sbindir)/apxs
	$(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
	-@if [ ".$(suexec)" = .1 ]; then \
	    echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
	    $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
	    echo "chown root $(root)$(sbindir)/suexec"; \
	    chown root $(root)$(sbindir)/suexec; \
	    echo "chmod 4711 $(root)$(sbindir)/suexec"; \
	    chmod 4711 $(root)$(sbindir)/suexec; \
	    echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
	    $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
	fi
	@echo "<=== [support]"

#   install the Apache C header files
install-include:
	@echo "===> [include: Installing Apache C header files]"
	$(CP) $(TOP)/$(SRC)/include/*.h $(root)$(includedir)/
	$(CP) $(TOP)/$(SRC)/lib/expat-lite/*.h $(root)$(includedir)/xml/
	@osdir=`grep '^OSDIR=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^OSDIR=.*/os/:os/:'`; \
		echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/"; \
		$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/; \
		echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/"; \
		$(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/
	chmod 644 $(root)$(includedir)/*.h $(root)$(includedir)/xml/*.h
	@echo "<=== [include]"

#   create an initial document root containing the Apache manual,
#   icons and distributed CGI scripts.
install-data:
	@echo "===> [data: Installing initial data files]"
	-@if [ -f $(root)$(htdocsdir)/index.html ] || [ -f $(root)$(htdocsdir)/index.html.en ]; then \
		echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(htdocsdir)/]"; \
	else \
		echo "Copying tree $(TOP)/htdocs/ -> $(root)$(htdocsdir)/"; \
		(cd $(TOP)/htdocs/ && $(TAR) $(TAROPT) - index* apache_pb.* ) |\
		(cd $(root)$(htdocsdir)/ && $(TAR) -xf -); \
		find $(root)$(htdocsdir)/ -type d -exec chmod a+rx {} \; ; \
		find $(root)$(htdocsdir)/ -type f -print | xargs chmod a+r ; \
	fi
	-@if [ -d $(TOP)/htdocs/manual ]; then \
		echo "Copying tree $(TOP)/htdocs/manual -> $(root)/$(manualdir)/"; \
		(cd $(TOP)/htdocs/manual/ && $(TAR) $(TAROPT) - *) |\
		(cd $(root)$(manualdir)/ && $(TAR) -xf -); \
		find $(root)$(manualdir)/ -type d -exec chmod a+rx {} \; ; \
		find $(root)$(manualdir)/ -type f -print | xargs chmod a+r ; \
	fi
	-@if [ -f $(root)$(cgidir)/printenv ]; then \
		echo "[PRESERVING EXISTING CGI SUBDIR: $(root)$(cgidir)/]"; \
	else \
		for script in printenv test-cgi; do \
			cat $(TOP)/cgi-bin/$${script} |\
			sed -e 's;^#!/.*perl;#!$(PERL);' \
			> $(TOP)/$(SRC)/.apaci.install.tmp; \
			echo "$(INSTALL_DATA) $(TOP)/conf/$${script}[*] $(root)$(cgidir)/$${script}"; \
			$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(cgidir)/$${script}; \
		done; \
	fi
	@echo "Copying tree $(TOP)/icons/ -> $(root)$(iconsdir)/"; \
	(cd $(TOP)/icons/ && $(TAR) $(TAROPT) - *) |\
	(cd $(root)$(iconsdir)/ && $(TAR) -xf -); \
	find $(root)$(iconsdir)/ -type d -exec chmod a+rx {} \; ;\
	find $(root)$(iconsdir)/ -type f -exec chmod a+r {} \;
	@echo "<=== [data]"

#   create the initial configuration by providing default files
#   and initial config files while preserving existing ones.
install-config:
	@echo "===> [config: Installing Apache configuration files]"
	-@for conf in httpd.conf access.conf srm.conf; do \
		if [ .$$conf = .httpd.conf ]; then \
			target_conf="$(TARGET).conf"; \
		else \
			target_conf="$$conf"; \
		fi; \
		if [ ".$(TARGET)" = .httpd ]; then \
			target_prefix=""; \
		else \
			target_prefix="$(TARGET)_"; \
		fi; \
		(echo "##"; \
		 echo "## $${target_conf} -- Apache HTTP server configuration file"; \
		 echo "##"; \
		 echo ""; \
		 cat $(TOP)/conf/$${conf}-dist ) |\
		 sed -e '/# LoadModule/r $(TOP)/$(SRC)/.apaci.install.conf' \
			-e "s;logs/ssl_mutex;$(runtimedir)/$${target_prefix}ssl_mutex;" \
			-e "s;logs/ssl_scache;$(runtimedir)/$${target_prefix}ssl_scache;" \
			-e "s;logs/ssl_engine_log;$(logfiledir)/$${target_prefix}ssl_engine_log;" \
			-e "s;logs/ssl_request_log;$(logfiledir)/$${target_prefix}ssl_request_log;" \
			-e 's;@@ServerRoot@@/conf/ssl.crt;$(sysconfdir)/ssl.crt;' \
			-e 's;@@ServerRoot@@/conf/ssl.crl;$(sysconfdir)/ssl.crl;' \
			-e 's;@@ServerRoot@@/conf/ssl.csr;$(sysconfdir)/ssl.csr;' \
			-e 's;@@ServerRoot@@/conf/ssl.key;$(sysconfdir)/ssl.key;' \
			-e 's;@@ServerRoot@@/conf/ssl.prm;$(sysconfdir)/ssl.prm;' \
			-e 's;@@ServerRoot@@/htdocs/manual;$(manualdir);' \
			-e 's;@@ServerRoot@@/htdocs;$(htdocsdir);' \
			-e 's;@@ServerRoot@@/icons;$(iconsdir);' \
			-e 's;@@ServerRoot@@/cgi-bin;$(cgidir);' \
			-e 's;@@ServerRoot@@/proxy;$(proxycachedir);' \
			-e 's;@@ServerRoot@@;$(prefix);g' \
			-e 's;httpd\.conf;$(TARGET).conf;' \
			-e 's;logs/accept\.lock;$(runtimedir)/$(TARGET).lock;' \
			-e 's;logs/apache_runtime_status;$(runtimedir)/$(TARGET).scoreboard;' \
			-e 's;logs/httpd\.pid;$(runtimedir)/$(TARGET).pid;' \
			-e "s;logs/access_log;$(logfiledir)/$${target_prefix}access_log;" \
			-e "s;logs/error_log;$(logfiledir)/$${target_prefix}error_log;" \
			-e "s;logs/referer_log;$(logfiledir)/$${target_prefix}referer_log;" \
			-e "s;logs/agent_log;$(logfiledir)/$${target_prefix}agent_log;" \
			-e 's;conf/magic;$(sysconfdir)/magic;' \
			-e 's;conf/mime\.types;$(sysconfdir)/mime.types;' \
			-e 's;User nobody;User $(conf_user);' \
			-e 's;Group #-1;Group $(conf_group);' \
			-e 's;Group "#-1";Group $(conf_group);' \
			-e 's;Port 80;Port $(conf_port);' \
			-e 's;Listen 80;Listen $(conf_port);' \
			-e 's;Listen 443;Listen $(conf_port_ssl);' \
			-e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
			-e 's;ServerName new.host.name;ServerName $(conf_servername);' \
			-e 's;VirtualHost _default_:443;VirtualHost _default_:$(conf_port_ssl);' \
        	> $(TOP)/$(SRC)/.apaci.install.tmp && \
		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}.default"; \
		$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}.default; \
		if [ ! -f "$(root)$(sysconfdir)/$${target_conf}" ]; then \
			echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}"; \
			$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}; \
		else \
			echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${target_conf}]"; \
		fi; \
	done
	-@for conf in mime.types magic; do \
		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default"; \
		$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default; \
		if [ ! -f "$(root)$(sysconfdir)/$${conf}" ]; then \
			echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}"; \
			$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}; \
		else \
			echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${conf}]"; \
		fi; \
	done
	-@if [ ".$(ssl)" = .1 ]; then \
		echo "chmod 755 $(root)$(sysconfdir)/ssl.crt"; \
		chmod 755 $(root)$(sysconfdir)/ssl.crt; \
		echo "chmod 755 $(root)$(sysconfdir)/ssl.crl"; \
		chmod 755 $(root)$(sysconfdir)/ssl.crl; \
		echo "chmod 755 $(root)$(sysconfdir)/ssl.csr"; \
		chmod 755 $(root)$(sysconfdir)/ssl.csr; \
		echo "chmod 700 $(root)$(sysconfdir)/ssl.key"; \
		chmod 700 $(root)$(sysconfdir)/ssl.key; \
		echo "chmod 755 $(root)$(sysconfdir)/ssl.prm"; \
		chmod 755 $(root)$(sysconfdir)/ssl.prm; \
		if [ ! -f "$(root)$(sysconfdir)/ssl.crt/README.CRT" ]; then \
			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crt/README.CRT $(root)$(sysconfdir)/ssl.crt/README.CRT"; \
			$(INSTALL) $(TOP)/conf/ssl.crt/README.CRT $(root)$(sysconfdir)/ssl.crt/README.CRT; \
			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crt/Makefile $(root)$(sysconfdir)/ssl.crt/Makefile"; \
			$(INSTALL) $(TOP)/conf/ssl.crt/Makefile $(root)$(sysconfdir)/ssl.crt/Makefile; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/ca-bundle.crt $(root)$(sysconfdir)/ssl.crt/ca-bundle.crt"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/ca-bundle.crt $(root)$(sysconfdir)/ssl.crt/ca-bundle.crt; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-rsa.crt"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-rsa.crt; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-dsa.crt"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-ca-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-ca-dsa.crt; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-rsa.crt"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-rsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-rsa.crt; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/snakeoil-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-dsa.crt"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/snakeoil-dsa.crt $(root)$(sysconfdir)/ssl.crt/snakeoil-dsa.crt; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/server.crt $(root)$(sysconfdir)/ssl.crt/server.crt"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/server.crt $(root)$(sysconfdir)/ssl.crt/server.crt; \
			if [ -f "$(TOP)/conf/ssl.crt/ca.crt" ]; then \
				echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.crt/ca.crt $(root)$(sysconfdir)/ssl.crt/ca.crt"; \
				$(INSTALL) -m 400 $(TOP)/conf/ssl.crt/ca.crt $(root)$(sysconfdir)/ssl.crt/ca.crt; \
			fi; \
		else \
			echo "[PRESERVING EXISTING CERTIFICATE FILES: $(root)$(sysconfdir)/ssl.crt/*]"; \
		fi; \
		echo "Updating hash symlinks in $(root)$(sysconfdir)/ssl.crt/:"; \
		SSL_PROGRAM="`grep '^SSL_PROGRAM=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^.*=::'`"; \
		(cd $(root)$(sysconfdir)/ssl.crt/ && $(MAKE) $(MFLAGS) SSL_PROGRAM=$$SSL_PROGRAM); \
		if [ ! -f "$(root)$(sysconfdir)/ssl.csr/README.CSR" ]; then \
			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.csr/README.CSR $(root)$(sysconfdir)/ssl.csr/README.CSR"; \
			$(INSTALL) $(TOP)/conf/ssl.csr/README.CSR $(root)$(sysconfdir)/ssl.csr/README.CSR; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.csr/server.csr $(root)$(sysconfdir)/ssl.csr/server.csr"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.csr/server.csr $(root)$(sysconfdir)/ssl.csr/server.csr; \
		else \
			echo "[PRESERVING EXISTING CSR FILES: $(root)$(sysconfdir)/ssl.csr/*]"; \
		fi; \
		if [ ! -f "$(root)$(sysconfdir)/ssl.crl/README.CRL" ]; then \
			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crl/README.CRL $(root)$(sysconfdir)/ssl.crl/README.CRL"; \
			$(INSTALL) $(TOP)/conf/ssl.crl/README.CRL $(root)$(sysconfdir)/ssl.crl/README.CRL; \
			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.crl/Makefile $(root)$(sysconfdir)/ssl.crl/Makefile"; \
			$(INSTALL) $(TOP)/conf/ssl.crl/Makefile $(root)$(sysconfdir)/ssl.crl/Makefile; \
		else \
			echo "[PRESERVING EXISTING CRL FILES: $(root)$(sysconfdir)/ssl.crl/*]"; \
		fi; \
		if [ ! -f "$(root)$(sysconfdir)/ssl.key/README.KEY" ]; then \
			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.key/README.KEY $(root)$(sysconfdir)/ssl.key/README.KEY"; \
			$(INSTALL) $(TOP)/conf/ssl.key/README.KEY $(root)$(sysconfdir)/ssl.key/README.KEY; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-rsa.key"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-rsa.key; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-dsa.key"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-ca-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-ca-dsa.key; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-rsa.key"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-rsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-rsa.key; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/snakeoil-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-dsa.key"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/snakeoil-dsa.key $(root)$(sysconfdir)/ssl.key/snakeoil-dsa.key; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/server.key $(root)$(sysconfdir)/ssl.key/server.key"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.key/server.key $(root)$(sysconfdir)/ssl.key/server.key; \
			if [ -f "$(TOP)/conf/ssl.key/ca.key" ]; then \
				echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.key/ca.key $(root)$(sysconfdir)/ssl.key/ca.key"; \
				$(INSTALL) -m 400 $(TOP)/conf/ssl.key/ca.key $(root)$(sysconfdir)/ssl.key/ca.key; \
			fi; \
		else \
			echo "[PRESERVING EXISTING KEY FILES: $(root)$(sysconfdir)/ssl.key/*]"; \
		fi; \
		if [ ! -f "$(root)$(sysconfdir)/ssl.prm/README.PRM" ]; then \
			echo "$(INSTALL_DATA) $(TOP)/conf/ssl.prm/README.PRM $(root)$(sysconfdir)/ssl.prm/README.PRM"; \
			$(INSTALL) $(TOP)/conf/ssl.prm/README.PRM $(root)$(sysconfdir)/ssl.prm/README.PRM; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.prm/snakeoil-ca-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-ca-dsa.prm"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.prm/snakeoil-ca-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-ca-dsa.prm; \
			echo "$(INSTALL_DATA) -m 400 $(TOP)/conf/ssl.prm/snakeoil-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-dsa.prm"; \
			$(INSTALL) -m 400 $(TOP)/conf/ssl.prm/snakeoil-dsa.prm $(root)$(sysconfdir)/ssl.prm/snakeoil-dsa.prm; \
		else \
			echo "[PRESERVING EXISTING PRM FILES: $(root)$(sysconfdir)/ssl.prm/*]"; \
		fi; \
	fi
	@echo "<=== [config]"


## ------------------------------------------------------------------
##                       Cleanup Targets
## ------------------------------------------------------------------

#   cleanup the source tree by removing anything which was
#   created by the build target
clean:
	@echo "===> $(SRC)"
	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) clean-std $(clean-support)
	@echo "<=== $(SRC)"
	@$(RM) $(TOP)/$(SRC)/.apaci.build.ok

#   clean the standard stuff
clean-std:
	@cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ clean

#   clean additional support stuff
clean-support:
	@echo "===> $(SRC)/support"; \
	cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) clean; \
	if [ ".$(suexec)" = .1 ]; then \
		echo "$(RM) suexec"; \
		$(RM) suexec; \
	fi; \
	echo "<=== $(SRC)/support"

#   cleanup the source tree by removing anything which was
#   created by the configure step and the build target.
#   When --shadow is used we just remove the complete shadow tree.
distclean:
	@if [ ".$(SRC)" = .src ]; then \
		$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-normal; \
	else \
		$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-shadow; \
	fi

distclean-normal:
	@echo "===> $(SRC)"
	@$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-std $(distclean-support)
	@echo "<=== $(SRC)"
	-$(RM) $(SRC)/Configuration.apaci
	-$(RM) $(SRC)/apaci
	@$(RM) $(SRC)/.apaci.build.ok
	-$(RM) Makefile
	-$(RM) config.status

#   clean the standard stuff
distclean-std:
	@cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ distclean

distclean-support:
	@echo "===> $(SRC)/support"; \
	cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) distclean; \
	if [ ".$(suexec)" = .1 ]; then \
	    echo "$(RM) suexec"; \
	    $(RM) suexec; \
	fi; \
	echo "<=== $(SRC)/support"

distclean-shadow:
	$(RM) -r $(SRC)
	$(RM) $(TOP)/$(MKF)
	-@if [ ".`ls $(TOP)/src.* 2>/dev/null`" = . ]; then \
		echo "$(RM) Makefile"; \
		$(RM) Makefile; \
	fi