VirtualBox

source: vbox/trunk/src/libs/curl-7.64.0/lib/Makefile.m32@ 95219

Last change on this file since 95219 was 85671, checked in by vboxsync, 4 years ago

Export out internal curl copy to make it a lot simpler to build VBox (OSE) on Windows. bugref:9814

  • Property svn:eol-style set to native
File size: 10.3 KB
Line 
1#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1999 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.haxx.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21#***************************************************************************
22
23###########################################################################
24#
25## Makefile for building libcurl.a with MingW (GCC-3.2 or later or LLVM/Clang)
26## and optionally OpenSSL (1.0.2a), libssh2 (1.5), zlib (1.2.8), librtmp (2.4),
27## brotli (1.0.1)
28##
29## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
30## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-sspi-winidn
31##
32## Hint: you can also set environment vars to control the build, f.e.:
33## set ZLIB_PATH=c:/zlib-1.2.8
34## set ZLIB=1
35#
36###########################################################################
37
38# Edit the path below to point to the base of your Zlib sources.
39ifndef ZLIB_PATH
40ZLIB_PATH = ../../zlib-1.2.8
41endif
42# Edit the path below to point to the base of your Brotli sources.
43ifndef BROTLI_PATH
44BROTLI_PATH = ../../brotli-1.0.1
45endif
46# Edit the path below to point to the base of your OpenSSL package.
47ifndef OPENSSL_PATH
48OPENSSL_PATH = ../../openssl-1.0.2a
49endif
50# Edit the path below to point to the base of your LibSSH2 package.
51ifndef LIBSSH2_PATH
52LIBSSH2_PATH = ../../libssh2-1.5.0
53endif
54# Edit the path below to point to the base of your librtmp package.
55ifndef LIBRTMP_PATH
56LIBRTMP_PATH = ../../librtmp-2.4
57endif
58# Edit the path below to point to the base of your libidn2 package.
59ifndef LIBIDN2_PATH
60LIBIDN2_PATH = ../../libidn2-2.0.3
61endif
62# Edit the path below to point to the base of your MS IDN package.
63# Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
64# https://www.microsoft.com/en-us/download/details.aspx?id=734
65ifndef WINIDN_PATH
66WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
67endif
68# Edit the path below to point to the base of your Novell LDAP NDK.
69ifndef LDAP_SDK
70LDAP_SDK = c:/novell/ndk/cldapsdk/win32
71endif
72# Edit the path below to point to the base of your nghttp2 package.
73ifndef NGHTTP2_PATH
74NGHTTP2_PATH = ../../nghttp2-1.0.0
75endif
76
77PROOT = ..
78
79# Edit the path below to point to the base of your c-ares package.
80ifndef LIBCARES_PATH
81LIBCARES_PATH = $(PROOT)/ares
82endif
83
84ifeq ($(CURL_CC),)
85CURL_CC := $(CROSSPREFIX)gcc
86endif
87ifeq ($(CURL_AR),)
88CURL_AR := $(CROSSPREFIX)ar
89endif
90ifeq ($(CURL_RANLIB),)
91CURL_RANLIB := $(CROSSPREFIX)ranlib
92endif
93
94CC = $(CURL_CC)
95CFLAGS = $(CURL_CFLAG_EXTRAS) -g -O2 -Wall -W
96CFLAGS += -fno-strict-aliasing
97# comment LDFLAGS below to keep debug info
98LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_DLL) -s
99AR = $(CURL_AR)
100RANLIB = $(CURL_RANLIB)
101RC = $(CROSSPREFIX)windres
102RCFLAGS = --include-dir=$(PROOT)/include -DDEBUGBUILD=0 -O COFF
103STRIP = $(CROSSPREFIX)strip -g
104
105# Set environment var ARCH to your architecture to override autodetection.
106ifndef ARCH
107ifeq ($(findstring x86_64,$(shell $(CC) -dumpmachine)),x86_64)
108ARCH = w64
109else
110ARCH = w32
111endif
112endif
113
114ifeq ($(ARCH),w64)
115CFLAGS += -m64 -D_AMD64_
116LDFLAGS += -m64
117RCFLAGS += -F pe-x86-64
118else
119CFLAGS += -m32
120LDFLAGS += -m32
121RCFLAGS += -F pe-i386
122endif
123
124# Platform-dependent helper tool macros
125ifeq ($(findstring /sh,$(SHELL)),/sh)
126DEL = rm -f $1
127RMDIR = rm -fr $1
128MKDIR = mkdir -p $1
129COPY = -cp -afv $1 $2
130#COPYR = -cp -afr $1/* $2
131COPYR = -rsync -aC $1/* $2
132TOUCH = touch $1
133CAT = cat
134ECHONL = echo ""
135DL = '
136else
137ifeq "$(OS)" "Windows_NT"
138DEL = -del 2>NUL /q /f $(subst /,\,$1)
139RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
140else
141DEL = -del 2>NUL $(subst /,\,$1)
142RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
143endif
144MKDIR = -md 2>NUL $(subst /,\,$1)
145COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
146COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
147TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
148CAT = type
149ECHONL = $(ComSpec) /c echo.
150endif
151
152########################################################
153## Nothing more to do below this line!
154
155ifeq ($(findstring -dyn,$(CFG)),-dyn)
156DYN = 1
157endif
158ifeq ($(findstring -ares,$(CFG)),-ares)
159ARES = 1
160endif
161ifeq ($(findstring -sync,$(CFG)),-sync)
162SYNC = 1
163endif
164ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
165RTMP = 1
166SSL = 1
167ZLIB = 1
168endif
169ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
170SSH2 = 1
171SSL = 1
172ZLIB = 1
173endif
174ifeq ($(findstring -ssl,$(CFG)),-ssl)
175SSL = 1
176endif
177ifeq ($(findstring -srp,$(CFG)),-srp)
178SRP = 1
179endif
180ifeq ($(findstring -zlib,$(CFG)),-zlib)
181ZLIB = 1
182endif
183ifeq ($(findstring -brotli,$(CFG)),-brotli)
184BROTLI = 1
185endif
186ifeq ($(findstring -idn2,$(CFG)),-idn2)
187IDN2 = 1
188endif
189ifeq ($(findstring -winidn,$(CFG)),-winidn)
190WINIDN = 1
191endif
192ifeq ($(findstring -sspi,$(CFG)),-sspi)
193SSPI = 1
194endif
195ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
196LDAPS = 1
197endif
198ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
199IPV6 = 1
200endif
201ifeq ($(findstring -winssl,$(CFG)),-winssl)
202WINSSL = 1
203SSPI = 1
204endif
205ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
206NGHTTP2 = 1
207endif
208
209INCLUDES = -I. -I../include
210CFLAGS += -DBUILDING_LIBCURL
211ifdef SSL
212 ifdef WINSSL
213 CFLAGS += -DCURL_WITH_MULTI_SSL
214 endif
215endif
216
217ifdef SYNC
218 CFLAGS += -DUSE_SYNC_DNS
219else
220 ifdef ARES
221 INCLUDES += -I"$(LIBCARES_PATH)"
222 CFLAGS += -DUSE_ARES -DCARES_STATICLIB
223 DLL_LIBS += -L"$(LIBCARES_PATH)" -lcares
224 libcurl_dll_DEPENDENCIES = $(LIBCARES_PATH)/libcares.a
225 endif
226endif
227ifdef RTMP
228 INCLUDES += -I"$(LIBRTMP_PATH)"
229 CFLAGS += -DUSE_LIBRTMP
230 DLL_LIBS += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
231endif
232ifdef NGHTTP2
233 INCLUDES += -I"$(NGHTTP2_PATH)/include"
234 CFLAGS += -DUSE_NGHTTP2
235 DLL_LIBS += -L"$(NGHTTP2_PATH)/lib" -lnghttp2
236endif
237ifdef SSH2
238 INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
239 CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
240 DLL_LIBS += -L"$(LIBSSH2_PATH)/win32" -lssh2
241 ifdef WINSSL
242 ifndef DYN
243 DLL_LIBS += -lbcrypt -lcrypt32
244 endif
245 endif
246endif
247ifdef SSL
248 ifndef OPENSSL_INCLUDE
249 ifeq "$(wildcard $(OPENSSL_PATH)/outinc)" "$(OPENSSL_PATH)/outinc"
250 OPENSSL_INCLUDE = $(OPENSSL_PATH)/outinc
251 endif
252 ifeq "$(wildcard $(OPENSSL_PATH)/include)" "$(OPENSSL_PATH)/include"
253 OPENSSL_INCLUDE = $(OPENSSL_PATH)/include
254 endif
255 endif
256 ifneq "$(wildcard $(OPENSSL_INCLUDE)/openssl/opensslv.h)" "$(OPENSSL_INCLUDE)/openssl/opensslv.h"
257 $(error Invalid path to OpenSSL package: $(OPENSSL_PATH))
258 endif
259 ifndef OPENSSL_LIBPATH
260 ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out"
261 OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
262 OPENSSL_LIBS = -leay32 -lssl32
263 endif
264 ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib"
265 OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib
266 OPENSSL_LIBS = -lcrypto -lssl
267 endif
268 endif
269 ifndef DYN
270 OPENSSL_LIBS += -lgdi32 -lcrypt32
271 endif
272 INCLUDES += -I"$(OPENSSL_INCLUDE)"
273 CFLAGS += -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
274 -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5
275 DLL_LIBS += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
276 ifdef SRP
277 ifeq "$(wildcard $(OPENSSL_INCLUDE)/openssl/srp.h)" "$(OPENSSL_INCLUDE)/openssl/srp.h"
278 CFLAGS += -DHAVE_OPENSSL_SRP -DUSE_TLS_SRP
279 endif
280 endif
281endif
282ifdef WINSSL
283 CFLAGS += -DUSE_SCHANNEL
284 DLL_LIBS += -lcrypt32
285endif
286ifdef ZLIB
287 INCLUDES += -I"$(ZLIB_PATH)"
288 CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
289 DLL_LIBS += -L"$(ZLIB_PATH)" -lz
290endif
291ifdef BROTLI
292 INCLUDES += -I"$(BROTLI_PATH)/include"
293 CFLAGS += -DHAVE_BROTLI
294 DLL_LIBS += -L"$(BROTLI_PATH)/lib"
295 ifdef BROTLI_LIBS
296 DLL_LIBS += $(BROTLI_LIBS)
297 else
298 DLL_LIBS += -lbrotlidec
299 endif
300endif
301ifdef IDN2
302 INCLUDES += -I"$(LIBIDN2_PATH)/include"
303 CFLAGS += -DUSE_LIBIDN2
304 DLL_LIBS += -L"$(LIBIDN2_PATH)/lib" -lidn2
305else
306ifdef WINIDN
307 CFLAGS += -DUSE_WIN32_IDN
308 CFLAGS += -DWANT_IDN_PROTOTYPES
309 DLL_LIBS += -L"$(WINIDN_PATH)" -lnormaliz
310endif
311endif
312ifdef SSPI
313 CFLAGS += -DUSE_WINDOWS_SSPI
314endif
315ifdef SPNEGO
316 CFLAGS += -DHAVE_SPNEGO
317endif
318ifdef IPV6
319 CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
320endif
321ifdef LDAPS
322 CFLAGS += -DHAVE_LDAP_SSL
323endif
324ifdef USE_LDAP_NOVELL
325 INCLUDES += -I"$(LDAP_SDK)/inc"
326 CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
327 DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
328endif
329ifdef USE_LDAP_OPENLDAP
330 INCLUDES += -I"$(LDAP_SDK)/include"
331 CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
332 DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber
333endif
334ifndef USE_LDAP_NOVELL
335ifndef USE_LDAP_OPENLDAP
336 DLL_LIBS += -lwldap32
337endif
338endif
339DLL_LIBS += -lws2_32
340
341# Makefile.inc provides the CSOURCES and HHEADERS defines
342include Makefile.inc
343
344ifeq ($(CURL_DLL_A_SUFFIX),)
345CURL_DLL_A_SUFFIX := dll
346endif
347
348libcurl_dll_LIBRARY = libcurl$(CURL_DLL_SUFFIX).dll
349libcurl_dll_a_LIBRARY = libcurl$(CURL_DLL_A_SUFFIX).a
350libcurl_a_LIBRARY = libcurl.a
351
352libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
353libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
354
355RESOURCE = libcurl.res
356
357
358all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
359
360$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
361 @$(call DEL, $@)
362 $(AR) cru $@ $(libcurl_a_OBJECTS)
363 $(RANLIB) $@
364 $(STRIP) $@
365
366# remove the last line above to keep debug info
367
368$(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
369 @$(call DEL, $@)
370 $(CC) $(LDFLAGS) -shared -o $@ \
371 -Wl,--output-def,$(@:.dll=.def),--out-implib,$(libcurl_dll_a_LIBRARY) \
372 $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
373
374%.o: %.c
375 $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
376
377%.res: %.rc
378 $(RC) $(RCFLAGS) -i $< -o $@
379
380clean:
381 @$(call DEL, $(libcurl_a_OBJECTS) $(RESOURCE))
382
383distclean vclean: clean
384 @$(call DEL, $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_LIBRARY:.dll=.def) $(libcurl_dll_a_LIBRARY))
385
386$(LIBCARES_PATH)/libcares.a:
387 $(MAKE) -C $(LIBCARES_PATH) -f Makefile.m32
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette