# # NMAKE Makefile for Microsoft Windows # # Targets are: # _buildr - build mod_ftp in Release mode # _buildd - build mod_ftp in Debug mode # installr - build and install a Release build of mod_ftp # installd - build and install a Debug build of mod_ftp # clean - remove (most) generated files # # The following install defaults may be customized; # # Option Default # INSTDIR /Apache22 # FTPPORT 21 # DOMAINNAME example.com # SERVERNAME www.example.com # SERVERNAME admin@example.com # # For example; # # nmake -f Makefile-ftp.win FTPPORT=8021 INSTDIR="d:/Program Files/Apache" installr # # Be aware that certain awk's will not accept backslashed names, # so the server root should be given in forward slashes (quoted), # preferably with the drive designation! !IF "$(INSTDIR)" == "" INSTDIR=\Apache22 !ENDIF !IF EXIST("modules\ftp\mod_ftp.vcproj") \ && ([devenv /help > NUL 2>&1] == 0) \ && !defined(USEMAK) && !defined(USEDSW) USESLN=1 USEMAK=0 USEDSW=0 !ELSEIF EXIST("modules\ftp\mod_ftp.mak") && !defined(USEDSW) USESLN=0 USEMAK=1 USEDSW=0 !ELSE USESLN=0 USEMAK=0 USEDSW=1 !ENDIF !IF ("$(CTARGET)" == "") && ($(USESLN) == 1) CTARGET=/build !ENDIF !IF "$(APACHE2_HOME)" == "" APACHE2_HOME=$(INSTDIR) !ENDIF !IF EXIST("$(APACHE2_HOME)\lib\libapr-2.lib") APACHE2_APRSFX=-2 !ELSEIF EXIST("$(APACHE2_HOME)\lib\libapr-1.lib") APACHE2_APRSFX=-1 !ELSEIF EXIST("$(APACHE2_HOME)\lib\libapr.lib") APACHE2_APRSFX= !ELSE !MESSAGE Point INSTDIR at the directory containing an already installed httpd !MESSAGE including build support directories of lib and include. It must !MESSAGE include apr and apr-util. mod_ftp cannot build without these files! !ENDIF !IF "$(DOMAINNAME)" == "" DOMAINNAME=example.com !ENDIF !IF "$(SERVERNAME)" == "" SERVERNAME=www.$(DOMAINNAME) !ENDIF !IF "$(SERVERADMIN)" == "" SERVERADMIN=admin@$(DOMAINNAME) !ENDIF !IF "$(FTPPORT)" == "" FTPPORT=21 !ENDIF !IF "$(LONG)" == "" !MESSAGE !MESSAGE INSTDIR = $(INSTDIR) !MESSAGE APACHE2_HOME = $(APACHE2_HOME) !MESSAGE DOMAINNAME = $(DOMAINNAME) !MESSAGE SERVERNAME = $(SERVERNAME) !MESSAGE SERVERADMIN = $(SERVERADMIN) !MESSAGE FTPPORT = $(FTPPORT) !MESSAGE !MESSAGE To change these options use 'nmake -f Makefile-ftp.win [option=value]' !MESSAGE Example: nmake -f Makefile-ftp.win FTPPORT=8021 !MESSAGE !ENDIF !IFNDEF MAKEOPT # Only default the behavior if MAKEOPT= is omitted !IFDEF _NMAKE_VER # Microsoft NMake options MAKEOPT=-nologo !ELSEIF "$(MAKE)" == "make" # Borland make options? Not really supported (yet) MAKEOPT=-s -N !ENDIF !ENDIF _buildr: @$(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=R LONG=Release _build _buildd: @$(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=D LONG=Debug _build installr: @$(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=R LONG=Release _build _install installd: @$(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=D LONG=Debug _build _install clean: _cleanr _cleand -if exist Browse\. rd /s Browse < << > nul y << !IF $(USEMAK) == 1 _cleanr: $(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=R LONG=Release CTARGET=CLEAN _build _cleand: $(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=D LONG=Debug CTARGET=CLEAN _build _build: echo Building Win32 $(LONG) targets ($(SHORT) suffixes) cd modules\ftp $(MAKE) $(MAKEOPT) -f mod_ftp.mak CFG="mod_ftp - Win32 $(LONG)" RECURSE=0 $(CTARGET) !IFDEF ALL $(MAKE) $(MAKEOPT) -f mod_ftp_example.mak CFG="mod_ftp_example - Win32 $(LONG)" RECURSE=0 $(CTARGET) !ENDIF cd ..\.. !ELSEIF $(USESLN) == 1 _cleanr: $(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=R LONG=Release CTARGET="/clean" _build _cleand: $(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=D LONG=Debug CTARGET="/clean" _build _build: echo Building Win32 $(LONG) targets ($(SHORT) suffixes) devenv mod_ftp.sln /useenv $(CTARGET) $(LONG) /project mod_ftp !IFDEF ALL devenv mod_ftp.sln /useenv $(CTARGET) $(LONG) /project mod_ftp_example !ENDIF !ELSE _cleanr: @$(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=R LONG=Release CTARGET="/CLEAN" _build _cleand: @$(MAKE) $(MAKEOPT) -f Makefile-ftp.win \ INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \ SHORT=D LONG=Debug CTARGET="/CLEAN" _build _build: @echo Building Win32 $(LONG) targets ($(SHORT) suffixes) @msdev mod_ftp.dsw /USEENV /MAKE "mod_ftp - Win32 $(LONG)" $(CTARGET) !IFDEF ALL @msdev mod_ftp.dsw /USEENV /MAKE "mod_ftp_example - Win32 $(LONG)" $(CTARGET) !ENDIF !ENDIF httpd_conffile=$(INSTDIR)\conf\httpd.conf httpd_origconffile=$(INSTDIR)\conf\original\httpd.conf _install: echo Y >.y echo A >.A -mkdir "$(INSTDIR)" -mkdir "$(INSTDIR)\conf" -mkdir "$(INSTDIR)\conf\extra" -mkdir "$(INSTDIR)\conf\original" -mkdir "$(INSTDIR)\conf\original\extra" -mkdir "$(INSTDIR)\ftpdocs" -mkdir "$(INSTDIR)\include" -mkdir "$(INSTDIR)\manual" -mkdir "$(INSTDIR)\modules" copy CHANGES-FTP "$(INSTDIR)\CHANGES-FTP.txt" <.y copy LICENSE-FTP "$(INSTDIR)\LICENSE-FTP.txt" <.y copy NOTICE-FTP "$(INSTDIR)\NOTICE-FTP.txt" <.y copy README-FTP "$(INSTDIR)\README-FTP.txt" <.y copy modules\ftp\$(LONG)\mod_ftp.so "$(INSTDIR)\modules" <.y copy modules\ftp\$(LONG)\mod_ftp.pdb "$(INSTDIR)\modules" <.y !IFDEF ALL copy modules\ftp\$(LONG)\mod_ftp_example.so "$(INSTDIR)\modules" <.y copy modules\ftp\$(LONG)\mod_ftp_example.pdb "$(INSTDIR)\modules" <.y !ENDIF xcopy docs\ftproot "$(INSTDIR)\ftpdocs" /d < .a xcopy docs\manual "$(INSTDIR)\manual" /s /d < .a copy include\mod_ftp.h "$(INSTDIR)\include" < .y > nul for %f in ("$(httpd_origconffile)" "$(httpd_conffile)") do \ if exist "%f" ( \ awk -f build/addloadexample.awk -v MODULE=ftp -v DSO=.so \ -v LIBPATH=modules -v EXAMPLECONF=conf/extra/ftpd.conf \ "%f" > "%f.new" && \ move "%f" "%f.bak" && move "%f.new" "%f" \ ) copy docs\conf\extra\ftpd.conf "$(INSTDIR)\conf\original\extra\ftpd.conf" <.y awk -f << docs\conf\extra\ftpd.conf > "$(INSTDIR)\conf\original\extra\ftpd.conf" /^\#@@LoadFtpModules@@/ { next; } { sub(/@exp_ftpdocsdir@/, "$(INSTDIR:\=/)/ftpdocs"); sub(/@exp_runtimedir@/, "logs"); sub(/@exp_sysconfdir@/, "conf"); sub(/@rel_sysconfdir@/, "conf"); sub(/@rel_logfiledir@/, "logs"); sub(/@@FTPPort@@/, "$(FTPPORT)"); sub(/you@ftp.example.com/, "$(SERVERADMIN)"); sub(/ftp.example.com/, "$(SERVERNAME)"); print $0; } << if not exist "$(INSTDIR)\conf\extra\ftpd.conf" \ copy "$(INSTDIR)\conf\original\extra\ftpd.conf" \ "$(INSTDIR)\conf\extra\ftpd.conf" <.y del .y del .a