-
Notifications
You must be signed in to change notification settings - Fork 61
/
Makefile.win
384 lines (353 loc) · 13.5 KB
/
Makefile.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# Makefile.win for Win32 APR + APR-iconv + APR-util
#
# Targets are:
#
# buildall - compile everything
# checkall - run APR + APR-util regression tests
# install - compile everything
# clean - mop up everything
#
# You can override the build mechanism, choose only one;
#
# USEMAK=1 - compile from exported make files
# USEDSW=1 - compile from .dsw / .dsp VC6 projects
# USESLN=1 - compile from converted .sln / .vcproj VC7+ files
#
# Define ARCH to your desired preference (your PATH must point
# to the correct compiler tools!) Choose only one;
#
# ARCH="Win32 Release"
# ARCH="Win32 Debug"
# ARCH="Win32 Release9x"
# ARCH="Win32 Debug9x"
# ARCH="x64 Release"
# ARCH="x64 Debug"
#
# Provide the APR_PATH, API_PATH and APU_PATH entirely relative
# to one another! At this time, building the libraries themselves
# is only expected to work if the defaults (../apr, ../apr-iconv
# and ../apr-util) are used, or if they are built with USEMAK=1.
#
# APR_PATH=..\apr-1.3.0
# API_PATH=..\apr-iconv-1.3.0
# APU_PATH=..\apr-util-1.3.0
#
# Provide a DBD_LIST argument after configuring LIB and INCLUDE with
# the SDK paths of the corresponding client support libraries.
# ODBC is always built on Windows, so it does not get included in DBD_LIST
# Note that at this time, none of these are supported on win32, per say.
#
# DBD_LIST="sqlite3 pgsql oracle mysql freetds"
#
# Provide a DBM_LIST argument after configuring LIB and INCLUDE with
# the SDK paths of the corresponding database support libraries. Right
# now only db has been configured, gdbm and ndbm require additional study.
# Note that at this time, none of these are supported on win32, per say.
#
# DBM_LIST="db gdbm"
#
# Provide a CRYPTO_LIST argument after configuring LIB and INCLUDE with
# the SDK paths of the corresponding cryptographic support libraries.
#
# CRYPTO_LIST="nss openssl"
#
# Provide the XML_PARSER argument after configuring LIB and INCLUDE with
# the expat path of the corresponding xml parser, e.g. libexpatMT to choose
# static, or libexpat (default) to choose the dynamic library for aprutil-1.dll
# (Static libaprutil-1.lib always presumes libexpatMT with XML_STATIC flag.)
#
# XML_PARSER="libexpat"
#
# For example;
#
# nmake -f Makefile.win PREFIX=C:\APR buildall checkall installall clean
#
!IF EXIST("aprutil.sln") && ([devenv /help > NUL 2>&1] == 0) \
&& !defined(USEMAK) && !defined(USEDSW)
USESLN=1
USEMAK=0
USEDSW=0
!ELSEIF EXIST("aprutil.mak") && !defined(USEDSW)
USESLN=0
USEMAK=1
USEDSW=0
!ELSE
USESLN=0
USEMAK=0
USEDSW=1
!ENDIF
PREFIX=..\apr-dist
!IF EXIST("..\openssl")
!IF EXIST("..\openssl\libcrypto.lib")
SSLOPT=_HAVE_OSSL110=1
!ENDIF
!ENDIF
# Legacy default (and unwise alternative) for libapr-1.dll is libexpatMT
XML_PARSER="libexpat"
!IF "$(XML_PARSER)" == "libexpat"
XMLOPT=XML_PARSER=$(XML_PARSER)
!ELSE
XMLOPT=XML_PARSER=$(XML_PARSER) XML_OPTIONS="/D XML_STATIC"
!ENDIF
!IF [$(COMSPEC) /c cl /nologo /? \
| $(SystemRoot)\System32\find.exe "x64" >NUL ] == 0
ARCH=x64 Release
!ELSE
ARCH=Win32 Release
!ENDIF
APR_PATH=..\apr
API_PATH=..\apr-iconv
APU_PATH=..\apr-util
!MESSAGE ARCH = $(ARCH)
!MESSAGE APR_PATH = $(APR_PATH)
!MESSAGE API_PATH = $(API_PATH) (apr-iconv)
!MESSAGE APU_PATH = $(APU_PATH) (apr-util)
!MESSAGE PREFIX = $(PREFIX) (install path)
!MESSAGE DBD_LIST = $(DBD_LIST)
!MESSAGE DBM_LIST = $(DBM_LIST)
!MESSAGE CRYPTO_LIST = $(CRYPTO_LIST)
# Utility and Translation things, nothing here for the user
#
!IF "$(ARCH)" == "Win32 Release"
SLNARCH=Release|Win32
ARCHPATH=Release
LIBSPATH=LibR
ARCHOSPATH=Release
LIBSOSPATH=LibR
!ELSEIF "$(ARCH)" == "Win32 Debug"
SLNARCH=Debug|Win32
ARCHPATH=Debug
LIBSPATH=LibD
ARCHOSPATH=Debug
LIBSOSPATH=LibD
!ELSEIF "$(ARCH)" == "Win32 Release9x"
SLNARCH=Release9x|Win32
ARCHPATH=Release
LIBSPATH=LibR
ARCHOSPATH=9x\Release
LIBSOSPATH=9x\LibR
!ELSEIF "$(ARCH)" == "Win32 Debug9x"
SLNARCH=Debug9x|Win32
ARCHPATH=Debug
LIBSPATH=LibD
ARCHOSPATH=9x\Debug
LIBSOSPATH=9x\LibD
!ELSEIF "$(ARCH)" == "x64 Release"
SLNARCH=Release|x64
ARCHPATH=x64\Release
LIBSPATH=x64\LibR
ARCHOSPATH=x64\Release
LIBSOSPATH=x64\LibR
!ELSEIF "$(ARCH)" == "x64 Debug"
SLNARCH=Debug|x64
ARCHPATH=x64\Debug
LIBSPATH=x64\LibD
ARCHOSPATH=x64\Debug
LIBSOSPATH=x64\LibD
!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
# Sanity Checks
#
!IF !EXIST("$(APR_PATH)\apr.dsp") || !EXIST("$(API_PATH)\apriconv.dsp") \
|| !EXIST("$(APU_PATH)\aprutil.dsp")
!MESSAGE Please check out or download and unpack the Apache Portability Runtime
!MESSAGE sources (apr, apr-iconv and apr-util) under a single parent dir,
!MESSAGE or provide APR_PATH, API_PATH and APU_PATH (all relative to each other,
!MESSAGE or all absolute paths).
!MESSAGE Apache cannot build without these libraries!
!MESSAGE
!ERROR Need apr and apr-iconv alongside apr-util to build!
!ENDIF
all: buildall checkall
# To help win32 pick up the locations where they don't fall in the usual
# path locations. This may not be completely effective for USESLN/USEDSP
# oriented builds, just yet
#
LIB=$(APR_PATH)\$(ARCHOSPATH);$(APR_PATH)\$(LIBSOSPATH);$(API_PATH)\$(ARCHPATH);$(API_PATH)\$(LIBSPATH);$(APU_PATH)\$(ARCHPATH);$(APU_PATH)\$(LIBSPATH);$(LIB)
INCLUDE=$(APR_PATH)\include;$(API_PATH)\include;$(INCLUDE)
!IF $(USEMAK) == 1
clean:
$(MAKE) $(MAKEOPT) -f Makefile.win ARCH="$(ARCH)" \
CTARGET=CLEAN buildall
buildall:
cd $(APR_PATH)
$(MAKE) $(MAKEOPT) -f apr.mak CFG="apr - $(ARCH)" RECURSE=0 $(CTARGET)
$(MAKE) $(MAKEOPT) -f libapr.mak CFG="libapr - $(ARCH)" RECURSE=0 $(CTARGET)
cd build
$(MAKE) $(MAKEOPT) -f aprapp.mak CFG="aprapp - $(ARCH)" RECURSE=0 $(CTARGET)
$(MAKE) $(MAKEOPT) -f libaprapp.mak CFG="libaprapp - $(ARCH)" RECURSE=0 $(CTARGET)
cd ..
cd $(API_PATH)
$(MAKE) $(MAKEOPT) -f apriconv.mak CFG="apriconv - $(ARCH)" RECURSE=0 $(CTARGET)
$(MAKE) $(MAKEOPT) -f libapriconv.mak CFG="libapriconv - $(ARCH)" RECURSE=0 $(CTARGET)
!IF "$(CTARGET)" == "CLEAN"
$(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
!ELSE
cd ccs
$(MAKE) $(MAKEOPT) -f Makefile.win all \
BUILD_MODE="$(ARCH)" BIND_MODE=shared
cd ..\ces
$(MAKE) $(MAKEOPT) -f Makefile.win all \
BUILD_MODE="$(ARCH)" BIND_MODE=shared
cd ..
!ENDIF
cd $(APU_PATH)
$(MAKE) $(MAKEOPT) $(SSLOPT) $(XMLOPT) -f aprutil.mak CFG="aprutil - $(ARCH)" RECURSE=0 $(CTARGET)
$(MAKE) $(MAKEOPT) $(SSLOPT) $(XMLOPT) -f libaprutil.mak CFG="libaprutil - $(ARCH)" RECURSE=0 $(CTARGET)
cd ldap
$(MAKE) $(MAKEOPT) -f apr_ldap.mak CFG="apr_ldap - $(ARCH)" RECURSE=0 $(CTARGET)
cd ..
cd dbd
for %d in (odbc $(DBD_LIST)) do \
$(MAKE) $(MAKEOPT) -f apr_dbd_%d.mak CFG="apr_dbd_%d - $(ARCH)" RECURSE=0 $(CTARGET)
cd ..
cd dbm
for %d in ($(DBM_LIST) x) do if not %d == x \
$(MAKE) $(MAKEOPT) -f apr_dbm_%d.mak CFG="apr_dbm_%d - $(ARCH)" RECURSE=0 $(CTARGET)
cd ..
cd crypto
for %d in ($(CRYPTO_LIST) x) do if not %d == x \
$(MAKE) $(MAKEOPT) $(SSLOPT) -f apr_crypto_%d.mak CFG="apr_crypto_%d - $(ARCH)" RECURSE=0 $(CTARGET)
cd ..
!ELSEIF $(USESLN) == 1
clean:
-for %d in (odbc $(DBD_LIST)) do \
devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project apr_dbd_%d
-for %d in ($(DBM_LIST) x) do if not %d == x \
devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project apr_dbm_%d
-for %d in ($(CRYPTO_LIST) x) do if not %d == x \
devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project apr_crypto_%d
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project apr_ldap
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project libaprutil
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project aprutil
cd $(API_PATH)
-$(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
cd $(APU_PATH)
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project libapriconv
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project apriconv
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project libaprapp
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project aprapp
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project libapr
-devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project apr
buildall:
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project aprapp
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project libaprapp
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project aprutil
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project libaprutil
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project apr_ldap
for %d in (odbc $(DBD_LIST)) do \
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project apr_dbd_%d
for %d in ($(DBM_LIST) x) do if not %d == x \
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project apr_dbm_%d
for %d in ($(CRYPTO_LIST) x) do if not %d == x \
devenv aprutil.sln /useenv /build "$(SLNARCH)" /project apr_crypto_%d
!ELSE
# $(USEDSP) == 1
clean:
-for %d in (odbc $(DBD_LIST)) do \
msdev aprutil.dsw /USEENV /MAKE "apr_dbd_%d - $(ARCH)" /CLEAN
-for %d in ($(DBM_LIST) x) do if not %d == x \
msdev aprutil.dsw /USEENV /MAKE "apr_dbm_%d - $(ARCH)" /CLEAN
-for %d in ($(CRYPTO_LIST) x) do if not %d == x \
msdev aprutil.dsw /USEENV /MAKE "apr_crypto_%d - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "apr_ldap - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "libaprutil - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "aprutil - $(ARCH)" /CLEAN
cd $(API_PATH)
$(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
cd $(APU_PATH)
-msdev aprutil.dsw /USEENV /MAKE "libapriconv - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "apriconv - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "libaprapp - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "aprapp - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "libapr - $(ARCH)" /CLEAN
-msdev aprutil.dsw /USEENV /MAKE "apr - $(ARCH)" /CLEAN
buildall:
@msdev aprutil.dsw /USEENV /MAKE "aprapp - $(ARCH)"
@msdev aprutil.dsw /USEENV /MAKE "aprutil - $(ARCH)"
@msdev aprutil.dsw /USEENV /MAKE "libaprapp - $(ARCH)"
@msdev aprutil.dsw /USEENV /MAKE "libaprutil - $(ARCH)"
@msdev aprutil.dsw /USEENV /MAKE "apr_ldap - $(ARCH)"
@for %d in (odbc $(DBD_LIST)) do \
msdev aprutil.dsw /USEENV /MAKE "apr_dbd_%d - $(ARCH)"
@for %d in ($(DBM_LIST) x) do if not %d == x \
msdev aprutil.dsw /USEENV /MAKE "apr_dbm_%d - $(ARCH)"
@for %d in ($(CRYPTO_LIST) x) do if not %d == x \
msdev aprutil.dsw /USEENV /MAKE "apr_crypto_%d - $(ARCH)"
!ENDIF
checkapr:
cd $(APR_PATH)\test
$(MAKE) $(MAKEOPT) -f Makefile.win MODEL=static \
OUTDIR=$(LIBSOSPATH) check
$(MAKE) $(MAKEOPT) -f Makefile.win MODEL=dynamic \
OUTDIR=$(ARCHOSPATH) check
cd ..
cd $(APU_PATH)
checkapu:
cd $(APU_PATH)
cd test
$(MAKE) $(MAKEOPT) -f Makefile.win MODEL=static \
OUTDIR=$(LIBSPATH) APROUTDIR=$(LIBSOSPATH) \
APR_PATH=..\$(APR_PATH) API_PATH=..\$(API_PATH) check
$(MAKE) $(MAKEOPT) -f Makefile.win MODEL=dynamic \
OUTDIR=$(ARCHPATH) APROUTDIR=$(ARCHOSPATH) \
APR_PATH=..\$(APR_PATH) API_PATH=..\$(API_PATH) check
cd ..
checkall: checkapr checkapu
install:
echo Y >.y
echo A >.A
@if NOT EXIST "$(PREFIX)\." mkdir "$(PREFIX)"
@if NOT EXIST "$(PREFIX)\bin\." mkdir "$(PREFIX)\bin"
@if NOT EXIST "$(PREFIX)\bin\iconv\." mkdir "$(PREFIX)\bin\iconv"
@if NOT EXIST "$(PREFIX)\include\." mkdir "$(PREFIX)\include"
@if NOT EXIST "$(PREFIX)\lib\." mkdir "$(PREFIX)\lib"
copy CHANGES "$(PREFIX)\CHANGES.txt" <.y
copy LICENSE "$(PREFIX)\LICENSE.txt" <.y
copy NOTICE "$(PREFIX)\NOTICE.txt" <.y
xcopy $(APR_PATH)\include\*.h "$(PREFIX)\include\" /d < .a
xcopy $(APU_PATH)\include\*.h "$(PREFIX)\include\" /d < .a
copy $(APR_PATH)\$(LIBSOSPATH)\apr-1.lib "$(PREFIX)\lib\" <.y
copy $(APR_PATH)\$(LIBSOSPATH)\apr-1.pdb "$(PREFIX)\lib\" <.y
copy $(APU_PATH)\$(LIBSPATH)\aprutil-1.lib "$(PREFIX)\lib\" <.y
copy $(APU_PATH)\$(LIBSPATH)\aprutil-1.pdb "$(PREFIX)\lib\" <.y
copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.lib "$(PREFIX)\lib\" <.y
copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.exp "$(PREFIX)\lib\" <.y
copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.lib "$(PREFIX)\lib\" <.y
copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.exp "$(PREFIX)\lib\" <.y
copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.dll "$(PREFIX)\bin\" <.y
copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.pdb "$(PREFIX)\bin\" <.y
copy $(API_PATH)\$(ARCHPATH)\libapriconv-1.dll "$(PREFIX)\bin\" <.y
copy $(API_PATH)\$(ARCHPATH)\libapriconv-1.pdb "$(PREFIX)\bin\" <.y
copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.dll "$(PREFIX)\bin\" <.y
copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.pdb "$(PREFIX)\bin\" <.y
copy $(APU_PATH)\ldap\$(ARCHPATH)\apr_ldap-1.dll "$(PREFIX)\bin\" <.y
copy $(APU_PATH)\ldap\$(ARCHPATH)\apr_ldap-1.pdb "$(PREFIX)\bin\" <.y
for %d in (odbc $(DBD_LIST)) do ( \
copy $(APU_PATH)\dbd\$(ARCHPATH)\apr_dbd_%d-1.dll "$(PREFIX)\bin\" <.y && \
copy $(APU_PATH)\dbd\$(ARCHPATH)\apr_dbd_%d-1.pdb "$(PREFIX)\bin\" <.y \
)
for %d in ($(DBM_LIST) x) do if not %d == x ( \
copy $(APU_PATH)\dbm\$(ARCHPATH)\apr_dbm_%d-1.dll "$(PREFIX)\bin\" <.y && \
copy $(APU_PATH)\dbm\$(ARCHPATH)\apr_dbm_%d-1.pdb "$(PREFIX)\bin\" <.y \
)
for %d in ($(CRYPTO_LIST) x) do if not %d == x ( \
copy $(APU_PATH)\crypto\$(ARCHPATH)\apr_crypto_%d-1.dll "$(PREFIX)\bin\" <.y && \
copy $(APU_PATH)\crypto\$(ARCHPATH)\apr_crypto_%d-1.pdb "$(PREFIX)\bin\" <.y \
)
xcopy $(API_PATH)\$(ARCHPATH)\iconv\*.so "$(PREFIX)\bin\iconv\" /d < .a
xcopy $(API_PATH)\$(ARCHPATH)\iconv\*.pdb "$(PREFIX)\bin\iconv\" /d < .a
del .y
del .a