# Makefile for Windows NT and Windows 95

# 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 Makefile.nt INSTDIR="d:\Program Files\Apache" installr
#
# Note: this does *NOT* change the compiled in default "server root"

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

default:	_apacher

_release:
	set SHORT=R
	set LONG=Release

_debug:
	set SHORT=D
	set LONG=Debug

_apacher: _release _build
_apached: _debug   _build
installr: _release _build _install
installd: _debug   _build _install
_cleanr:  _release _clean
_cleand:  _debug   _clean

clean:
	$(MAKE) /f Makefile.nt _cleanr
	$(MAKE) /f Makefile.nt _cleand

installdll: _release _installdll

_build:
#	echo LONG %LONG% SHORT %SHORT% x
	cd os\win32
	 nmake /nologo CFG="ApacheOS - Win32 %LONG%" -f ApacheOS.mak
	cd ..\..
	cd regex
	 nmake /nologo CFG="regex - Win32 %LONG%" -f regex.mak
	cd ..
	cd ap
	 nmake /nologo CFG="ap - Win32 %LONG%" -f ap.mak
	cd ..
	cd main
	 nmake /nologo CFG="gen_uri_delims - Win32 %LONG%" -f gen_uri_delims.mak
	 nmake /nologo CFG="gen_test_char - Win32 %LONG%" -f gen_test_char.mak
	cd ..
	 -del Core%SHORT%\buildmark.obj
	 nmake /nologo CFG="ApacheCore - Win32 %LONG%" -f ApacheCore.mak
	 nmake /nologo CFG="Apache - Win32 %LONG%" -f Apache.mak
	cd os\win32
	 set CFG=ApacheModuleStatus - Win32 %LONG%
	 nmake /nologo CFG="ApacheModuleStatus - Win32 %LONG%" -f ApacheModuleStatus.mak
#	 nmake /nologo CFG ""/nologo -f ApacheModuleStatus.mak"=ApacheModuleInfo - Win32 %LONG%" -f ApacheModuleInfo.mak
	 nmake /nologo CFG="ApacheModuleAuthAnon - Win32 %LONG%" -f ApacheModuleAuthAnon.mak
	 nmake /nologo CFG="ApacheModuleDigest - Win32 %LONG%" -f ApacheModuleDigest.mak
	 nmake /nologo CFG="ApacheModuleCERNMeta - Win32 %LONG%" -f ApacheModuleCERNMeta.mak
	 nmake /nologo CFG="ApacheModuleExpires - Win32 %LONG%" -f ApacheModuleExpires.mak
	 nmake /nologo CFG="ApacheModuleHeaders - Win32 %LONG%" -f ApacheModuleHeaders.mak
	 nmake /nologo CFG="ApacheModuleSpeling - Win32 %LONG%" -f ApacheModuleSpeling.mak
	 nmake /nologo CFG="ApacheModuleUserTrack - Win32 %LONG%" -f ApacheModuleUserTrack.mak
	 nmake /nologo CFG="ApacheModuleRewrite - Win32 %LONG%" -f ApacheModuleRewrite.mak
	cd ..\..
	cd modules\proxy
	 nmake /nologo CFG="ApacheModuleProxy - Win32 %LONG%" -f ApacheModuleProxy.mak
	cd ..\..

_install:
	-mkdir $(INSTDIR)
	-mkdir $(INSTDIR)\modules
	-mkdir $(INSTDIR)\logs
	-mkdir $(INSTDIR)\conf
	copy Apache%SHORT%\Apache.exe $(INSTDIR)
	copy Core%SHORT%\ApacheCore.dll $(INSTDIR)
	copy os\win32\ApacheModuleStatus%SHORT%\ApacheModuleStatus.dll $(INSTDIR)\modules
#       copy os\win32\ApacheModuleInfo%SHORT%\ApacheModuleInfo.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleAuthAnon%SHORT%\ApacheModuleAuthAnon.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleDigest%SHORT%\ApacheModuleDigest.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleCERNMeta%SHORT%\ApacheModuleCERNMeta.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleExpires%SHORT%\ApacheModuleExpires.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleHeaders%SHORT%\ApacheModuleHeaders.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleRewrite%SHORT%\ApacheModuleRewrite.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleSpeling%SHORT%\ApacheModuleSpeling.dll $(INSTDIR)\modules
	copy os\win32\ApacheModuleUserTrack%SHORT%\ApacheModuleUserTrack.dll $(INSTDIR)\modules
	copy modules\proxy\%LONG%\ApacheModuleProxy.dll $(INSTDIR)\modules

_clean:
	cd os\win32
	 nmake /nologo CFG="ApacheOS - Win32 %LONG%" -f ApacheOS.mak clean
	cd ..\..
	cd regex
	 nmake /nologo CFG="regex - Win32 %LONG%" -f regex.mak clean
	cd ..
	cd ap
	 nmake /nologo CFG="ap - Win32 %LONG%" -f ap.mak clean
	cd ..
	cd main
	 nmake /nologo CFG="gen_uri_delims - Win32 %LONG%" -f gen_uri_delims.mak clean
	 del uri_delims.h
	 nmake /nologo CFG="gen_test_char - Win32 %LONG%" -f gen_test_char.mak clean
	 del test_char.h
	cd ..
	 nmake /nologo CFG="ApacheCore - Win32 %LONG%" -f ApacheCore.mak clean
	 nmake /nologo CFG="Apache - Win32 %LONG%" -f Apache.mak clean
	cd os\win32
	 nmake /nologo CFG="ApacheModuleStatus - Win32 %LONG%" -f ApacheModuleStatus.mak clean
#	 nmake /nologo CFG="ApacheModuleInfo - Win32 %LONG%" -f ApacheModuleInfo.mak clean
	 nmake /nologo CFG="ApacheModuleAuthAnon - Win32 %LONG%" -f ApacheModuleAuthAnon.mak clean
	 nmake /nologo CFG="ApacheModuleDigest - Win32 %LONG%" -f ApacheModuleDigest.mak clean
	 nmake /nologo CFG="ApacheModuleCERNMeta - Win32 %LONG%" -f ApacheModuleCERNMeta.mak clean
	 nmake /nologo CFG="ApacheModuleExpires - Win32 %LONG%" -f ApacheModuleExpires.mak clean
	 nmake /nologo CFG="ApacheModuleHeaders - Win32 %LONG%" -f ApacheModuleHeaders.mak clean
	 nmake /nologo CFG="ApacheModuleSpeling - Win32 %LONG%" -f ApacheModuleSpeling.mak clean
	 nmake /nologo CFG="ApacheModuleUserTrack - Win32 %LONG%" -f ApacheModuleUserTrack.mak clean
	cd ..\..
	cd modules\proxy
	 nmake /nologo CFG="ApacheModuleProxy - Win32 %LONG%" -f ApacheModuleProxy.mak clean
	cd ..\..
 	cd os\win32\installer\installdll
	 nmake /nologo CFG="install - Win32 %LONG%" -f install.mak clean
	cd ..\..\..

_installdll:
 	cd os\win32\installer\installdll
	 nmake /nologo CFG="install - Win32 %LONG%" -f install.mak
	cd ..\..\..
