Add pg_config --libs to pgsql_LDFLAGS.
[apr-util.git] / Makefile.win
blob0cb1bdc17e865d1f1ea49ce423638ca9ce74e5ad
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 entirely relative 
27 # to one another!  At this time, building the libraries themselves
28 # is only expected to work if the defaults (../apr, ../apr-iconv 
29 # and ../apr-util) are used, or if they are built with USEMAK=1.
31 #     APR_PATH=..\apr-1.3.0
32 #     API_PATH=..\apr-iconv-1.3.0
33 #     APU_PATH=..\apr-util-1.3.0
35 # For example;
37 #   nmake -f Makefile.win PREFIX=C:\APR buildall checkall installall clean
40 !IF EXIST("aprutil.sln") && ([devenv /help > NUL 2>&1] == 0) \
41     && !defined(USEMAK) && !defined(USEDSW)
42 USESLN=1
43 USEMAK=0
44 USEDSW=0
45 !ELSEIF EXIST("aprutil.mak") && !defined(USEDSW)
46 USESLN=0
47 USEMAK=1
48 USEDSW=0
49 !ELSE
50 USESLN=0
51 USEMAK=0
52 USEDSW=1
53 !ENDIF
55 PREFIX=..\apr-dist
57 !IF [$(COMSPEC) /c cl /nologo /? \
58         | $(SystemRoot)\System32\find.exe "x64" >NUL ] == 0
59 ARCH=x64 Release
60 !ELSE
61 ARCH=Win32 Release
62 !ENDIF
64 APR_PATH=..\apr
65 API_PATH=..\apr-iconv
66 APU_PATH=..\apr-util
68 # Never build ssl by default, plus this needs work
70 #OPENSSL_DIR=..\openssl
72 !MESSAGE ARCH        = $(ARCH)
73 !MESSAGE APR_PATH    = $(APR_PATH)
74 !MESSAGE API_PATH    = $(API_PATH)  (apr-iconv)
75 !MESSAGE APU_PATH    = $(APU_PATH)  (apr-util)
76 !IFDEF OPENSSL_DIR
77 !MESSAGE OPENSSL_DIR = $(OPENSSL_DIR)  (openssl)
78 !ENDIF
79 !MESSAGE PREFIX      = $(PREFIX)  (install path)
82 # Utility and Translation things, nothing here for the user
84 !IF "$(ARCH)" == "Win32 Release"
85 SLNARCH=Release|Win32
86 ARCHPATH=Release
87 LIBSPATH=LibR
88 ARCHOSPATH=Release
89 LIBSOSPATH=LibR
90 !ELSEIF "$(ARCH)" == "Win32 Debug"
91 SLNARCH=Debug|Win32
92 ARCHPATH=Debug
93 LIBSPATH=LibD
94 ARCHOSPATH=Debug
95 LIBSOSPATH=LibD
96 !ELSEIF "$(ARCH)" == "Win32 Release9x"
97 SLNARCH=Release9x|Win32
98 ARCHPATH=Release
99 LIBSPATH=LibR
100 ARCHOSPATH=9x\Release
101 LIBSOSPATH=9x\LibR
102 !ELSEIF "$(ARCH)" == "Win32 Debug9x"
103 SLNARCH=Debug9x|Win32
104 ARCHPATH=Debug
105 LIBSPATH=LibD
106 ARCHOSPATH=9x\Debug
107 LIBSOSPATH=9x\LibD
108 !ELSEIF "$(ARCH)" == "x64 Release"
109 SLNARCH=Release|x64
110 ARCHPATH=x64\Release
111 LIBSPATH=x64\LibR
112 ARCHOSPATH=x64\Release
113 LIBSOSPATH=x64\LibR
114 !ELSEIF "$(ARCH)" == "x64 Debug"
115 SLNARCH=Debug|x64
116 ARCHPATH=x64\Debug
117 LIBSPATH=x64\LibD
118 ARCHOSPATH=x64\Debug
119 LIBSOSPATH=x64\LibD
120 !ENDIF
122 !IFNDEF MAKEOPT
123 # Only default the behavior if MAKEOPT= is omitted
124 !IFDEF _NMAKE_VER
125 # Microsoft NMake options
126 MAKEOPT=-nologo
127 !ELSEIF "$(MAKE)" == "make"
128 # Borland make options?  Not really supported (yet)
129 MAKEOPT=-s -N
130 !ENDIF
131 !ENDIF
134 # Sanity Checks
136 !IF !EXIST("$(APR_PATH)\apr.dsp") || !EXIST("$(API_PATH)\apriconv.dsp") \
137  || !EXIST("$(APU_PATH)\aprutil.dsp")
138 !MESSAGE Please check out or download and unpack the Apache Portability Runtime
139 !MESSAGE sources (apr, apr-iconv and apr-util) under a single parent dir,
140 !MESSAGE or provide APR_PATH, API_PATH and APU_PATH (all relative to each other,
141 !MESSAGE or all absolute paths).
142 !MESSAGE Apache cannot build without these libraries!
143 !MESSAGE 
144 !ERROR Need apr and apr-iconv alongside apr-util to build!
145 !ENDIF
148 all: buildall checkall
150 # To help win32 pick up the locations where they don't fall in the usual
151 # path locations.  This may not be completely effective for USESLN/USEDSP
152 # oriented builds, just yet
154 LIB=$(APR_PATH)\$(ARCHOSPATH);$(APR_PATH)\$(LIBSOSPATH);$(API_PATH)\$(ARCHPATH);$(API_PATH)\$(LIBSPATH);$(APU_PATH)\$(ARCHPATH);$(APU_PATH)\$(LIBSPATH);$(LIB)
155 INCLUDE=$(APR_PATH)\include;$(API_PATH)\include;$(INCLUDE)
157 !IF $(USEMAK) == 1
159 clean:
160         $(MAKE) $(MAKEOPT) -f Makefile.win ARCH="$(ARCH)" \
161                 CTARGET=CLEAN buildall
163 buildall:
164         cd $(APR_PATH)
165          $(MAKE) $(MAKEOPT) -f apr.mak         CFG="apr - $(ARCH)" RECURSE=0 $(CTARGET)
166          $(MAKE) $(MAKEOPT) -f libapr.mak      CFG="libapr - $(ARCH)" RECURSE=0 $(CTARGET)
167          cd build
168           $(MAKE) $(MAKEOPT) -f aprapp.mak     CFG="aprapp - $(ARCH)" RECURSE=0 $(CTARGET)
169           $(MAKE) $(MAKEOPT) -f libaprapp.mak  CFG="libaprapp - $(ARCH)" RECURSE=0 $(CTARGET)
170          cd ..
171         cd $(API_PATH)
172          $(MAKE) $(MAKEOPT) -f apriconv.mak    CFG="apriconv - $(ARCH)" RECURSE=0 $(CTARGET)
173          $(MAKE) $(MAKEOPT) -f libapriconv.mak CFG="libapriconv - $(ARCH)" RECURSE=0 $(CTARGET)
174 !IF "$(CTARGET)" == "CLEAN"
175          $(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
176                 BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
177 !ELSE
178          cd ccs
179           $(MAKE) $(MAKEOPT) -f Makefile.win all \
180                 BUILD_MODE="$(ARCH)" BIND_MODE=shared
181          cd ..\ces
182           $(MAKE) $(MAKEOPT) -f Makefile.win all \
183                 BUILD_MODE="$(ARCH)" BIND_MODE=shared
184          cd ..
185 !ENDIF
186         cd $(APU_PATH)\xml\expat\lib
187          $(MAKE) $(MAKEOPT) -f xml.mak         CFG="xml - $(ARCH)" RECURSE=0 $(CTARGET)
188         cd ..\..\..
189          $(MAKE) $(MAKEOPT) -f aprutil.mak     CFG="aprutil - $(ARCH)" RECURSE=0 $(CTARGET)
190          $(MAKE) $(MAKEOPT) -f libaprutil.mak  CFG="libaprutil - $(ARCH)" RECURSE=0 $(CTARGET)
192 !ELSEIF $(USESLN) == 1
194 clean:
195         -devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project libaprutil
196         -devenv aprutil.sln /useenv /clean "$(SLNARCH)" /project aprutil
197         cd $(API_PATH)
198          $(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
199                 BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
200         cd $(APU_PATH)
202 buildall:
203         devenv aprutil.sln /useenv /build "$(SLNARCH)" /project aprutil
204         devenv aprutil.sln /useenv /build "$(SLNARCH)" /project libaprutil
206 !ELSE
207 #       $(USEDSP) == 1
209 clean:
210         -msdev aprutil.dsw /USEENV /MAKE "libaprutil - $(ARCH)" /CLEAN
211         -msdev aprutil.dsw /USEENV /MAKE "aprutil - $(ARCH)" /CLEAN
212         cd $(API_PATH)
213          $(MAKE) $(MAKEOPT) -f build\modules.mk.win clean \
214                 BUILD_MODE="$(ARCH)" BIND_MODE=shared API_SOURCE=.
215         cd $(APU_PATH)
217 buildall:
218         @msdev aprutil.dsw /USEENV /MAKE "aprutil - $(ARCH)"
219         @msdev aprutil.dsw /USEENV /MAKE "libaprutil - $(ARCH)"
221 !ENDIF
224 checkapr:
225         cd $(APR_PATH)\test
226          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=static \
227                 OUTDIR=$(LIBSOSPATH) check
228          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=dynamic \
229                 OUTDIR=$(ARCHOSPATH) check
230          cd ..
231         cd $(APU_PATH)
233 checkapu:
234         cd $(APU_PATH)
235         cd test
236          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=static \
237                 OUTDIR=$(LIBSPATH) APROUTDIR=$(LIBSOSPATH) \
238                 APR_PATH=..\$(APR_PATH) API_PATH=..\$(API_PATH) check
239          $(MAKE) $(MAKEOPT) -f Makefile.win MODEL=dynamic \
240                 OUTDIR=$(LIBSPATH) APROUTDIR=$(ARCHOSPATH) \
241                 APR_PATH=..\$(APR_PATH) API_PATH=..\$(API_PATH) check
242         cd ..
244 checkall: checkapr checkapu
247 install:
248         echo Y >.y
249         echo A >.A
250         @if NOT EXIST "$(PREFIX)\." mkdir "$(PREFIX)"
251         @if NOT EXIST "$(PREFIX)\bin\." mkdir "$(PREFIX)\bin"
252         @if NOT EXIST "$(PREFIX)\bin\iconv\." mkdir "$(PREFIX)\bin\iconv"
253         @if NOT EXIST "$(PREFIX)\include\." mkdir "$(PREFIX)\include"
254         @if NOT EXIST "$(PREFIX)\lib\." mkdir "$(PREFIX)\lib"
255         copy CHANGES "$(PREFIX)\CHANGES.txt" <.y
256         copy LICENSE "$(PREFIX)\LICENSE.txt" <.y
257         copy NOTICE  "$(PREFIX)\NOTICE.txt"  <.y
258         xcopy $(APR_PATH)\include\*.h           "$(PREFIX)\include\" /d < .a
259         xcopy $(APU_PATH)\include\*.h           "$(PREFIX)\include\" /d < .a
260         copy $(APR_PATH)\$(LIBSOSPATH)\apr-1.lib        "$(PREFIX)\lib\" <.y
261         copy $(APR_PATH)\$(LIBSOSPATH)\apr-1.pdb        "$(PREFIX)\lib\" <.y
262         copy $(APU_PATH)\$(LIBSPATH)\aprutil-1.lib      "$(PREFIX)\lib\" <.y
263         copy $(APU_PATH)\$(LIBSPATH)\aprutil-1.pdb      "$(PREFIX)\lib\" <.y
264         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.lib     "$(PREFIX)\lib\" <.y
265         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.exp     "$(PREFIX)\lib\" <.y
266         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.lib   "$(PREFIX)\lib\" <.y
267         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.exp   "$(PREFIX)\lib\" <.y
268         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.dll     "$(PREFIX)\bin\" <.y
269         copy $(APR_PATH)\$(ARCHOSPATH)\libapr-1.pdb     "$(PREFIX)\bin\" <.y
270         copy $(API_PATH)\$(ARCHPATH)\libapriconv-1.dll  "$(PREFIX)\bin\" <.y
271         copy $(API_PATH)\$(ARCHPATH)\libapriconv-1.pdb  "$(PREFIX)\bin\" <.y
272         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.dll   "$(PREFIX)\bin\" <.y
273         copy $(APU_PATH)\$(ARCHPATH)\libaprutil-1.pdb   "$(PREFIX)\bin\" <.y
274         xcopy $(API_PATH)\$(ARCHPATH)\iconv\*.so  "$(PREFIX)\bin\iconv\" /d < .a
275         xcopy $(API_PATH)\$(ARCHPATH)\iconv\*.pdb "$(PREFIX)\bin\iconv\" /d < .a
276 !IFDEF OPENSSL_DIR
277         copy $(OPENSSL_DIR)\$(SSLBIN)\openssl.exe       "$(PREFIX)\bin\" <.y
278         copy $(OPENSSL_DIR)\$(SSLBIN)\openssl.pdb       "$(PREFIX)\bin\" <.y
279         copy $(OPENSSL_DIR)\$(SSLBIN)\libeay32.dll      "$(PREFIX)\bin\" <.y
280         copy $(OPENSSL_DIR)\$(SSLBIN)\libeay32.pdb      "$(PREFIX)\bin\" <.y
281         copy $(OPENSSL_DIR)\$(SSLBIN)\ssleay32.dll      "$(PREFIX)\bin\" <.y
282         copy $(OPENSSL_DIR)\$(SSLBIN)\ssleay32.pdb      "$(PREFIX)\bin\" <.y
283         @if NOT EXIST "$(PREFIX)\conf\." mkdir "$(PREFIX)\conf"
284         copy $(OPENSSL_DIR)\apps\openssl.cnf "$(PREFIX)\conf\openssl.cnf" <.y
285         type << >> "$(PREFIX)\NOTICE.txt"
287   This binary distribution includes cryptographic software written by
288   Eric Young (eay@cryptsoft.com), software written by Tim Hudson 
289   (tjh@cryptsoft.com), and software developed by the OpenSSL Project 
290   for use in the OpenSSL Toolkit <http://www.openssl.org/>.
292         copy LICENSE + << + "$(OPENSSL_DIR)\LICENSE" "$(PREFIX)\LICENSE.txt" <.y
294 For the libeay32.dll, ssleay32.dll and openssl.exe components:
297         copy << + $(OPENSSL_DIR)\NEWS "$(PREFIX)\OPENSSL-NEWS.txt" <.y
299  Apache Portablity Runtime (APR) 1.3 Limited OpenSSL Distribution
301  This binary distribution includes the minimal components of OpenSSL required
302  to support aprutil 1.3 and later libraries from the Apache APR Project.
303  (Details are listed in OPENSSL-README.txt.)  For the complete list of CHANGES
304  to this and later versions of OpenSSL, please refer to the definative source,
305  <http://www.openssl.org/news/changelog.html>, or see the CHANGES file in the
306  full binary or source distribution package from <http://www.openssl.org/>.
308  These OpenSSL binaries were built for distribution from the U.S. without 
309  support for the patented encryption methods IDEA, MDC-2 or RC5.
311 --------------------------------------------------------------------------------
313         copy << + $(OPENSSL_DIR)\README "$(PREFIX)\OPENSSL-README.txt" <.y
315  Apache Portablity Runtime APR-util Limited OpenSSL Distribution
317  This binary installation of OpenSSL is a limited distribution of the
318  files derived from the OpenSSL project:
320    LICENSE.txt (includes openssl LICENSE)
321    OPENSSL-NEWS.txt
322    OPENSSL-README.txt
323    conf\openssl.cnf
324    bin\libeay32.dll
325    bin\libeay32.pdb
326    bin\ssleay32.dll
327    bin\ssleay32.pdb
328    bin\openssl.exe
329    bin\openssl.pdb
331  These are the minimal libraries and tools required to use the aprutil 1.3
332  and later library releases distributed by the Apache APR project.  No library
333  link files, headers or sources are distributed with this binary distribution.
334  Please refer to the <http://www.openssl.org/> site for complete source or
335  binary distributions.
337  These OpenSSL binaries were built for distribution from the U.S. without 
338  support for the patented encryption methods IDEA, MDC-2 or RC5.
340  The Apache APR Project only supports the binary distribution of these files
341  and development of the mod_ssl module.  We cannot provide support assistance
342  for using or configuring the OpenSSL package or these modules.  Please refer
343  all installation and configuration questions to the appropriate forum,
344  such as the user supported lists, <http://apr.apache.org/mailing-lists.html> 
345  the Apache APR Projects developer list or <http://www.openssl.org/support/> 
346  the OpenSSL support page.
348 --------------------------------------------------------------------------------
350 !ENDIF
351         del .y
352         del .a