]> granicus.if.org Git - apache/blob - Makefile.win
One, it's very hard to type perl without $'s (stolen by the .mak parser)
[apache] / Makefile.win
1 # Makefile for Windows NT and Windows 95/98/2000
2
3 # Targets are:
4 #   _apacher   - build Apache in Release mode
5 #   _apached   - build Apache in Debug mode
6 #   installr   - build and install a Release build
7 #   installd   - build and install a Debug build
8 #   clean      - remove (most) generated files
9 #   _cleanr    - remove (most) files generated by a Release build
10 #   _cleand    - remove (most) files generated by a Debug build
11 #
12 # The default installation directory is \Apache. This can be changed
13 # with the INSTDIR macro, for example:
14 #
15 #   nmake /f Makefile.win INSTDIR="d:\Program Files\Apache" installr
16 #
17 # Note: this does *NOT* change the compiled in default "server root"
18
19 !IF "$(INSTDIR)" == ""
20 INSTDIR=\Apache
21 !MESSAGE Using default install directory \Apache
22 !ENDIF 
23
24 !IFNDEF MAKEOPT
25 # Only default the behavior if MAKEOPT= is omitted
26 !IF "$(MAKE)" == "NMAKE"
27 # Microsoft NMake options
28 MAKEOPT=-nologo
29 !ELSEIF "($MAKE)" == "make"
30 # Borland make options?  Not really supported (yet)
31 MAKEOPT=-s -N
32 !ENDIF
33 !ENDIF
34
35 default:        _apacher
36
37 _apacher: 
38         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release _build
39
40 _apached: 
41         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   _build
42
43 installr: 
44         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release _build _install
45
46 installd: 
47         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   _build _install
48
49 _cleanr:  
50         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release CTARGET=CLEAN _build
51
52 _cleand:  
53         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   CTARGET=CLEAN _build
54
55 clean:
56         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=R LONG=Release CTARGET=CLEAN _build
57         $(MAKE) $(MAKEOPT) -f Makefile.win SHORT=D LONG=Debug   CTARGET=CLEAN _build
58
59 _build:
60         echo Building Win32 $(LONG) targets ($(SHORT) suffixes)
61         cd srclib\apr
62 #        aprlibdll creates the dynamic aprlib.dll from the static library project aprlib.dsp
63          $(MAKE) $(MAKEOPT) -f aprlib.mak CFG="aprlib - Win32 $(LONG)" RECURSE=0 $(CTARGET)
64          $(MAKE) $(MAKEOPT) -f aprlibdll.mak CFG="aprlibdll - Win32 $(LONG)" RECURSE=0 $(CTARGET)
65         cd ..\..
66         cd srclib\apr-util
67 #        aprutildll creates the dynamic apr-util.dll from the static library project aprutil.dsp
68          $(MAKE) $(MAKEOPT) -f aprutil.mak CFG="aprutil - Win32 $(LONG)" RECURSE=0 $(CTARGET)
69          $(MAKE) $(MAKEOPT) -f aprutildll.mak CFG="aprutildll - Win32 $(LONG)" RECURSE=0 $(CTARGET)
70         cd ..\..
71         cd srclib\expat-lite
72          $(MAKE) $(MAKEOPT) -f expatlib.mak CFG="expatlib - Win32 $(LONG)" RECURSE=0 $(CTARGET)
73         cd ..\..
74         cd srclib\pcre
75          $(MAKE) $(MAKEOPT) -f dftables.mak CFG="dftables - Win32 $(LONG)" RECURSE=0 $(CTARGET)
76          $(MAKE) $(MAKEOPT) -f pcre.mak CFG="pcre - Win32 $(LONG)" RECURSE=0 $(CTARGET)
77          $(MAKE) $(MAKEOPT) -f pcreposix.mak CFG="pcreposix - Win32 $(LONG)" RECURSE=0 $(CTARGET)
78         cd ..\..
79         cd srclib\sdbm
80          $(MAKE) $(MAKEOPT) -f sdbmlib.mak CFG="sdbmlib - Win32 $(LONG)" RECURSE=0 $(CTARGET)
81         cd ..\..
82         cd server
83          $(MAKE) $(MAKEOPT) -f gen_uri_delims.mak CFG="gen_uri_delims - Win32 $(LONG)" RECURSE=0 $(CTARGET)
84          $(MAKE) $(MAKEOPT) -f gen_test_char.mak CFG="gen_test_char - Win32 $(LONG)" RECURSE=0 $(CTARGET)
85         cd ..
86          -del Core$(SHORT)\buildmark.obj
87 #        ApacheCoreDll creates the dynamic ApacheCore.dll from the static library project ApacheCore
88          $(MAKE) $(MAKEOPT) -f ApacheCore.mak CFG="ApacheCore - Win32 $(LONG)" RECURSE=0 $(CTARGET)
89          $(MAKE) $(MAKEOPT) -f ApacheCoreDll.mak CFG="ApacheCoreDll - Win32 $(LONG)" RECURSE=0 $(CTARGET)
90          $(MAKE) $(MAKEOPT) -f Apache.mak CFG="Apache - Win32 $(LONG)" RECURSE=0 $(CTARGET)
91         cd modules\aaa
92          $(MAKE) $(MAKEOPT) -f mod_auth_anon.mak CFG="mod_auth_anon - Win32 $(LONG)" RECURSE=0 $(CTARGET)
93          $(MAKE) $(MAKEOPT) -f mod_auth_dbm.mak CFG="mod_auth_dbm - Win32 $(LONG)" RECURSE=0 $(CTARGET)
94          $(MAKE) $(MAKEOPT) -f mod_auth_digest.mak CFG="mod_auth_digest - Win32 $(LONG)" RECURSE=0 $(CTARGET)
95         cd ..\..
96         cd modules\cache
97          $(MAKE) $(MAKEOPT) -f mod_file_cache.mak CFG="mod_file_cache - Win32 $(LONG)" RECURSE=0 $(CTARGET)
98         cd ..\..
99         cd modules\dav\main
100          $(MAKE) $(MAKEOPT) -f mod_dav.mak CFG="mod_dav - Win32 $(LONG)" RECURSE=0 $(CTARGET)
101         cd ..\..\..
102         cd modules\dav\fs
103          $(MAKE) $(MAKEOPT) -f mod_dav_fs.mak CFG="mod_dav_fs - Win32 $(LONG)" RECURSE=0 $(CTARGET)
104         cd ..\..\..
105         cd modules\generators
106 #        $(MAKE) $(MAKEOPT) -f mod_info.mak CFG"=mod_info - Win32 $(LONG)" RECURSE=0 $(CTARGET)
107          $(MAKE) $(MAKEOPT) -f mod_status.mak CFG="mod_status - Win32 $(LONG)" RECURSE=0 $(CTARGET)
108         cd ..\..
109         cd modules\mappers
110          $(MAKE) $(MAKEOPT) -f mod_rewrite.mak CFG="mod_rewrite - Win32 $(LONG)" RECURSE=0 $(CTARGET)
111          $(MAKE) $(MAKEOPT) -f mod_speling.mak CFG="mod_speling - Win32 $(LONG)" RECURSE=0 $(CTARGET)
112         cd ..\..
113         cd modules\metadata
114          $(MAKE) $(MAKEOPT) -f mod_cern_meta.mak CFG="mod_cern_meta - Win32 $(LONG)" RECURSE=0 $(CTARGET)
115          $(MAKE) $(MAKEOPT) -f mod_expires.mak CFG="mod_expires - Win32 $(LONG)" RECURSE=0 $(CTARGET)
116          $(MAKE) $(MAKEOPT) -f mod_headers.mak CFG="mod_headers - Win32 $(LONG)" RECURSE=0 $(CTARGET)
117          $(MAKE) $(MAKEOPT) -f mod_usertrack.mak CFG="mod_usertrack - Win32 $(LONG)" RECURSE=0 $(CTARGET)
118         cd ..\..
119         cd modules\proxy
120 #        $(MAKE) $(MAKEOPT) -f mod_proxy.mak CFG="mod_proxy - Win32 $(LONG)" RECURSE=0 $(CTARGET)
121         cd ..\..
122         cd support
123          $(MAKE) $(MAKEOPT) -f ab.mak CFG="ab - Win32 $(LONG)" RECURSE=0 $(CTARGET)
124          $(MAKE) $(MAKEOPT) -f htpasswd.mak CFG="htpasswd - Win32 $(LONG)" RECURSE=0 $(CTARGET)
125          $(MAKE) $(MAKEOPT) -f htdigest.mak CFG="htdigest - Win32 $(LONG)" RECURSE=0 $(CTARGET)
126          $(MAKE) $(MAKEOPT) -f logresolve.mak CFG="logresolve - Win32 $(LONG)" RECURSE=0 $(CTARGET)
127          $(MAKE) $(MAKEOPT) -f rotatelogs.mak CFG="rotatelogs - Win32 $(LONG)" RECURSE=0 $(CTARGET)
128         cd ..
129
130 _install:
131         -mkdir $(INSTDIR)
132         -mkdir $(INSTDIR)\modules
133         -mkdir $(INSTDIR)\logs
134         -mkdir $(INSTDIR)\conf
135         -mkdir $(INSTDIR)\bin
136         copy Apache$(SHORT)\Apache.exe $(INSTDIR)
137         copy Core$(SHORT)\ApacheCore.dll $(INSTDIR)
138         copy srclib\apr\$(LONG)\aprlib.dll $(INSTDIR)
139         copy srclib\apr-util\$(LONG)\apr-util.dll $(INSTDIR)
140         copy srclib\expat-lite\$(LONG)\expatlib.dll $(INSTDIR)
141         copy modules\aaa\mod_auth_anon$(SHORT)\mod_auth_anon.dll $(INSTDIR)\modules
142         copy modules\aaa\mod_auth_dbm$(SHORT)\mod_auth_dbm.dll $(INSTDIR)\modules
143         copy modules\aaa\mod_auth_digest$(SHORT)\mod_auth_digest.dll $(INSTDIR)\modules
144         copy modules\cache\mod_file_cache$(SHORT)\mod_file_cache.dll $(INSTDIR)\modules
145         copy modules\dav\fs\mod_dav_fs$(SHORT)\mod_dav_fs.dll $(INSTDIR)\modules
146         copy modules\dav\main\mod_dav$(SHORT)\mod_dav.dll $(INSTDIR)\modules
147 #       copy modules\generators\mod_info$(SHORT)\mod_info.dll $(INSTDIR)\modules
148         copy modules\generators\mod_status$(SHORT)\mod_status.dll $(INSTDIR)\modules
149         copy modules\mappers\mod_rewrite$(SHORT)\mod_rewrite.dll $(INSTDIR)\modules
150         copy modules\mappers\mod_speling$(SHORT)\mod_speling.dll $(INSTDIR)\modules
151         copy modules\metadata\mod_cern_meta$(SHORT)\mod_cern_meta.dll $(INSTDIR)\modules
152         copy modules\metadata\mod_expires$(SHORT)\mod_expires.dll $(INSTDIR)\modules
153         copy modules\metadata\mod_headers$(SHORT)\mod_headers.dll $(INSTDIR)\modules
154         copy modules\metadata\mod_usertrack$(SHORT)\mod_usertrack.dll $(INSTDIR)\modules
155 #       copy modules\proxy\mod_proxy$(SHORT)\mod_proxy.dll $(INSTDIR)\modules
156         copy support\$(LONG)\ab.exe $(INSTDIR)\bin
157         copy support\$(LONG)\htpasswd.exe $(INSTDIR)\bin
158         copy support\$(LONG)\htdigest.exe $(INSTDIR)\bin
159         copy support\$(LONG)\logresolve.exe $(INSTDIR)\bin
160         copy support\$(LONG)\rotatelogs.exe $(INSTDIR)\bin
161         perl <<
162
163     my $$serverroot = '$(INSTDIR)';
164     $$serverroot =~ s|\\|\/|;
165     open(IN, '< docs\conf\httpd-win.conf') 
166         || die 'Source httpd-win.conf not found in docs\conf';
167     open(OUT, '> $(INSTDIR)\conf\httpd-default.conf') 
168         || die 'Create file $(INSTDIR)\docs\conf\httpd-default.conf failed';
169     while (<IN>) {
170         while (s|\@\@ServerRoot\@\@|$$serverroot|) {}
171         print OUT $_;
172     }
173     print 'Installed httpd-default.conf in $(INSTDIR)\conf' . "\n";
174     close (OUT); 
175     seek(IN, 0, SEEK_SET);
176     if (open(OUT, '< $(INSTDIR)\conf\httpd.conf')) { 
177         print 'Existing $(INSTDIR)\docs\conf\httpd.conf preserved' . "\n";
178         close(OUT); close(IN); exit;
179     }
180     open(OUT, '> $(INSTDIR)\conf\httpd.conf') 
181         || die 'Create file $(INSTDIR)\docs\conf\httpd.conf failed';
182     while (<IN>) {
183         while (s|\@\@ServerRoot\@\@|$$serverroot|) {}
184         print OUT $_;
185     }
186     print 'Installed httpd.conf in $(INSTDIR)\conf' . "\n";
187     close(OUT); close(IN);
188 <<