home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / apac1319.zip / Makefile.tmpl < prev    next >
Makefile  |  2001-01-15  |  27KB  |  616 lines

  1. ## ====================================================================
  2. ## The Apache Software License, Version 1.1
  3. ##
  4. ## Copyright (c) 2000 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
  73. SHELL           = @SHELL@
  74.  
  75. #   what platform are we on
  76. PLATFORM    = @PLATFORM@
  77.  
  78. #   paths to the source tree parts
  79. TOP             = .
  80. SRC             = @SRC@
  81. MKF             = @MKF@
  82. AUX             = @AUX@
  83.  
  84. #   build tools
  85. CP              = cp
  86. LN              = ln
  87. RM              = rm -f
  88. MKDIR           = $(TOP)/$(AUX)/mkdir.sh
  89. INSTALL         = $(TOP)/$(AUX)/install.sh -c
  90. IFLAGS_PROGRAM  = @IFLAGS_PROGRAM@
  91. IFLAGS_CORE     = @IFLAGS_CORE@
  92. IFLAGS_DSO      = @IFLAGS_DSO@
  93. IFLAGS_SCRIPT   = @IFLAGS_SCRIPT@
  94. IFLAGS_DATA     = @IFLAGS_DATA@
  95. INSTALL_PROGRAM = $(INSTALL) $(IFLAGS_PROGRAM)
  96. INSTALL_CORE    = $(INSTALL) $(IFLAGS_CORE)
  97. INSTALL_DSO     = $(INSTALL) $(IFLAGS_DSO)
  98. INSTALL_SCRIPT  = $(INSTALL) $(IFLAGS_SCRIPT)
  99. INSTALL_DATA    = $(INSTALL) $(IFLAGS_DATA)
  100. PERL            = @PERL@
  101. TAR        = @TAR@
  102. TAROPT        = @TAROPT@
  103.  
  104. #   installation name of Apache webserver
  105. TARGET          = @TARGET@
  106.  
  107. #   installation root 
  108. #   (overrideable by package maintainers for
  109. #   rolling packages without bristling the system)
  110. root            =
  111.  
  112. #   installation paths
  113. prefix          = @prefix@
  114. exec_prefix     = @exec_prefix@
  115. bindir          = @bindir@
  116. sbindir         = @sbindir@
  117. libexecdir      = @libexecdir@
  118. mandir          = @mandir@
  119. sysconfdir      = @sysconfdir@
  120. datadir         = @datadir@
  121. iconsdir        = @iconsdir@
  122. htdocsdir       = @htdocsdir@
  123. cgidir          = @cgidir@
  124. includedir      = @includedir@
  125. localstatedir   = @localstatedir@
  126. runtimedir      = @runtimedir@
  127. logfiledir      = @logfiledir@
  128. proxycachedir   = @proxycachedir@
  129.  
  130. libexecdir_relative   = @libexecdir_relative@
  131.  
  132. #   suexec details (optional)
  133. suexec          = @suexec@
  134. suexec_caller   = @suexec_caller@
  135. suexec_docroot  = @suexec_docroot@
  136. suexec_logexec  = @suexec_logexec@
  137. suexec_userdir  = @suexec_userdir@
  138. suexec_uidmin   = @suexec_uidmin@
  139. suexec_gidmin   = @suexec_gidmin@
  140. suexec_safepath = @suexec_safepath@
  141. suexec_umask    = @suexec_umask@
  142.  
  143. #   some substituted configuration parameters
  144. conf_user        = @conf_user@
  145. conf_group       = @conf_group@
  146. conf_port        = @conf_port@
  147. conf_serveradmin = @conf_serveradmin@
  148. conf_servername  = @conf_servername@
  149.  
  150. #   usage of src/support stuff
  151. build-support     = @build_support@
  152. install-support   = @install_support@
  153. clean-support     = @clean_support@
  154. distclean-support = @distclean_support@
  155.  
  156. #   forwarding arguments
  157. MFWD = root=$(root)
  158.  
  159. ## ==================================================================
  160. ##                              Targets
  161. ## ==================================================================
  162.  
  163. #   default target
  164. all: build
  165.  
  166. ## ------------------------------------------------------------------
  167. ##                           Build Target
  168. ## ------------------------------------------------------------------
  169.  
  170. #   build the package
  171. build:
  172.     @echo "===> $(SRC)"
  173.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build-std
  174.     @if [ "x$(build-support)" != "x" ]; then \
  175.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) $(build-support); \
  176.         fi
  177.     @touch $(TOP)/$(SRC)/.apaci.build.ok
  178.     @echo "<=== $(SRC)"
  179.  
  180. #   the non-verbose variant for package maintainers
  181. build-quiet:
  182.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 build
  183.  
  184. #   build the standard stuff
  185. build-std:
  186.     @case "x$(PLATFORM)" in \
  187.       x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
  188.     esac; \
  189.     cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ all
  190.  
  191. #   build the additional support stuff
  192. build-support:
  193.     @echo "===> $(SRC)/support"; \
  194.     case "x$(PLATFORM)" in \
  195.       x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
  196.     esac; \
  197.     cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) all || exit 1; \
  198.     if [ ".$(suexec)" = .1 ]; then \
  199.         $(MAKE) $(MFLAGS) \
  200.         EXTRA_CFLAGS='\
  201.             $(suexec_umask) \
  202.             -DHTTPD_USER=\"$(suexec_caller)\" \
  203.             -DUID_MIN=$(suexec_uidmin) \
  204.             -DGID_MIN=$(suexec_gidmin) \
  205.             -DUSERDIR_SUFFIX=\"$(suexec_userdir)\" \
  206.             -DLOG_EXEC=\"$(suexec_logexec)\" \
  207.             -DDOC_ROOT=\"$(suexec_docroot)\" \
  208.             -DSAFE_PATH=\"$(suexec_safepath)\"' \
  209.         suexec; \
  210.     fi
  211.     @echo "<=== $(SRC)/support"
  212.  
  213. ## ------------------------------------------------------------------
  214. ##                       Installation Targets
  215. ## ------------------------------------------------------------------
  216.  
  217. #   indirection step to avoid conflict with INSTALL document 
  218. #   on case-insenstive filesystems, for instance on OS/2
  219. install: install-all
  220.  
  221. #   the install target for installing the complete Apache
  222. #   package. This is implemented by running subtargets for the
  223. #   separate parts of the installation process.
  224. install-all:
  225.     @if [ ! -f $(TOP)/$(SRC)/.apaci.build.ok ]; then \
  226.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build; \
  227.     else \
  228.         :; \
  229.     fi
  230.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) \
  231.         install-mktree install-programs $(install-support) \
  232.         install-include install-data install-config
  233.     -@$(RM) $(SRC)/.apaci.install.tmp
  234.     -@$(RM) $(SRC)/.apaci.install.conf
  235.     -@if [ ".$(QUIET)" != .1 ]; then \
  236.         if [ ".$(TARGET)" = .httpd ]; then \
  237.             apachectl='apachectl'; \
  238.         else \
  239.             apachectl="$(TARGET)ctl"; \
  240.         fi; \
  241.         echo "+--------------------------------------------------------+"; \
  242.         echo "| You now have successfully built and installed the      |"; \
  243.         echo "| Apache 1.3 HTTP server. To verify that Apache actually |"; \
  244.         echo "| works correctly you now should first check the         |"; \
  245.         echo "| (initially created or preserved) configuration files   |"; \
  246.         echo "|                                                        |"; \
  247.         echo "|   $(sysconfdir)/$(TARGET).conf"; \
  248.         echo "|                                                        |"; \
  249.         echo "| and then you should be able to immediately fire up     |"; \
  250.         echo "| Apache the first time by running:                      |"; \
  251.         echo "|                                                        |"; \
  252.         echo "|   $(sbindir)/$${apachectl} start"; \
  253.         echo "|                                                        |"; \
  254.         echo "| Thanks for using Apache.       The Apache Group        |"; \
  255.         echo "|                                http://www.apache.org/  |"; \
  256.         echo "+--------------------------------------------------------+"; \
  257.     fi
  258.  
  259. #   the non-verbose variant for package maintainers
  260. install-quiet:
  261.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 install-all
  262.  
  263. #   create the installation tree
  264. install-mktree:
  265.     @echo "===> [mktree: Creating Apache installation tree]"
  266.     $(MKDIR) $(root)$(bindir)
  267.     $(MKDIR) $(root)$(sbindir)
  268.     $(MKDIR) $(root)$(libexecdir)
  269.     $(MKDIR) $(root)$(mandir)/man1
  270.     $(MKDIR) $(root)$(mandir)/man8
  271.     $(MKDIR) $(root)$(sysconfdir)
  272.     $(MKDIR) $(root)$(htdocsdir)
  273.     $(MKDIR) $(root)$(iconsdir)
  274.     $(MKDIR) $(root)$(cgidir)
  275.     $(MKDIR) $(root)$(includedir)
  276.     $(MKDIR) $(root)$(includedir)/xml
  277.     $(MKDIR) $(root)$(runtimedir)
  278.     $(MKDIR) $(root)$(logfiledir)
  279.     $(MKDIR) $(root)$(proxycachedir)
  280.     -@if [ "x`$(AUX)/getuid.sh`" = "x0" ]; then \
  281.         echo "chown $(conf_user) $(root)$(proxycachedir)"; \
  282.         chown $(conf_user) $(root)$(proxycachedir); \
  283.         echo "chgrp $(conf_group) $(root)$(proxycachedir)"; \
  284.         chgrp "$(conf_group)" $(root)$(proxycachedir); \
  285.     fi
  286.     @echo "<=== [mktree]"
  287.  
  288. #   install the server program and optionally corresponding
  289. #   shared object files.
  290. install-programs:
  291.     @echo "===> [programs: Installing Apache $(TARGET) program and shared objects]"
  292.     -@if [ ".`grep '^[     ]*AddModule.*mod_so\.o' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
  293.         echo "$(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
  294.         $(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
  295.         SHLIB_EXPORT_FILES="`grep '^SHLIB_EXPORT_FILES=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
  296.         if [ ".$${SHLIB_EXPORT_FILES}" != . ]; then \
  297.             $(CP) $(TOP)/$(SRC)/support/httpd.exp $(root)$(libexecdir)/; \
  298.             chmod 644 $(root)$(libexecdir)/httpd.exp; \
  299.         fi; \
  300.     else \
  301.         echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
  302.         $(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
  303.     fi
  304.     -@if [ ".`grep 'SUBTARGET=target_shared' $(TOP)/$(SRC)/Makefile`" != . ]; then \
  305.         SHLIB_SUFFIX_NAME="`grep '^SHLIB_SUFFIX_NAME=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
  306.         SHLIB_SUFFIX_LIST="`grep '^SHLIB_SUFFIX_LIST=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
  307.         echo "$(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep"; \
  308.         $(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep; \
  309.         echo "$(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}"; \
  310.         $(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}; \
  311.         if [ ".$${SHLIB_SUFFIX_LIST}" != . ]; then \
  312.             echo "$(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*"; \
  313.             $(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*; \
  314.             for suffix in $${SHLIB_SUFFIX_LIST} ""; do \
  315.                 [ ".$${suffix}" = . ] && continue; \
  316.                 echo "$(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}"; \
  317.                 $(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}; \
  318.             done; \
  319.         fi; \
  320.     fi
  321.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/httpd.8 $(root)$(mandir)/man8/$(TARGET).8
  322.     -@$(RM) $(SRC)/.apaci.install.conf; touch $(SRC)/.apaci.install.conf
  323.     -@if [ ".`grep '^[     ]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
  324.         for mod in `egrep '^[     ]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci |\
  325.                     sed -e 's/^[     ]*SharedModule[     ]*//'`; do \
  326.             file=`echo $${mod} | sed -e 's;^.*/\([^/]*\);\1;'`; \
  327.             echo "$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}"; \
  328.             $(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}; \
  329.             name=`$(TOP)/$(AUX)/fmn.sh $(TOP)/$(SRC)/$${mod}`; \
  330.             echo dummy | awk '{ printf("LoadModule %-18s %s\n", modname, modpath); }' \
  331.             modname="$${name}" modpath="$(libexecdir_relative)$${file}" >>$(SRC)/.apaci.install.conf; \
  332.         done; \
  333.         echo "" >>$(SRC)/.apaci.install.conf; \
  334.         echo "#  Reconstruction of the complete module list from all available modules" >>$(SRC)/.apaci.install.conf; \
  335.         echo "#  (static and shared ones) to achieve correct module execution order." >>$(SRC)/.apaci.install.conf; \
  336.         echo "#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]" >>$(SRC)/.apaci.install.conf; \
  337.         echo "ClearModuleList" >>$(SRC)/.apaci.install.conf; \
  338.         egrep "^[     ]*(Add|Shared)Module" $(SRC)/Configuration.apaci |\
  339.         sed    -e 's:SharedModule:AddModule:' \
  340.             -e 's:modules/[^/]*/::' \
  341.             -e 's:[     ]lib: mod_:' \
  342.             -e 's:\.[soam].*$$:.c:' >>$(SRC)/.apaci.install.conf; \
  343.     fi
  344.     @echo "<=== [programs]"
  345.  
  346. #   install the support programs and scripts
  347. install-support:
  348.     @echo "===> [support: Installing Apache support programs and scripts]"
  349.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
  350.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
  351.     @if [ ".$(TARGET)" = .httpd ]; then \
  352.         apachectl='apachectl'; \
  353.     else \
  354.         apachectl="$(TARGET)ctl"; \
  355.     fi; \
  356.     echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
  357.     sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
  358.         -e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
  359.         < $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
  360.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
  361.     echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
  362.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
  363.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
  364.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
  365.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
  366.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
  367.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
  368.     sed -e 's;^#!/.*;#!$(PERL);' \
  369.         < $(TOP)/$(SRC)/support/dbmmanage > $(TOP)/$(SRC)/.apaci.install.tmp && \
  370.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(bindir)/dbmmanage
  371.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
  372.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
  373.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
  374.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
  375.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
  376.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
  377.     sed -e 's;^#!/.*;#!$(PERL);' \
  378.         -e 's;\@prefix\@;$(prefix);' \
  379.         -e 's;\@sbindir\@;$(sbindir);' \
  380.         -e 's;\@libexecdir\@;$(libexecdir);' \
  381.         -e 's;\@includedir\@;$(includedir);' \
  382.         -e 's;\@sysconfdir\@;$(sysconfdir);' \
  383.         < $(TOP)/$(SRC)/support/apxs > $(TOP)/$(SRC)/.apaci.install.tmp && \
  384.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/apxs
  385.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
  386.     -@if [ ".$(suexec)" = .1 ]; then \
  387.         echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
  388.         $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
  389.         echo "chown root $(root)$(sbindir)/suexec"; \
  390.         chown root $(root)$(sbindir)/suexec; \
  391.         echo "chmod 4711 $(root)$(sbindir)/suexec"; \
  392.         chmod 4711 $(root)$(sbindir)/suexec; \
  393.         echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
  394.         $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
  395.     fi
  396.     @echo "<=== [support]"
  397.  
  398. #   install the support programs and scripts for binary distribution
  399. install-binsupport:
  400.     @echo "===> [support: Installing Apache support programs and scripts for binary distribution]"
  401.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
  402.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
  403.     @if [ ".$(TARGET)" = .httpd ]; then \
  404.         apachectl='apachectl'; \
  405.     else \
  406.         apachectl="$(TARGET)ctl"; \
  407.     fi; \
  408.     echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
  409.     sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
  410.         -e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
  411.         < $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
  412.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
  413.     echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
  414.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
  415.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
  416.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
  417.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
  418.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
  419.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
  420.     $(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage $(root)$(bindir)/dbmmanage
  421.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
  422.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
  423.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
  424.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
  425.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
  426.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
  427.     $(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs $(root)$(sbindir)/apxs
  428.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
  429.     -@if [ ".$(suexec)" = .1 ]; then \
  430.         echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
  431.         $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
  432.         echo "chown root $(root)$(sbindir)/suexec"; \
  433.         chown root $(root)$(sbindir)/suexec; \
  434.         echo "chmod 4711 $(root)$(sbindir)/suexec"; \
  435.         chmod 4711 $(root)$(sbindir)/suexec; \
  436.         echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
  437.         $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
  438.     fi
  439.     @echo "<=== [support]"
  440.  
  441. #   install the Apache C header files
  442. install-include:
  443.     @echo "===> [include: Installing Apache C header files]"
  444.     $(CP) $(TOP)/$(SRC)/include/*.h $(root)$(includedir)/
  445.     $(CP) $(TOP)/$(SRC)/lib/expat-lite/*.h $(root)$(includedir)/xml/
  446.     @osdir=`grep '^OSDIR=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^OSDIR=.*/os/:os/:'`; \
  447.         echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/"; \
  448.         $(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/; \
  449.         echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/"; \
  450.         $(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/
  451.     chmod 644 $(root)$(includedir)/*.h $(root)$(includedir)/xml/*.h
  452.     @echo "<=== [include]"
  453.  
  454. #   create an initial document root containing the Apache manual,
  455. #   icons and distributed CGI scripts.
  456. install-data:
  457.     @echo "===> [data: Installing initial data files]"
  458.     -@if [ -f $(root)$(htdocsdir)/index.html ] || [ -f $(root)$(htdocsdir)/index.html.en ]; then \
  459.         echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(htdocsdir)/]"; \
  460.     else \
  461.         echo "Copying tree $(TOP)/htdocs/ -> $(root)$(htdocsdir)/"; \
  462.         (cd $(TOP)/htdocs/ && $(TAR) $(TAROPT) - *) |\
  463.         (cd $(root)$(htdocsdir)/ && $(TAR) -xf -); \
  464.         find $(root)$(htdocsdir)/ -type d -exec chmod a+rx {} \; ; \
  465.         find $(root)$(htdocsdir)/ -type f -exec chmod a+r {} \; ; \
  466.     fi
  467.     -@if [ -f $(root)$(cgidir)/printenv ]; then \
  468.         echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(cgidir)/]"; \
  469.     else \
  470.         for script in printenv test-cgi; do \
  471.             cat $(TOP)/cgi-bin/$${script} |\
  472.             sed -e 's;^#!/.*perl;#!$(PERL);' \
  473.             > $(TOP)/$(SRC)/.apaci.install.tmp; \
  474.             echo "$(INSTALL_DATA) $(TOP)/conf/$${script}[*] $(root)$(cgidir)/$${script}"; \
  475.             $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(cgidir)/$${script}; \
  476.         done; \
  477.     fi
  478.     @echo "Copying tree $(TOP)/icons/ -> $(root)$(iconsdir)/"; \
  479.     (cd $(TOP)/icons/ && $(TAR) $(TAROPT) - *) |\
  480.     (cd $(root)$(iconsdir)/ && $(TAR) -xf -); \
  481.     find $(root)$(iconsdir)/ -type d -exec chmod a+rx {} \; ;\
  482.     find $(root)$(iconsdir)/ -type f -exec chmod a+r {} \;
  483.     @echo "<=== [data]"
  484.  
  485. #   create the initial configuration by providing default files
  486. #   and initial config files while preserving existing ones.
  487. install-config:
  488.     @echo "===> [config: Installing Apache configuration files]"
  489.     -@for conf in httpd.conf access.conf srm.conf; do \
  490.         if [ .$$conf = .httpd.conf ]; then \
  491.             target_conf="$(TARGET).conf"; \
  492.         else \
  493.             target_conf="$$conf"; \
  494.         fi; \
  495.         if [ ".$(TARGET)" = .httpd ]; then \
  496.             target_prefix=""; \
  497.         else \
  498.             target_prefix="$(TARGET)_"; \
  499.         fi; \
  500.         (echo "##"; \
  501.          echo "## $${target_conf} -- Apache HTTP server configuration file"; \
  502.          echo "##"; \
  503.          echo ""; \
  504.          cat $(TOP)/conf/$${conf}-dist ) |\
  505.          sed -e '/# LoadModule/r $(TOP)/$(SRC)/.apaci.install.conf' \
  506.             -e 's;@@ServerRoot@@/htdocs;$(htdocsdir);' \
  507.             -e 's;@@ServerRoot@@/icons;$(iconsdir);' \
  508.             -e 's;@@ServerRoot@@/cgi-bin;$(cgidir);' \
  509.             -e 's;@@ServerRoot@@/proxy;$(proxycachedir);' \
  510.             -e 's;@@ServerRoot@@;$(prefix);g' \
  511.             -e 's;httpd\.conf;$(TARGET).conf;' \
  512.             -e 's;logs/accept\.lock;$(runtimedir)/$(TARGET).lock;' \
  513.             -e 's;logs/apache_runtime_status;$(runtimedir)/$(TARGET).scoreboard;' \
  514.             -e 's;logs/httpd\.pid;$(runtimedir)/$(TARGET).pid;' \
  515.             -e "s;logs/access_log;$(logfiledir)/$${target_prefix}access_log;" \
  516.             -e "s;logs/error_log;$(logfiledir)/$${target_prefix}error_log;" \
  517.             -e "s;logs/referer_log;$(logfiledir)/$${target_prefix}referer_log;" \
  518.             -e "s;logs/agent_log;$(logfiledir)/$${target_prefix}agent_log;" \
  519.             -e 's;conf/magic;$(sysconfdir)/magic;' \
  520.             -e 's;conf/mime\.types;$(sysconfdir)/mime.types;' \
  521.             -e 's;User nobody;User $(conf_user);' \
  522.             -e 's;Group #-1;Group $(conf_group);' \
  523.             -e 's;Port 80;Port $(conf_port);' \
  524.             -e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
  525.             -e 's;ServerName new.host.name;ServerName $(conf_servername);' \
  526.             > $(TOP)/$(SRC)/.apaci.install.tmp && \
  527.         echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}.default"; \
  528.         $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}.default; \
  529.         if [ ! -f "$(root)$(sysconfdir)/$${target_conf}" ]; then \
  530.             echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}"; \
  531.             $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}; \
  532.         else \
  533.             echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${target_conf}]"; \
  534.         fi; \
  535.     done
  536.     -@for conf in mime.types magic; do \
  537.         echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default"; \
  538.         $(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default; \
  539.         if [ ! -f "$(root)$(sysconfdir)/$${conf}" ]; then \
  540.             echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}"; \
  541.             $(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}; \
  542.         else \
  543.             echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${conf}]"; \
  544.         fi; \
  545.     done
  546.     @echo "<=== [config]"
  547.  
  548.  
  549. ## ------------------------------------------------------------------
  550. ##                       Cleanup Targets
  551. ## ------------------------------------------------------------------
  552.  
  553. #   cleanup the source tree by removing anything which was
  554. #   created by the build target
  555. clean:
  556.     @echo "===> $(SRC)"
  557.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) clean-std $(clean-support)
  558.     @echo "<=== $(SRC)"
  559.     @$(RM) $(TOP)/$(SRC)/.apaci.build.ok
  560.  
  561. #   clean the standard stuff
  562. clean-std:
  563.     @cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ clean
  564.  
  565. #   clean additional support stuff
  566. clean-support:
  567.     @echo "===> $(SRC)/support"; \
  568.     cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) clean; \
  569.     if [ ".$(suexec)" = .1 ]; then \
  570.         echo "$(RM) suexec"; \
  571.         $(RM) suexec; \
  572.     fi; \
  573.     echo "<=== $(SRC)/support"
  574.  
  575. #   cleanup the source tree by removing anything which was
  576. #   created by the configure step and the build target.
  577. #   When --shadow is used we just remove the complete shadow tree.
  578. distclean:
  579.     @if [ ".$(SRC)" = .src ]; then \
  580.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-normal; \
  581.     else \
  582.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-shadow; \
  583.     fi
  584.  
  585. distclean-normal:
  586.     @echo "===> $(SRC)"
  587.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-std $(distclean-support)
  588.     @echo "<=== $(SRC)"
  589.     -$(RM) $(SRC)/Configuration.apaci
  590.     -$(RM) $(SRC)/apaci
  591.     @$(RM) $(SRC)/.apaci.build.ok
  592.     -$(RM) Makefile
  593.     -$(RM) config.status
  594.  
  595. #   clean the standard stuff
  596. distclean-std:
  597.     @cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ distclean
  598.  
  599. distclean-support:
  600.     @echo "===> $(SRC)/support"; \
  601.     cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) distclean; \
  602.     if [ ".$(suexec)" = .1 ]; then \
  603.         echo "$(RM) suexec"; \
  604.         $(RM) suexec; \
  605.     fi; \
  606.     echo "<=== $(SRC)/support"
  607.  
  608. distclean-shadow:
  609.     $(RM) -r $(SRC)
  610.     $(RM) $(TOP)/$(MKF)
  611.     -@if [ ".`ls $(TOP)/src.* 2>/dev/null`" = . ]; then \
  612.         echo "$(RM) Makefile"; \
  613.         $(RM) Makefile; \
  614.     fi
  615.  
  616.