[plain text]

# Makefile for Windows NT and Windows 95/98/2000

# Targets are:
#   _apacher   - build Apache in Release mode
#   _apached   - build Apache in Debug mode
#   installr   - build and install a Release build
#   installd   - build and install a Debug build
#   clean      - remove (most) generated files
#   _cleanr    - remove (most) files generated by a Release build
#   _cleand    - remove (most) files generated by a Debug build
# The default installation directory is \Apache. This can be changed
# with the INSTDIR macro, for example:
#   nmake /f INSTDIR="d:\Program Files\Apache" installr
# Note: this does *NOT* change the compiled in default "server root"
# Also be aware that certain awk's will not accept backslahed names,
# so the server root should be given in forward slashes (quoted),
# preferably with the drive designation!

!IF "$(INSTDIR)" == ""
!MESSAGE Using default install directory \Apache

!IF "$(MAKE)" == "NMAKE"
# Microsoft NMake options
!ELSEIF "$(MAKE)" == "make"
# Borland make options 
# Borland build of Apache is highly experimental and unsupported.
!MESSAGE Warning: unrecognized build command "$(MAKE)"

default:        _apacher

	$(MAKE) $(MAKEOPT) -f SHORT=R LONG=Release _build

	$(MAKE) $(MAKEOPT) -f SHORT=D LONG=Debug   _build

	$(MAKE) $(MAKEOPT) -f SHORT=R LONG=Release _build _install

	$(MAKE) $(MAKEOPT) -f SHORT=D LONG=Debug   _build _install



clean:	_cleanr _cleand

#	echo LONG $(LONG) SHORT $(SHORT) x
	cd os\win32
	 $(MAKE) $(MAKEOPT) -f ApacheOS.mak CFG="ApacheOS - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f Win9xConHook.mak CFG="Win9xConHook - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..\..
	cd regex
	 $(MAKE) $(MAKEOPT) -f regex.mak CFG="regex - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..
	cd ap
	 $(MAKE) $(MAKEOPT) -f ap.mak CFG="ap - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..
	cd support
	 $(MAKE) $(MAKEOPT) -f htpasswd.mak CFG="htpasswd - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f htdigest.mak CFG="htdigest - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f logresolve.mak CFG="logresolve - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f rotatelogs.mak CFG="rotatelogs - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..
	cd lib\expat-lite
	 $(MAKE) $(MAKEOPT) -f xmltok.mak CFG="xmltok - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f xmlparse.mak CFG="xmlparse - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..\..
	cd lib\sdbm
	 $(MAKE) $(MAKEOPT) -f sdbm.mak CFG="sdbm - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..\..
	cd main
	 $(MAKE) $(MAKEOPT) -f gen_uri_delims.mak CFG="gen_uri_delims - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f gen_test_char.mak CFG="gen_test_char - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..
	 $(MAKE) $(MAKEOPT) -f ApacheCore.mak CFG="ApacheCore - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f Apache.mak CFG="Apache - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd os\win32
	 $(MAKE) $(MAKEOPT) -f mod_status.mak CFG="mod_status - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_info.mak CFG="mod_info - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_auth_anon.mak CFG="mod_auth_anon - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_digest.mak CFG="mod_digest - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_cern_meta.mak CFG="mod_cern_meta - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_expires.mak CFG="mod_expires - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_headers.mak CFG="mod_headers - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_speling.mak CFG="mod_speling - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_usertrack.mak CFG="mod_usertrack - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_rewrite.mak CFG="mod_rewrite - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_auth_digest.mak CFG="mod_auth_digest - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_auth_dbm.mak CFG="mod_auth_dbm - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_proxy.mak CFG="mod_proxy - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_unique_id.mak CFG="mod_unique_id - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_vhost_alias.mak CFG="mod_vhost_alias - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	 $(MAKE) $(MAKEOPT) -f mod_mime_magic.mak CFG="mod_mime_magic - Win32 $(LONG)" RECURSE=0 $(CTARGET)
	cd ..\..

	-mkdir "$(INSTDIR)"
	-mkdir "$(INSTDIR)\bin"
	-mkdir "$(INSTDIR)\cgi-bin"
	-mkdir "$(INSTDIR)\conf"
        -mkdir "$(INSTDIR)\htdocs"
        -mkdir "$(INSTDIR)\icons"
        -mkdir "$(INSTDIR)\include"
        -mkdir "$(INSTDIR)\include\regex"
        -mkdir "$(INSTDIR)\include\sdbm"
        -mkdir "$(INSTDIR)\include\xml"
	-mkdir "$(INSTDIR)\lib"
	-mkdir "$(INSTDIR)\libexec"
	-mkdir "$(INSTDIR)\logs"
	-mkdir "$(INSTDIR)\modules"
	-mkdir "$(INSTDIR)\proxy"
	copy ..\Announcement "$(INSTDIR)\Announcement.txt"
	copy $(LONG)\Apache.exe "$(INSTDIR)"
	copy $(LONG)\ApacheCore.dll "$(INSTDIR)"
	copy os\win32\$(LONG)\Win9xConHook.dll "$(INSTDIR)"
	copy lib\expat-lite\$(LONG)\xmltok.dll "$(INSTDIR)"
	copy lib\expat-lite\$(LONG)\xmlparse.dll "$(INSTDIR)"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\ "$(INSTDIR)\modules"
	copy support\$(LONG)\htpasswd.exe "$(INSTDIR)\bin"
	copy support\$(LONG)\htdigest.exe "$(INSTDIR)\bin"
	copy support\$(LONG)\logresolve.exe "$(INSTDIR)\bin"
	copy support\$(LONG)\rotatelogs.exe "$(INSTDIR)\bin"
	copy ..\cgi-bin\printenv "$(INSTDIR)\cgi-bin\"
        -xcopy ..\htdocs "$(INSTDIR)\htdocs" /s /d < <<
	xcopy include\*.h "$(INSTDIR)\include" /d < <<
	xcopy os\win32\*.h "$(INSTDIR)\include" /d < <<
	xcopy regex\*.h "$(INSTDIR)\include\regex" /d < <<
	xcopy lib\sdbm\*.h "$(INSTDIR)\include\sdbm" /d < <<
	xcopy lib\expat-lite\*.h "$(INSTDIR)\include\xml" /d < <<
        -xcopy ..\icons "$(INSTDIR)\icons" /s /d < <<
	copy ap\Lib$(SHORT)\ap.lib "$(INSTDIR)\lib"
	copy os\win32\Lib$(SHORT)\ApacheOS.lib "$(INSTDIR)\lib"
	copy regex\Lib$(SHORT)\regex.lib "$(INSTDIR)\lib"
	copy lib\sdbm\Lib$(SHORT)\sdbm.lib "$(INSTDIR)\lib"
	copy $(LONG)\ApacheCore.exp "$(INSTDIR)\libexec"
	copy $(LONG)\ApacheCore.lib "$(INSTDIR)\libexec"
	copy os\win32\$(LONG)\Win9xConHook.exp "$(INSTDIR)\libexec"
	copy os\win32\$(LONG)\Win9xConHook.lib "$(INSTDIR)\libexec"
	copy lib\expat-lite\$(LONG)\xmltok.exp "$(INSTDIR)\libexec"
	copy lib\expat-lite\$(LONG)\xmltok.lib "$(INSTDIR)\libexec"
	copy lib\expat-lite\$(LONG)\xmlparse.exp "$(INSTDIR)\libexec"
	copy lib\expat-lite\$(LONG)\xmlparse.lib "$(INSTDIR)\libexec"
	copy $(LONG)\Apache.pdb "$(INSTDIR)"
	copy $(LONG)\ApacheCore.pdb "$(INSTDIR)"
	copy os\win32\$(LONG)\Win9xConHook.pdb "$(INSTDIR)"
	copy lib\expat-lite\$(LONG)\xmltok.pdb "$(INSTDIR)"
	copy lib\expat-lite\$(LONG)\xmlparse.pdb "$(INSTDIR)"
	copy os\win32\$(LONG)\mod_status.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_info.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_auth_anon.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_digest.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_cern_meta.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_expires.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_headers.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_rewrite.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_speling.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_usertrack.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_auth_digest.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_auth_dbm.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_proxy.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_unique_id.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_vhost_alias.pdb "$(INSTDIR)\modules"
	copy os\win32\$(LONG)\mod_mime_magic.pdb "$(INSTDIR)\modules"
	copy support\$(LONG)\htpasswd.pdb "$(INSTDIR)\bin"
	copy support\$(LONG)\htdigest.pdb "$(INSTDIR)\bin"
	copy support\$(LONG)\logresolve.pdb "$(INSTDIR)\bin"
	copy support\$(LONG)\rotatelogs.pdb "$(INSTDIR)\bin"
	copy ap\Lib$(SHORT)\ap.pdb "$(INSTDIR)\lib"
	copy os\win32\Lib$(SHORT)\ApacheOS.pdb "$(INSTDIR)\lib"
	copy regex\Lib$(SHORT)\regex.pdb "$(INSTDIR)\lib"
	copy lib\sdbm\Lib$(SHORT)\sdbm.pdb "$(INSTDIR)\lib"
        copy ..\conf\magic "$(INSTDIR)\conf\magic.default"
        if not exist "$(INSTDIR)\conf\magic" \
            copy "$(INSTDIR)\conf\magic.default" "$(INSTDIR)\conf\magic"
        copy ..\conf\mime.types "$(INSTDIR)\conf\mime.types.default"
        if not exist "$(INSTDIR)\conf\mime.types" \
            copy "$(INSTDIR)\conf\mime.types.default" "$(INSTDIR)\conf\mime.types"
	copy ..\conf\access.conf-dist "$(INSTDIR)\conf\access.default.conf"
	if not exist "$(INSTDIR)\conf\access.conf" \
            copy "$(INSTDIR)\conf\access.default.conf" "$(INSTDIR)\conf\access.conf"
	copy ..\conf\srm.conf-dist "$(INSTDIR)\conf\srm.default.conf"
	if not exist "$(INSTDIR)\conf\srm.conf" \
            copy "$(INSTDIR)\conf\srm.default.conf" "$(INSTDIR)\conf\srm.conf"
	awk -f <<script.awk "..\conf\httpd.conf-dist-win" "$(INSTDIR)\conf\httpd.default.conf" "$(INSTDIR)"
    BEGIN { 
        srcfl = ARGV[1];
        dstfl = ARGV[2];
        serverroot = ARGV[3];
        gsub( /\\/, "/", serverroot );
        while ( ( getline < srcfl ) > 0 ) {
            gsub( /@@ServerRoot@@/, serverroot );
            print $$0 > dstfl;
	if not exist "$(INSTDIR)\conf\httpd.conf" \
            copy "$(INSTDIR)\conf\httpd.default.conf" "$(INSTDIR)\conf\httpd.conf" 
	awk -f <<script.awk "support\dbmmanage" >"$(INSTDIR)\bin\"
    { if ( $$0 !~ /^#.*-lsdbm/) {
          gsub( /AnyDBM_File::ISA = qw\(.*\)/, "AnyDBM_File::ISA = qw(SDBM_File)" ); 
      print $$0;
	awk -f <<script2.awk "support\" "$(INSTDIR)" >"$(INSTDIR)\bin\"
    BEGIN {
          target = ARGV[2];
          gsub( /\\/, "/", target );
          delete ARGV[2];
    { if ( $$0 ~ /@/) {
          gsub( /@TARGET@/,            "httpd" ); 
          gsub( /@CC@/,                "cl" ); 
          gsub( /@CFLAGS@/,            "-nologo -MD -W3 -O2 -DNDEBUG -DWIN32 -D_WINDOWS -FD" ); 
          gsub( /@CFLAGS_SHLIB@/,      "-DSHARED_MODULE" ); 
          gsub( /@LD_SHLIB@/,          "link" ); 
          gsub( /@LDFLAGS_MOD_SHLIB@/, "-nologo -subsystem:windows -dll -libpath:\"" target "/libexec\" -incremental:no -map -machine:I386" ); 
          gsub( /@LIBS_SHLIB@/,        "ApacheCore.lib kernel32.lib advapi32.lib wsock32.lib ws2_32.lib" ); 
          gsub( /@prefix@/,            target  ); 
          gsub( /@sbindir@/,           target ); 
          gsub( /@includedir@/,        target "/include" ); 
          gsub( /@libexecdir@/,        target "/modules" ); 
          gsub( /@sysconfdir@/,        target "/conf" ); 
      print $$0;