Export apr_dbd_mutex_lock/unlock for the drivers to see
[apr-util.git] / Makefile.win
blob53d83dab069dc14651a04f5c7fab96443f1beefd
1 # Makefile.win for Win32 APR + APR-iconv + APR-util
3 # Targets are:
5 #     buildall - compile everything
6 #     checkall - run APR + APR-util regression tests
7 #     install  - compile everything
8 #     clean    - mop up everything
10 # You can override the build mechansim, choose only one;
12 #     USEMAK=1 - compile from exported make files
13 #     USEDSW=1 - compile from .dsw / .dsp VC6 projects
14 #     USESLN=1 - compile from converted .sln / .vcproj VC7+ files
16 # Define ARCH to your desired preference (your PATH must point
17 # to the correct compiler tools!)  Choose only one;
19 #     ARCH="Win32 Release"
20 #     ARCH="Win32 Debug"
21 #     ARCH="Win32 Release9x"
22 #     ARCH="Win32 Debug9x"
23 #     ARCH="x64 Release"
24 #     ARCH="x64 Debug"
26 # Provide the APR_PATH, API_PATH and APU_PATH all as absolute paths, 
27 # or all as paths RELATIVE TO ONE ANOTHER!
29 #     APR_PATH=..\apr-1.3.0
30 #     API_PATH=..\apr-iconv-1.3.0
31 #     APU_PATH=..\apr-util-1.3.0
33 # For example;
35 #   nmake -f Makefile.win PREFIX=C:\APR buildall checkall installall clean
38 !IF EXIST("aprutil.sln") && ([devenv /help > NUL 2>&1] == 0) \
39     && !defined(USEMAK) && !defined(USEDSW)
40 USESLN=1
41 USEMAK=0
42 USEDSW=0
43 !ELSEIF EXIST("aprutil.mak") && !defined(USEDSW)
44 USESLN=0
45 USEMAK=1
46 USEDSW=0
47 !ELSE
48 USESLN=0
49 USEMAK=0
50 USEDSW=1
51 !ENDIF
53 PREFIX=..\apr-dist
55 !IF [$(COMSPEC) /c cl /nologo /? | find "x64" >NUL ] == 0
56 ARCH=x64 Release
57 !ELSE
58 ARCH=Win32 Release
59 !ENDIF
61 APR_PATH=..\apr
62 API_PATH=..\apr-iconv
63 APU_PATH=..\apr-util
65 # Never build ssl by default, plus this needs work
67 #OPENSSL_DIR=..\openssl
69 !MESSAGE ARCH        = $(ARCH)
70 !MESSAGE APR_PATH    = $(APR_PATH)
71 !MESSAGE API_PATH    = $(API_PATH)  (apr-iconv)
72 !MESSAGE APU_PATH    = $(APU_PATH)  (apr-util)
73 !IFDEF OPENSSL_DIR
74 !MESSAGE OPENSSL_DIR = $(OPENSSL_DIR)  (openssl)
75 !ENDIF
76 !MESSAGE PREFIX      = $(PREFIX)  (install path)
79 # Utility and Translation things, nothing here for the user
81 !IF "$(ARCH)" == "Win32 Release"
82 SLNARCH=Release|Win32
83 ARCHPATH=Release
84 LIBSPATH=LibR
85 ARCHOSPATH=Release
86 LIBSOSPATH=LibR
87 !ELSEIF "$(ARCH)" == "Win32 Debug"
88 SLNARCH=Debug|Win32
89 ARCHPATH=Debug
90 LIBSPATH=LibD
91 ARCHOSPATH=Debug
92 LIBSOSPATH=LibD
93 !ELSEIF "$(ARCH)" == "Win32 Release9x"
94 SLNARCH=Release9x|Win32
95 ARCHPATH=Release
96 LIBSPATH=LibR
97 ARCHOSPATH=9x\Release
98 LIBSOSPATH=9x\LibR
99 !ELSEIF "$(ARCH)" == "Win32 Debug9x"
100 SLNARCH=Debug9x|Win32
101 ARCHPATH=Debug
102 LIBSPATH=LibD
103 ARCHOSPATH=9x\Debug
104 LIBSOSPATH=9x\LibD
105 !ELSEIF "$(ARCH)" == "x64 Release"
106 SLNARCH=Release|x64
107 ARCHPATH=x64\Release
108 LIBSPATH=x64\LibR
109 ARCHOSPATH=x64\Release
110 LIBSOSPATH=x64\LibR
111 !ELSEIF "$(ARCH)" == "x64 Debug"
112 SLNARCH=Debug|x64
113 ARCHPATH=x64\Debug
114 LIBSPATH=x64\LibD
115 ARCHOSPATH=x64\Debug
116 LIBSOSPATH=x64\LibD
117 !ENDIF
119 !IFNDEF MAKEOPT
120 # Only default the behavior if MAKEOPT= is omitted
121 !IFDEF _NMAKE_VER
122 # Microsoft NMake options
123 MAKEOPT=-nologo
124 !ELSEIF "$(MAKE)" == "make"
125 # Borland make options?  Not really supported (yet)
126 MAKEOPT=-s -N
127 !ENDIF
128 !ENDIF
131 # Sanity Checks
133 !IF !EXIST("$(APR_PATH)\apr.dsp") || !EXIST("$(API_PATH)\apriconv.dsp") \
134  || !EXIST("$(APU_PATH)\aprutil.dsp")
135 !MESSAGE Please check out or download and unpack the Apache Portability Runtime
136 !MESSAGE sources (apr, apr-iconv and apr-util) under a single parent dir,
137 !MESSAGE or provide APR_PATH, API_PATH and APU_PATH (all relative to each other,
138 !MESSAGE or all absolute paths).
139 !MESSAGE Apache cannot build without these libraries!
140 !MESSAGE 
141 !ERROR Need apr and apr-iconv alongside apr-util to build!
142 !ENDIF
145 all: buildall checkall
147 # To help win32 pick up the locations where they don't fall in the usual
148 # path locations.  This may not be completely effective for USESLN/USEDSP
149 # oriented builds, just yet
151 LIB=$(APR_PATH)\$(ARCHOSPATH);$(APR_PATH)\$(LIBSOSPATH);$(API_PATH)\$(ARCHPATH);$(API_PATH)\$(LIBSPATH);$(APU_PATH)\$(ARCHPATH);$(APU_PATH)\$(LIBSPATH);$(LIB)
152 INCLUDE=$(APR_PATH)\include;$(API_PATH)\include;$(INCLUDE)
154 !IF $(USEMAK) == 1
156 clean:
157         $(MAKE) $(MAKEOPT) -f Makefile.win ARCH="$(ARCH)" \
158                 CTARGET=CLEAN buildall
160 buildall:
161         cd $(APR_PATH)
162          $(MAKE) $(MAKEOPT) -f apr.mak         CFG="apr - $(ARCH)" RECURSE=0 $(CTARGET)
163          $(MAKE) $(MAKEOPT) -f libapr.mak      CFG="libapr - $(ARCH)" RECURSE=0 $(CTARGET)
164          cd build
165           $(MAKE) $(MAKEOPT) -f aprapp.mak     CFG="aprapp - $(ARCH)" RECURSE=0 $(CTARGET)
166           $(MAKE) $(MAKEOPT) -f libaprapp.mak  CFG="libaprapp - $(ARCH)" RECURSE=0 $(CTARGET)
167          cd ..
168         cd $(API_PATH)
169          $(MAKE) $(MAKEOPT) -f apriconv.mak    CFG="apriconv - $(ARCH)" RECURSE=0 $(CTARGET)
170          $(MAKE) $(MAKEOPT) -f libapriconv.mak CFG="libapriconv - $(ARCH)" RECURSE=0 $(CTARGET)
171 !IF "$(CTARGET)" == "CLEAN"
172          $(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
173                 BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
174 !ELSE
175          cd ccs
176           $(MAKE) $(MAKEOPT) -f Makefile.win all \
177                 BUILD_MODE="$(ARCH)" BIND_MODE=shared
178          cd ..\ces
179           $(MAKE) $(MAKEOPT) -f Makefile.win all \
180                 BUILD_MODE="$(ARCH)" BIND_MODE=shared
181          cd ..
182 !ENDIF
183         cd $(APU_PATH)\xml\expat\lib
184          $(MAKE) $(MAKEOPT) -f xml.mak         CFG="xml - $(ARCH)" RECURSE=0 $(CTARGET)
185         cd ..\..\..
186          $(MAKE) $(MAKEOPT) -f aprutil.mak     CFG="aprutil - $(ARCH)" RECURSE=0 $(CTARGET)
187          $(MAKE) $(MAKEOPT) -f libaprutil.mak  CFG="libaprutil - $(ARCH)" RECURSE=0 $(CTARGET)
189 !ELSEIF $(USESLN) == 1
191 clean:
192         -devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project libaprutil
193         -devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project aprutil
194         cd $(API_PATH)
195          $(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
196                 BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
197         cd $(APU_PATH)
199 buildall:
200         devenv aprutil.sln /useenv /build "$(SLNARCH)" /project aprutil
201         devenv aprutil.sln /useenv /build "$(SLNARCH)" /project libaprutil
203 !ELSE
204 #       $(USEDSP) == 1
206 clean:
207         -msdev aprutil.dsw /USEENV /MAKE "libaprutil - $(ARCH)" /CLEAN
208         -msdev aprutil.dsw /USEENV /MAKE "aprutil - $(ARCH)" /CLEAN
209         cd $(API_PATH)
210          $(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
211                 BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
212         cd $(APU_PATH)
214 buildall:
215         @msdev aprutil.dsw /USEENV /MAKE "aprutil - $(ARCH)"
216         @msdev aprutil.dsw /USEENV /MAKE "libaprutil - $(ARCH)"
218 !ENDIF
221 checkapr:
222         cd $(APR_PATH)\test
223          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=static \
224                 OUTDIR=$(LIBSOSPATH) check
225          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=dynamic \
226                 OUTDIR=$(ARCHOSPATH) check
227          cd ..
228         cd $(APU_PATH)
230 checkapu:
231         for /f %p in ('cd $(APR_PATH) && pwd') do set FOUND_APR=%p
232         for /f %p in ('cd $(API_PATH) && pwd') do set FOUND_API=%p
233         cd $(APU_PATH)
234         cd test
235          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=static \
236                 OUTDIR=$(LIBSPATH) APROUTDIR=$(LIBSOSPATH) \
237                 APR_PATH=%FOUND_APR% API_PATH=%FOUND_APR% check
238          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=dynamic \
239                 OUTDIR=$(LIBSPATH) APROUTDIR=$(ARCHOSPATH) \
240                 APR_PATH=%FOUND_APR% API_PATH=%FOUND_APR% check
241         cd ..
243 checkall: checkapr checkapu
246 install:
247         echo Y >.y
248         echo A >.A
249         @if NOT EXIST "$(PREFIX)\." mkdir "$(PREFIX)"
250         @if NOT EXIST "$(PREFIX)\bin\." mkdir "$(PREFIX)\bin"
251         @if NOT EXIST "$(PREFIX)\bin\iconv\." mkdir "$(PREFIX)\bin\iconv"
252         @if NOT EXIST "$(PREFIX)\include\." mkdir "$(PREFIX)\include"
253         @if NOT EXIST "$(PREFIX)\lib\." mkdir "$(PREFIX)\lib"
254         copy CHANGES "$(PREFIX)\CHANGES.txt" <.y
255         copy LICENSE "$(PREFIX)\LICENSE.txt" <.y
256         copy NOTICE  "$(PREFIX)\NOTICE.txt"  <.y
257         xcopy $(APR_PATH)\include\*.h           "$(PREFIX)\include\" /d < .a
258         xcopy $(APU_PATH)\include\*.h           "$(PREFIX)\include\" /d < .a
259         copy $(APR_PATH)\$(LIBSOSPATH)\apr-1.lib        "$(PREFIX)\lib\" <.y
260         copy $(APR_PATH)\$(LIBSOSPATH)\apr-1.pdb        "$(PREFIX)\lib\" <.y
261         copy $(APU_PATH)\$(LIBSPATH)\aprutil-1.lib      "$(PREFIX)\lib\" <.y
262         copy $(APU_PATH)\$(LIBSPATH)\aprutil-1.pdb      "$(PREFIX)\lib\" <.y
263         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.lib     "$(PREFIX)\lib\" <.y
264         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.exp     "$(PREFIX)\lib\" <.y
265         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.lib   "$(PREFIX)\lib\" <.y
266         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.exp   "$(PREFIX)\lib\" <.y
267         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.dll     "$(PREFIX)\bin\" <.y
268         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.pdb     "$(PREFIX)\bin\" <.y
269         copy $(API_PATH)\$(ARCHPATH)\libapriconv-1.dll  "$(PREFIX)\bin\" <.y
270         copy $(API_PATH)\$(ARCHPATH)\libapriconv-1.pdb  "$(PREFIX)\bin\" <.y
271         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.dll   "$(PREFIX)\bin\" <.y
272         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.pdb   "$(PREFIX)\bin\" <.y
273         xcopy $(API_PATH)\$(ARCHPATH)\iconv\*.so  "$(PREFIX)\bin\iconv\" /d < .a
274         xcopy $(API_PATH)\$(ARCHPATH)\iconv\*.pdb "$(PREFIX)\bin\iconv\" /d < .a
275 !IFDEF OPENSSL_DIR
276         copy $(OPENSSL_DIR)\$(SSLBIN)\openssl.exe       "$(PREFIX)\bin\" <.y
277         copy $(OPENSSL_DIR)\$(SSLBIN)\openssl.pdb       "$(PREFIX)\bin\" <.y
278         copy $(OPENSSL_DIR)\$(SSLBIN)\libeay32.dll      "$(PREFIX)\bin\" <.y
279         copy $(OPENSSL_DIR)\$(SSLBIN)\libeay32.pdb      "$(PREFIX)\bin\" <.y
280         copy $(OPENSSL_DIR)\$(SSLBIN)\ssleay32.dll      "$(PREFIX)\bin\" <.y
281         copy $(OPENSSL_DIR)\$(SSLBIN)\ssleay32.pdb      "$(PREFIX)\bin\" <.y
282         @if NOT EXIST "$(PREFIX)\conf\." mkdir "$(PREFIX)\conf"
283         copy $(OPENSSL_DIR)\apps\openssl.cnf "$(PREFIX)\conf\openssl.cnf" <.y
284         type << >> "$(PREFIX)\NOTICE.txt"
286   This binary distribution includes cryptographic software written by
287   Eric Young (eay@cryptsoft.com), software written by Tim Hudson 
288   (tjh@cryptsoft.com), and software developed by the OpenSSL Project 
289   for use in the OpenSSL Toolkit <http://www.openssl.org/>.
291         copy LICENSE + << + "$(OPENSSL_DIR)\LICENSE" "$(PREFIX)\LICENSE.txt" <.y
293 For the libeay32.dll, ssleay32.dll and openssl.exe components:
296         copy << + $(OPENSSL_DIR)\NEWS "$(PREFIX)\OPENSSL-NEWS.txt" <.y
298  Apache Portablity Runtime (APR) 1.3 Limited OpenSSL Distribution
300  This binary distribution includes the minimal components of OpenSSL required
301  to support aprutil 1.3 and later libraries from the Apache APR Project.
302  (Details are listed in OPENSSL-README.txt.)  For the complete list of CHANGES
303  to this and later versions of OpenSSL, please refer to the definative source,
304  <http://www.openssl.org/news/changelog.html>, or see the CHANGES file in the
305  full binary or source distribution package from <http://www.openssl.org/>.
307  These OpenSSL binaries were built for distribution from the U.S. without 
308  support for the patented encryption methods IDEA, MDC-2 or RC5.
310 --------------------------------------------------------------------------------
312         copy << + $(OPENSSL_DIR)\README "$(PREFIX)\OPENSSL-README.txt" <.y
314  Apache Portablity Runtime APR-util Limited OpenSSL Distribution
316  This binary installation of OpenSSL is a limited distribution of the
317  files derived from the OpenSSL project:
319    LICENSE.txt (includes openssl LICENSE)
320    OPENSSL-NEWS.txt
321    OPENSSL-README.txt
322    conf\openssl.cnf
323    bin\libeay32.dll
324    bin\libeay32.pdb
325    bin\ssleay32.dll
326    bin\ssleay32.pdb
327    bin\openssl.exe
328    bin\openssl.pdb
330  These are the minimal libraries and tools required to use the aprutil 1.3
331  and later library releases distributed by the Apache APR project.  No library
332  link files, headers or sources are distributed with this binary distribution.
333  Please refer to the <http://www.openssl.org/> site for complete source or
334  binary distributions.
336  These OpenSSL binaries were built for distribution from the U.S. without 
337  support for the patented encryption methods IDEA, MDC-2 or RC5.
339  The Apache APR Project only supports the binary distribution of these files
340  and development of the mod_ssl module.  We cannot provide support assistance
341  for using or configuring the OpenSSL package or these modules.  Please refer
342  all installation and configuration questions to the appropriate forum,
343  such as the user supported lists, <http://apr.apache.org/mailing-lists.html> 
344  the Apache APR Projects developer list or <http://www.openssl.org/support/> 
345  the OpenSSL support page.
347 --------------------------------------------------------------------------------
349 !ENDIF
350         del .y
351         del .a