forked from hyperic/mod_bmx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-bmx.win
226 lines (198 loc) · 6.71 KB
/
Makefile-bmx.win
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#
# NMAKE Makefile for Microsoft Windows
#
# 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
#
# The following install defaults may be customized;
#
# Option Default
# INSTDIR /Apache22
#
# For example;
#
# nmake -f Makefile-bmx.win 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\bmx\mod_bmx.vcproj") \
&& ([devenv /help > NUL 2>&1] == 0) \
&& !defined(USEMAK) && !defined(USEDSW)
USESLN=1
USEMAK=0
USEDSW=0
!ELSEIF EXIST("modules\bmx\mod_bmx.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_bmx cannot build without these files!
!ENDIF
!IF "$(LONG)" == ""
!MESSAGE
!MESSAGE INSTDIR = $(INSTDIR)
!MESSAGE APACHE2_HOME = $(APACHE2_HOME)
!MESSAGE
!MESSAGE To change these options use 'nmake -f Makefile-bmx.win [option=value]'
!MESSAGE Example: nmake -f Makefile-bmx.win
!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-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=R LONG=Release _build
_buildd:
@$(MAKE) $(MAKEOPT) -f Makefile-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=D LONG=Debug _build
installr:
@$(MAKE) $(MAKEOPT) -f Makefile-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=R LONG=Release _build _install
installd:
@$(MAKE) $(MAKEOPT) -f Makefile-bmx.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-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=R LONG=Release CTARGET=CLEAN _build
_cleand:
$(MAKE) $(MAKEOPT) -f Makefile-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=D LONG=Debug CTARGET=CLEAN _build
_build:
echo Building Win32 $(LONG) targets ($(SHORT) suffixes)
cd modules\bmx
$(MAKE) $(MAKEOPT) -f mod_bmx.mak CFG="mod_bmx - Win32 $(LONG)" RECURSE=0 $(CTARGET)
$(MAKE) $(MAKEOPT) -f mod_bmx_example.mak CFG="mod_bmx_example - Win32 $(LONG)" RECURSE=0 $(CTARGET)
$(MAKE) $(MAKEOPT) -f mod_bmx_status.mak CFG="mod_bmx_status - Win32 $(LONG)" RECURSE=0 $(CTARGET)
$(MAKE) $(MAKEOPT) -f mod_bmx_vhost.mak CFG="mod_bmx_vhost - Win32 $(LONG)" RECURSE=0 $(CTARGET)
cd ..\..
!ELSEIF $(USESLN) == 1
_cleanr:
$(MAKE) $(MAKEOPT) -f Makefile-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=R LONG=Release CTARGET="/clean" _build
_cleand:
$(MAKE) $(MAKEOPT) -f Makefile-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=D LONG=Debug CTARGET="/clean" _build
_build:
echo Building Win32 $(LONG) targets ($(SHORT) suffixes)
devenv mod_bmx.sln /useenv $(CTARGET) $(LONG) /project mod_bmx
devenv mod_bmx.sln /useenv $(CTARGET) $(LONG) /project mod_bmx_example
devenv mod_bmx.sln /useenv $(CTARGET) $(LONG) /project mod_bmx_status
devenv mod_bmx.sln /useenv $(CTARGET) $(LONG) /project mod_bmx_vhost
!ELSE
_cleanr:
@$(MAKE) $(MAKEOPT) -f Makefile-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=R LONG=Release CTARGET="/CLEAN" _build
_cleand:
@$(MAKE) $(MAKEOPT) -f Makefile-bmx.win \
INSTDIR="$(INSTDIR)" APACHE2_HOME="$(APACHE2_HOME)" \
SHORT=D LONG=Debug CTARGET="/CLEAN" _build
_build:
@echo Building Win32 $(LONG) targets ($(SHORT) suffixes)
@msdev mod_bmx.dsw /USEENV /MAKE \
"mod_bmx - Win32 $(LONG)" $(CTARGET) \
"mod_bmx_example - Win32 $(LONG)" $(CTARGET) \
"mod_bmx_status - Win32 $(LONG)" $(CTARGET) \
"mod_bmx_vhost - Win32 $(LONG)" $(CTARGET)
!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\original"
!IFDEF HAVE_HTTPD_BMX_CONF
-mkdir "$(INSTDIR)\conf\extra"
-mkdir "$(INSTDIR)\conf\original\extra"
!ENDIF
-mkdir "$(INSTDIR)\include"
-mkdir "$(INSTDIR)\manual"
-mkdir "$(INSTDIR)\modules"
copy CHANGES-BMX.txt "$(INSTDIR)\CHANGES-BMX.txt" <.y
copy LICENSE-BMX.txt "$(INSTDIR)\LICENSE-BMX.txt" <.y
copy NOTICE-BMX.txt "$(INSTDIR)\NOTICE-BMX.txt" <.y
copy README-BMX.txt "$(INSTDIR)\README-BMX.txt" <.y
copy modules\bmx\$(LONG)\mod_bmx.so "$(INSTDIR)\modules" <.y
copy modules\bmx\$(LONG)\mod_bmx.pdb "$(INSTDIR)\modules" <.y
copy modules\bmx\$(LONG)\mod_bmx_status.so "$(INSTDIR)\modules" <.y
copy modules\bmx\$(LONG)\mod_bmx_status.pdb "$(INSTDIR)\modules" <.y
copy modules\bmx\$(LONG)\mod_bmx_vhost.so "$(INSTDIR)\modules" <.y
copy modules\bmx\$(LONG)\mod_bmx_vhost.pdb "$(INSTDIR)\modules" <.y
xcopy docs\manual "$(INSTDIR)\manual" /s /d < .a
copy include\mod_bmx.h "$(INSTDIR)\include" < .y > nul
for %f in ("$(httpd_origconffile)" "$(httpd_conffile)") do \
if exist "%f" ( \
awk -f build/addloadexample.awk -v MODULE=bmx -v DSO=.so \
!IFDEF HAVE_HTTPD_BMX_CONF
-v EXAMPLECONF=conf/extra/httpd-bmx.conf \
!ENDIF
-v LIBPATH=modules "%f" > "%f.new" && \
move "%f" "%f.bak" && move "%f.new" "%f" \
)
!IFDEF HAVE_HTTPD_BMX_CONF
copy docs\conf\extra\httpd-bmx.conf "$(INSTDIR)\conf\original\extra\httpd-bmx.conf" <.y
awk -f << docs\conf\extra\httpd-bmx.conf > "$(INSTDIR)\conf\original\extra\httpd-bmx.conf"
/^\#@@LoadBmxModules@@/ { next; }
{ sub(/@exp_runtimedir@/, "logs");
sub(/@exp_sysconfdir@/, "conf");
sub(/@rel_sysconfdir@/, "conf");
sub(/@rel_logfiledir@/, "logs");
print $0;
}
<<
if not exist "$(INSTDIR)\conf\extra\httpd-bmx.conf" \
copy "$(INSTDIR)\conf\original\extra\httpd-bmx.conf" \
"$(INSTDIR)\conf\extra\httpd-bmx.conf" <.y
!ENDIF
del .y
del .a