home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / apac_139.zip / Makefile.tmpl < prev    next >
Makefile  |  1999-08-13  |  26KB  |  602 lines

  1. ## ====================================================================
  2. ## Copyright (c) 1998-1999 The Apache Group.  All rights reserved.
  3. ##
  4. ## Redistribution and use in source and binary forms, with or without
  5. ## modification, are permitted provided that the following conditions
  6. ## are met:
  7. ##
  8. ## 1. Redistributions of source code must retain the above copyright
  9. ##    notice, this list of conditions and the following disclaimer.
  10. ##
  11. ## 2. Redistributions in binary form must reproduce the above copyright
  12. ##    notice, this list of conditions and the following disclaimer in
  13. ##    the documentation and/or other materials provided with the
  14. ##    distribution.
  15. ##
  16. ## 3. All advertising materials mentioning features or use of this
  17. ##    software must display the following acknowledgment:
  18. ##    "This product includes software developed by the Apache Group
  19. ##    for use in the Apache HTTP server project (http://www.apache.org/)."
  20. ##
  21. ## 4. The names "Apache Server" and "Apache Group" must not be used to
  22. ##    endorse or promote products derived from this software without
  23. ##    prior written permission. For written permission, please contact
  24. ##    apache@apache.org.
  25. ##
  26. ## 5. Products derived from this software may not be called "Apache"
  27. ##    nor may "Apache" appear in their names without prior written
  28. ##    permission of the Apache Group.
  29. ##
  30. ## 6. Redistributions of any form whatsoever must retain the following
  31. ##    acknowledgment:
  32. ##    "This product includes software developed by the Apache Group
  33. ##    for use in the Apache HTTP server project (http://www.apache.org/)."
  34. ##
  35. ## THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
  36. ## EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  37. ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  38. ## PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
  39. ## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  41. ## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  42. ## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  43. ## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  44. ## STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  45. ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  46. ## OF THE POSSIBILITY OF SUCH DAMAGE.
  47. ## ====================================================================
  48. ##
  49. ## This software consists of voluntary contributions made by many
  50. ## individuals on behalf of the Apache Group and was originally based
  51. ## on public domain software written at the National Center for
  52. ## Supercomputing Applications, University of Illinois, Urbana-Champaign.
  53. ## For more information on the Apache Group and the Apache HTTP server
  54. ## project, please see <http://www.apache.org/>.
  55. ##
  56.  
  57. ##
  58. ##  Makefile -- Apache Autoconf-style Interface (APACI)
  59. ##              top-level control Makefile for out-of-the-box
  60. ##              build and installation procedure.
  61. ##
  62. ##  Written by Ralf S. Engelschall <rse@apache.org>
  63. ##
  64.  
  65. ## ==================================================================
  66. ##                              Options
  67. ## ==================================================================
  68.  
  69. #   safe environment
  70. SHELL           = @SHELL@
  71.  
  72. #   paths to the source tree parts
  73. TOP             = .
  74. SRC             = @SRC@
  75. MKF             = @MKF@
  76. AUX             = @AUX@
  77.  
  78. #   build tools
  79. CP              = cp
  80. LN              = ln
  81. RM              = rm -f
  82. MKDIR           = $(TOP)/$(AUX)/mkdir.sh
  83. INSTALL         = $(TOP)/$(AUX)/install.sh -c
  84. IFLAGS_PROGRAM  = @IFLAGS_PROGRAM@
  85. IFLAGS_CORE     = @IFLAGS_CORE@
  86. IFLAGS_DSO      = @IFLAGS_DSO@
  87. IFLAGS_SCRIPT   = @IFLAGS_SCRIPT@
  88. IFLAGS_DATA     = @IFLAGS_DATA@
  89. INSTALL_PROGRAM = $(INSTALL) $(IFLAGS_PROGRAM)
  90. INSTALL_CORE    = $(INSTALL) $(IFLAGS_CORE)
  91. INSTALL_DSO     = $(INSTALL) $(IFLAGS_DSO)
  92. INSTALL_SCRIPT  = $(INSTALL) $(IFLAGS_SCRIPT)
  93. INSTALL_DATA    = $(INSTALL) $(IFLAGS_DATA)
  94. PERL            = @PERL@
  95. TAR        = @TAR@
  96. TAROPT        = @TAROPT@
  97.  
  98. #   installation name of Apache webserver
  99. TARGET          = @TARGET@
  100.  
  101. #   installation root 
  102. #   (overrideable by package maintainers for
  103. #   rolling packages without bristling the system)
  104. root            =
  105.  
  106. #   installation paths
  107. prefix          = @prefix@
  108. exec_prefix     = @exec_prefix@
  109. bindir          = @bindir@
  110. sbindir         = @sbindir@
  111. libexecdir      = @libexecdir@
  112. mandir          = @mandir@
  113. sysconfdir      = @sysconfdir@
  114. datadir         = @datadir@
  115. iconsdir        = @iconsdir@
  116. htdocsdir       = @htdocsdir@
  117. cgidir          = @cgidir@
  118. includedir      = @includedir@
  119. localstatedir   = @localstatedir@
  120. runtimedir      = @runtimedir@
  121. logfiledir      = @logfiledir@
  122. proxycachedir   = @proxycachedir@
  123.  
  124. libexecdir_relative   = @libexecdir_relative@
  125.  
  126. #   suexec details (optional)
  127. suexec          = @suexec@
  128. suexec_caller   = @suexec_caller@
  129. suexec_docroot  = @suexec_docroot@
  130. suexec_logexec  = @suexec_logexec@
  131. suexec_userdir  = @suexec_userdir@
  132. suexec_uidmin   = @suexec_uidmin@
  133. suexec_gidmin   = @suexec_gidmin@
  134. suexec_safepath = @suexec_safepath@
  135.  
  136. #   some substituted configuration parameters
  137. conf_user        = @conf_user@
  138. conf_group       = @conf_group@
  139. conf_port        = @conf_port@
  140. conf_serveradmin = @conf_serveradmin@
  141. conf_servername  = @conf_servername@
  142.  
  143. #   usage of src/support stuff
  144. build-support     = @build_support@
  145. install-support   = @install_support@
  146. clean-support     = @clean_support@
  147. distclean-support = @distclean_support@
  148.  
  149. #   forwarding arguments
  150. MFWD = root=$(root)
  151.  
  152. ## ==================================================================
  153. ##                              Targets
  154. ## ==================================================================
  155.  
  156. #   default target
  157. all: build
  158.  
  159. ## ------------------------------------------------------------------
  160. ##                           Build Target
  161. ## ------------------------------------------------------------------
  162.  
  163. #   build the package
  164. build:
  165.     @echo "===> $(SRC)"
  166.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build-std
  167.     @if [ "x$(build-support)" != "x" ]; then \
  168.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) $(build-support); \
  169.         fi
  170.     @touch $(TOP)/$(SRC)/.apaci.build.ok
  171.     @echo "<=== $(SRC)"
  172.  
  173. #   the non-verbose variant for package maintainers
  174. build-quiet:
  175.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 build
  176.  
  177. #   build the standard stuff
  178. build-std:
  179.     @cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ all
  180.  
  181. #   build the additional support stuff
  182. build-support:
  183.     @echo "===> $(SRC)/support"; \
  184.     cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) all; \
  185.     if [ ".$(suexec)" = .1 ]; then \
  186.         $(MAKE) $(MFLAGS) \
  187.         EXTRA_CFLAGS='\
  188.             -DHTTPD_USER=\"$(suexec_caller)\" \
  189.             -DUID_MIN=$(suexec_uidmin) \
  190.             -DGID_MIN=$(suexec_gidmin) \
  191.             -DUSERDIR_SUFFIX=\"$(suexec_userdir)\" \
  192.             -DLOG_EXEC=\"$(suexec_logexec)\" \
  193.             -DDOC_ROOT=\"$(suexec_docroot)\" \
  194.             -DSAFE_PATH=\"$(suexec_safepath)\" ' \
  195.         suexec; \
  196.     fi; \
  197.     echo "<=== $(SRC)/support"
  198.  
  199. ## ------------------------------------------------------------------
  200. ##                       Installation Targets
  201. ## ------------------------------------------------------------------
  202.  
  203. #   indirection step to avoid conflict with INSTALL document 
  204. #   on case-insenstive filesystems, for instance on OS/2
  205. install: install-all
  206.  
  207. #   the install target for installing the complete Apache
  208. #   package. This is implemented by running subtargets for the
  209. #   separate parts of the installation process.
  210. install-all:
  211.     @if [ ! -f $(TOP)/$(SRC)/.apaci.build.ok ]; then \
  212.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build; \
  213.     else \
  214.         :; \
  215.     fi
  216.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) \
  217.         install-mktree install-programs $(install-support) \
  218.         install-include install-data install-config
  219.     -@$(RM) $(SRC)/.apaci.install.tmp
  220.     -@$(RM) $(SRC)/.apaci.install.conf
  221.     -@if [ ".$(QUIET)" != .1 ]; then \
  222.         if [ ".$(TARGET)" = .httpd ]; then \
  223.             apachectl='apachectl'; \
  224.         else \
  225.             apachectl="$(TARGET)ctl"; \
  226.         fi; \
  227.         echo "+--------------------------------------------------------+"; \
  228.         echo "| You now have successfully built and installed the      |"; \
  229.         echo "| Apache 1.3 HTTP server. To verify that Apache actually |"; \
  230.         echo "| works correctly you now should first check the         |"; \
  231.         echo "| (initially created or preserved) configuration files   |"; \
  232.         echo "|                                                        |"; \
  233.         echo "|   $(sysconfdir)/$(TARGET).conf"; \
  234.         echo "|                                                        |"; \
  235.         echo "| and then you should be able to immediately fire up     |"; \
  236.         echo "| Apache the first time by running:                      |"; \
  237.         echo "|                                                        |"; \
  238.         echo "|   $(sbindir)/$${apachectl} start"; \
  239.         echo "|                                                        |"; \
  240.         echo "| Thanks for using Apache.       The Apache Group        |"; \
  241.         echo "|                                http://www.apache.org/  |"; \
  242.         echo "+--------------------------------------------------------+"; \
  243.     fi
  244.  
  245. #   the non-verbose variant for package maintainers
  246. install-quiet:
  247.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 install-all
  248.  
  249. #   create the installation tree
  250. install-mktree:
  251.     @echo "===> [mktree: Creating Apache installation tree]"
  252.     $(MKDIR) $(root)$(bindir)
  253.     $(MKDIR) $(root)$(sbindir)
  254.     $(MKDIR) $(root)$(libexecdir)
  255.     $(MKDIR) $(root)$(mandir)/man1
  256.     $(MKDIR) $(root)$(mandir)/man8
  257.     $(MKDIR) $(root)$(sysconfdir)
  258.     $(MKDIR) $(root)$(htdocsdir)
  259.     $(MKDIR) $(root)$(iconsdir)
  260.     $(MKDIR) $(root)$(cgidir)
  261.     $(MKDIR) $(root)$(includedir)
  262.     $(MKDIR) $(root)$(includedir)/xml
  263.     $(MKDIR) $(root)$(runtimedir)
  264.     $(MKDIR) $(root)$(logfiledir)
  265.     $(MKDIR) $(root)$(proxycachedir)
  266.     -@if [ "x`$(AUX)/getuid.sh`" = "x0" ]; then \
  267.         echo "chown $(conf_user) $(root)$(proxycachedir)"; \
  268.         chown $(conf_user) $(root)$(proxycachedir); \
  269.         echo "chgrp $(conf_group) $(root)$(proxycachedir)"; \
  270.         chgrp $(conf_group) $(root)$(proxycachedir); \
  271.     fi
  272.     @echo "<=== [mktree]"
  273.  
  274. #   install the server program and optionally corresponding
  275. #   shared object files.
  276. install-programs:
  277.     @echo "===> [programs: Installing Apache $(TARGET) program and shared objects]"
  278.     -@if [ ".`grep '^[     ]*AddModule.*mod_so\.o' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
  279.         echo "$(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
  280.         $(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
  281.         SHLIB_EXPORT_FILES="`grep '^SHLIB_EXPORT_FILES=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
  282.         if [ ".$${SHLIB_EXPORT_FILES}" != . ]; then \
  283.             $(CP) $(TOP)/$(SRC)/support/httpd.exp $(root)$(libexecdir)/; \
  284.             chmod 644 $(root)$(libexecdir)/httpd.exp; \
  285.         fi; \
  286.     else \
  287.         echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
  288.         $(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
  289.     fi
  290.     -@if [ ".`grep 'SUBTARGET=target_shared' $(TOP)/$(SRC)/Makefile`" != . ]; then \
  291.         SHLIB_SUFFIX_NAME="`grep '^SHLIB_SUFFIX_NAME=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
  292.         SHLIB_SUFFIX_LIST="`grep '^SHLIB_SUFFIX_LIST=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
  293.         echo "$(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep"; \
  294.         $(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep; \
  295.         echo "$(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}"; \
  296.         $(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}; \
  297.         if [ ".$${SHLIB_SUFFIX_LIST}" != . ]; then \
  298.             echo "$(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*"; \
  299.             $(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*; \
  300.             for suffix in $${SHLIB_SUFFIX_LIST} ""; do \
  301.                 [ ".$${suffix}" = . ] && continue; \
  302.                 echo "$(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}"; \
  303.                 $(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}; \
  304.             done; \
  305.         fi; \
  306.     fi
  307.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/httpd.8 $(root)$(mandir)/man8/$(TARGET).8
  308.     -@$(RM) $(SRC)/.apaci.install.conf; touch $(SRC)/.apaci.install.conf
  309.     -@if [ ".`grep '^[     ]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
  310.         for mod in `egrep '^[     ]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci |\
  311.                     sed -e 's/^[     ]*SharedModule[     ]*//'`; do \
  312.             file=`echo $${mod} | sed -e 's;^.*/\([^/]*\);\1;'`; \
  313.             echo "$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}"; \
  314.             $(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}; \
  315.             name=`$(TOP)/$(AUX)/fmn.sh $(TOP)/$(SRC)/$${mod}`; \
  316.             echo dummy | awk '{ printf("LoadModule %-18s %s\n", modname, modpath); }' \
  317.             modname="$${name}" modpath="$(libexecdir_relative)$${file}" >>$(SRC)/.apaci.install.conf; \
  318.         done; \
  319.         echo "" >>$(SRC)/.apaci.install.conf; \
  320.         echo "#  Reconstruction of the complete module list from all available modules" >>$(SRC)/.apaci.install.conf; \
  321.         echo "#  (static and shared ones) to achieve correct module execution order." >>$(SRC)/.apaci.install.conf; \
  322.         echo "#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]" >>$(SRC)/.apaci.install.conf; \
  323.         echo "ClearModuleList" >>$(SRC)/.apaci.install.conf; \
  324.         egrep "^[     ]*(Add|Shared)Module" $(SRC)/Configuration.apaci |\
  325.         sed    -e 's:SharedModule:AddModule:' \
  326.             -e 's:modules/[^/]*/::' \
  327.             -e 's:[     ]lib: mod_:' \
  328.             -e 's:\.[soam].*$$:.c:' >>$(SRC)/.apaci.install.conf; \
  329.     fi
  330.     @echo "<=== [programs]"
  331.  
  332. #   install the support programs and scripts
  333. install-support:
  334.     @echo "===> [support: Installing Apache support programs and scripts]"
  335.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
  336.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
  337.     @if [ ".$(TARGET)" = .httpd ]; then \
  338.         apachectl='apachectl'; \
  339.     else \
  340.         apachectl="$(TARGET)ctl"; \
  341.     fi; \
  342.     echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
  343.     sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
  344.         -e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
  345.         < $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
  346.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
  347.     echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
  348.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
  349.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
  350.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
  351.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
  352.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
  353.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
  354.     sed -e 's;^#!/.*;#!$(PERL);' \
  355.         < $(TOP)/$(SRC)/support/dbmmanage > $(TOP)/$(SRC)/.apaci.install.tmp && \
  356.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(bindir)/dbmmanage
  357.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
  358.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
  359.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
  360.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
  361.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
  362.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
  363.     sed -e 's;^#!/.*;#!$(PERL);' \
  364.         -e 's;\@prefix\@;$(prefix);' \
  365.         -e 's;\@sbindir\@;$(sbindir);' \
  366.         -e 's;\@libexecdir\@;$(libexecdir);' \
  367.         -e 's;\@includedir\@;$(includedir);' \
  368.         -e 's;\@sysconfdir\@;$(sysconfdir);' \
  369.         < $(TOP)/$(SRC)/support/apxs > $(TOP)/$(SRC)/.apaci.install.tmp && \
  370.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/apxs
  371.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
  372.     -@if [ ".$(suexec)" = .1 ]; then \
  373.         echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
  374.         $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
  375.         echo "chown root $(root)$(sbindir)/suexec"; \
  376.         chown root $(root)$(sbindir)/suexec; \
  377.         echo "chmod 4711 $(root)$(sbindir)/suexec"; \
  378.         chmod 4711 $(root)$(sbindir)/suexec; \
  379.         echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
  380.         $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
  381.     fi
  382.     @echo "<=== [support]"
  383.  
  384. #   install the support programs and scripts for binary distribution
  385. install-binsupport:
  386.     @echo "===> [support: Installing Apache support programs and scripts for binary distribution]"
  387.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
  388.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
  389.     @if [ ".$(TARGET)" = .httpd ]; then \
  390.         apachectl='apachectl'; \
  391.     else \
  392.         apachectl="$(TARGET)ctl"; \
  393.     fi; \
  394.     echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
  395.     sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
  396.         -e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
  397.         < $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
  398.         $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
  399.     echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
  400.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
  401.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
  402.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
  403.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
  404.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
  405.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
  406.     $(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage $(root)$(bindir)/dbmmanage
  407.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
  408.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
  409.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
  410.     $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
  411.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
  412.     @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
  413.     $(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs $(root)$(sbindir)/apxs
  414.     $(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
  415.     -@if [ ".$(suexec)" = .1 ]; then \
  416.         echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
  417.         $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
  418.         echo "chown root $(root)$(sbindir)/suexec"; \
  419.         chown root $(root)$(sbindir)/suexec; \
  420.         echo "chmod 4711 $(root)$(sbindir)/suexec"; \
  421.         chmod 4711 $(root)$(sbindir)/suexec; \
  422.         echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
  423.         $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
  424.     fi
  425.     @echo "<=== [support]"
  426.  
  427. #   install the Apache C header files
  428. install-include:
  429.     @echo "===> [include: Installing Apache C header files]"
  430.     $(CP) $(TOP)/$(SRC)/include/*.h $(root)$(includedir)/
  431.     $(CP) $(TOP)/$(SRC)/lib/expat-lite/*.h $(root)$(includedir)/xml/
  432.     @osdir=`grep '^OSDIR=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^OSDIR=.*/os/:os/:'`; \
  433.         echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/"; \
  434.         $(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/; \
  435.         echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/"; \
  436.         $(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/
  437.     chmod 644 $(root)$(includedir)/*.h $(root)$(includedir)/xml/*.h
  438.     @echo "<=== [include]"
  439.  
  440. #   create an initial document root containing the Apache manual,
  441. #   icons and distributed CGI scripts.
  442. install-data:
  443.     @echo "===> [data: Installing initial data files]"
  444.     -@if [ -f $(root)$(htdocsdir)/index.html ]; then \
  445.         echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(htdocsdir)/]"; \
  446.     else \
  447.         echo "Copying tree $(TOP)/htdocs/ -> $(root)$(htdocsdir)/"; \
  448.         (cd $(TOP)/htdocs/ && $(TAR) $(TAROPT) - *) |\
  449.         (cd $(root)$(htdocsdir)/ && $(TAR) -xf -); \
  450.         find $(root)$(htdocsdir)/ -type d -exec chmod a+rx {} \; ; \
  451.         find $(root)$(htdocsdir)/ -type f -exec chmod a+r {} \; ; \
  452.     fi
  453.     -@if [ -f $(root)$(cgidir)/printenv ]; then \
  454.         echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(cgidir)/]"; \
  455.     else \
  456.         for script in printenv test-cgi; do \
  457.             cat $(TOP)/cgi-bin/$${script} |\
  458.             sed -e 's;^#!/.*perl;#!$(PERL);' \
  459.             > $(TOP)/$(SRC)/.apaci.install.tmp; \
  460.             echo "$(INSTALL_DATA) $(TOP)/conf/$${script}[*] $(root)$(cgidir)/$${script}"; \
  461.             $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(cgidir)/$${script}; \
  462.         done; \
  463.     fi
  464.     @echo "Copying tree $(TOP)/icons/ -> $(root)$(iconsdir)/"; \
  465.     (cd $(TOP)/icons/ && $(TAR) $(TAROPT) - *) |\
  466.     (cd $(root)$(iconsdir)/ && $(TAR) -xf -); \
  467.     find $(root)$(iconsdir)/ -type d -exec chmod a+rx {} \; ;\
  468.     find $(root)$(iconsdir)/ -type f -exec chmod a+r {} \;
  469.     @echo "<=== [data]"
  470.  
  471. #   create the initial configuration by providing default files
  472. #   and initial config files while preserving existing ones.
  473. install-config:
  474.     @echo "===> [config: Installing Apache configuration files]"
  475.     -@for conf in httpd.conf access.conf srm.conf; do \
  476.         if [ .$$conf = .httpd.conf ]; then \
  477.             target_conf="$(TARGET).conf"; \
  478.         else \
  479.             target_conf="$$conf"; \
  480.         fi; \
  481.         if [ ".$(TARGET)" = .httpd ]; then \
  482.             target_prefix=""; \
  483.         else \
  484.             target_prefix="$(TARGET)_"; \
  485.         fi; \
  486.         (echo "##"; \
  487.          echo "## $${target_conf} -- Apache HTTP server configuration file"; \
  488.          echo "##"; \
  489.          echo ""; \
  490.          cat $(TOP)/conf/$${conf}-dist ) |\
  491.          sed -e '/# LoadModule/r $(TOP)/$(SRC)/.apaci.install.conf' \
  492.             -e 's;@@ServerRoot@@/htdocs;$(htdocsdir);' \
  493.             -e 's;@@ServerRoot@@/icons;$(iconsdir);' \
  494.             -e 's;@@ServerRoot@@/cgi-bin;$(cgidir);' \
  495.             -e 's;@@ServerRoot@@/proxy;$(proxycachedir);' \
  496.             -e 's;@@ServerRoot@@;$(prefix);g' \
  497.             -e 's;httpd\.conf;$(TARGET).conf;' \
  498.             -e 's;logs/accept\.lock;$(runtimedir)/$(TARGET).lock;' \
  499.             -e 's;logs/apache_runtime_status;$(runtimedir)/$(TARGET).scoreboard;' \
  500.             -e 's;logs/httpd\.pid;$(runtimedir)/$(TARGET).pid;' \
  501.             -e "s;logs/access_log;$(logfiledir)/$${target_prefix}access_log;" \
  502.             -e "s;logs/error_log;$(logfiledir)/$${target_prefix}error_log;" \
  503.             -e "s;logs/referer_log;$(logfiledir)/$${target_prefix}referer_log;" \
  504.             -e "s;logs/agent_log;$(logfiledir)/$${target_prefix}agent_log;" \
  505.             -e 's;conf/magic;$(sysconfdir)/magic;' \
  506.             -e 's;conf/mime\.types;$(sysconfdir)/mime.types;' \
  507.             -e 's;User nobody;User $(conf_user);' \
  508.             -e 's;Group #-1;Group $(conf_group);' \
  509.             -e 's;Port 80;Port $(conf_port);' \
  510.             -e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
  511.             -e 's;ServerName new.host.name;ServerName $(conf_servername);' \
  512.             > $(TOP)/$(SRC)/.apaci.install.tmp && \
  513.         echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}.default"; \
  514.         $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}.default; \
  515.         if [ ! -f "$(root)$(sysconfdir)/$${target_conf}" ]; then \
  516.             echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}"; \
  517.             $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}; \
  518.         else \
  519.             echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${target_conf}]"; \
  520.         fi; \
  521.     done
  522.     -@for conf in mime.types magic; do \
  523.         echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default"; \
  524.         $(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default; \
  525.         if [ ! -f "$(root)$(sysconfdir)/$${conf}" ]; then \
  526.             echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}"; \
  527.             $(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}; \
  528.         else \
  529.             echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${conf}]"; \
  530.         fi; \
  531.     done
  532.     @echo "<=== [config]"
  533.  
  534.  
  535. ## ------------------------------------------------------------------
  536. ##                       Cleanup Targets
  537. ## ------------------------------------------------------------------
  538.  
  539. #   cleanup the source tree by removing anything which was
  540. #   created by the build target
  541. clean:
  542.     @echo "===> $(SRC)"
  543.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) clean-std $(clean-support)
  544.     @echo "<=== $(SRC)"
  545.     @$(RM) $(TOP)/$(SRC)/.apaci.build.ok
  546.  
  547. #   clean the standard stuff
  548. clean-std:
  549.     @cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ clean
  550.  
  551. #   clean additional support stuff
  552. clean-support:
  553.     @echo "===> $(SRC)/support"; \
  554.     cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) clean; \
  555.     if [ ".$(suexec)" = .1 ]; then \
  556.         echo "$(RM) suexec"; \
  557.         $(RM) suexec; \
  558.     fi; \
  559.     echo "<=== $(SRC)/support"
  560.  
  561. #   cleanup the source tree by removing anything which was
  562. #   created by the configure step and the build target.
  563. #   When --shadow is used we just remove the complete shadow tree.
  564. distclean:
  565.     @if [ ".$(SRC)" = .src ]; then \
  566.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-normal; \
  567.     else \
  568.         $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-shadow; \
  569.     fi
  570.  
  571. distclean-normal:
  572.     @echo "===> $(SRC)"
  573.     @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-std $(distclean-support)
  574.     @echo "<=== $(SRC)"
  575.     -$(RM) $(SRC)/Configuration.apaci
  576.     -$(RM) $(SRC)/apaci
  577.     @$(RM) $(SRC)/.apaci.build.ok
  578.     -$(RM) Makefile
  579.     -$(RM) config.status
  580.  
  581. #   clean the standard stuff
  582. distclean-std:
  583.     @cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ distclean
  584.  
  585. distclean-support:
  586.     @echo "===> $(SRC)/support"; \
  587.     cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) distclean; \
  588.     if [ ".$(suexec)" = .1 ]; then \
  589.         echo "$(RM) suexec"; \
  590.         $(RM) suexec; \
  591.     fi; \
  592.     echo "<=== $(SRC)/support"
  593.  
  594. distclean-shadow:
  595.     $(RM) -r $(SRC)
  596.     $(RM) $(TOP)/$(MKF)
  597.     -@if [ ".`ls $(TOP)/src.* 2>/dev/null`" = . ]; then \
  598.         echo "$(RM) Makefile"; \
  599.         $(RM) Makefile; \
  600.     fi
  601.  
  602.