Annotation of embedaddon/curl/lib/Makefile.m32, revision 1.1
1.1 ! misho 1: #***************************************************************************
! 2: # _ _ ____ _
! 3: # Project ___| | | | _ \| |
! 4: # / __| | | | |_) | |
! 5: # | (__| |_| | _ <| |___
! 6: # \___|\___/|_| \_\_____|
! 7: #
! 8: # Copyright (C) 1999 - 2020, 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.
! 39: ifndef ZLIB_PATH
! 40: ZLIB_PATH = ../../zlib-1.2.8
! 41: endif
! 42: # Edit the path below to point to the base of your Brotli sources.
! 43: ifndef BROTLI_PATH
! 44: BROTLI_PATH = ../../brotli-1.0.1
! 45: endif
! 46: # Edit the path below to point to the base of your OpenSSL package.
! 47: ifndef OPENSSL_PATH
! 48: OPENSSL_PATH = ../../openssl-1.0.2a
! 49: endif
! 50: # Edit the path below to point to the base of your LibSSH2 package.
! 51: ifndef LIBSSH2_PATH
! 52: LIBSSH2_PATH = ../../libssh2-1.5.0
! 53: endif
! 54: # Edit the path below to point to the base of your librtmp package.
! 55: ifndef LIBRTMP_PATH
! 56: LIBRTMP_PATH = ../../librtmp-2.4
! 57: endif
! 58: # Edit the path below to point to the base of your libidn2 package.
! 59: ifndef LIBIDN2_PATH
! 60: LIBIDN2_PATH = ../../libidn2-2.0.3
! 61: endif
! 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
! 65: ifndef WINIDN_PATH
! 66: WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
! 67: endif
! 68: # Edit the path below to point to the base of your Novell LDAP NDK.
! 69: ifndef LDAP_SDK
! 70: LDAP_SDK = c:/novell/ndk/cldapsdk/win32
! 71: endif
! 72: # Edit the path below to point to the base of your nghttp2 package.
! 73: ifndef NGHTTP2_PATH
! 74: NGHTTP2_PATH = ../../nghttp2-1.0.0
! 75: endif
! 76:
! 77: PROOT = ..
! 78:
! 79: # Edit the path below to point to the base of your c-ares package.
! 80: ifndef LIBCARES_PATH
! 81: LIBCARES_PATH = $(PROOT)/ares
! 82: endif
! 83:
! 84: ifeq ($(CURL_CC),)
! 85: CURL_CC := $(CROSSPREFIX)gcc
! 86: endif
! 87: ifeq ($(CURL_AR),)
! 88: CURL_AR := $(CROSSPREFIX)ar
! 89: endif
! 90: ifeq ($(CURL_RANLIB),)
! 91: CURL_RANLIB := $(CROSSPREFIX)ranlib
! 92: endif
! 93:
! 94: CC = $(CURL_CC)
! 95: CFLAGS = $(CURL_CFLAG_EXTRAS) -g -O2 -Wall -W
! 96: CFLAGS += -fno-strict-aliasing
! 97: # comment LDFLAGS below to keep debug info
! 98: LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_DLL) -s
! 99: AR = $(CURL_AR)
! 100: RANLIB = $(CURL_RANLIB)
! 101: RC = $(CROSSPREFIX)windres
! 102: RCFLAGS = --include-dir=$(PROOT)/include -DDEBUGBUILD=0 -O coff
! 103: STRIP = $(CROSSPREFIX)strip -g
! 104:
! 105: # Set environment var ARCH to your architecture to override autodetection.
! 106: ifndef ARCH
! 107: ifeq ($(findstring x86_64,$(shell $(CC) -dumpmachine)),x86_64)
! 108: ARCH = w64
! 109: else
! 110: ARCH = w32
! 111: endif
! 112: endif
! 113:
! 114: ifeq ($(ARCH),w64)
! 115: CFLAGS += -m64 -D_AMD64_
! 116: LDFLAGS += -m64
! 117: RCFLAGS += -F pe-x86-64
! 118: else
! 119: CFLAGS += -m32
! 120: LDFLAGS += -m32
! 121: RCFLAGS += -F pe-i386
! 122: endif
! 123:
! 124: # Platform-dependent helper tool macros
! 125: ifeq ($(findstring /sh,$(SHELL)),/sh)
! 126: DEL = rm -f $1
! 127: RMDIR = rm -fr $1
! 128: MKDIR = mkdir -p $1
! 129: COPY = -cp -afv $1 $2
! 130: #COPYR = -cp -afr $1/* $2
! 131: COPYR = -rsync -aC $1/* $2
! 132: TOUCH = touch $1
! 133: CAT = cat
! 134: ECHONL = echo ""
! 135: DL = '
! 136: else
! 137: ifeq "$(OS)" "Windows_NT"
! 138: DEL = -del 2>NUL /q /f $(subst /,\,$1)
! 139: RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
! 140: else
! 141: DEL = -del 2>NUL $(subst /,\,$1)
! 142: RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
! 143: endif
! 144: MKDIR = -md 2>NUL $(subst /,\,$1)
! 145: COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
! 146: COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
! 147: TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
! 148: CAT = type
! 149: ECHONL = $(ComSpec) /c echo.
! 150: endif
! 151:
! 152: ########################################################
! 153: ## Nothing more to do below this line!
! 154:
! 155: ifeq ($(findstring -dyn,$(CFG)),-dyn)
! 156: DYN = 1
! 157: endif
! 158: ifeq ($(findstring -ares,$(CFG)),-ares)
! 159: ARES = 1
! 160: endif
! 161: ifeq ($(findstring -sync,$(CFG)),-sync)
! 162: SYNC = 1
! 163: endif
! 164: ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
! 165: RTMP = 1
! 166: SSL = 1
! 167: ZLIB = 1
! 168: endif
! 169: ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
! 170: SSH2 = 1
! 171: SSL = 1
! 172: ZLIB = 1
! 173: endif
! 174: ifeq ($(findstring -ssl,$(CFG)),-ssl)
! 175: SSL = 1
! 176: endif
! 177: ifeq ($(findstring -srp,$(CFG)),-srp)
! 178: SRP = 1
! 179: endif
! 180: ifeq ($(findstring -zlib,$(CFG)),-zlib)
! 181: ZLIB = 1
! 182: endif
! 183: ifeq ($(findstring -brotli,$(CFG)),-brotli)
! 184: BROTLI = 1
! 185: endif
! 186: ifeq ($(findstring -idn2,$(CFG)),-idn2)
! 187: IDN2 = 1
! 188: endif
! 189: ifeq ($(findstring -winidn,$(CFG)),-winidn)
! 190: WINIDN = 1
! 191: endif
! 192: ifeq ($(findstring -sspi,$(CFG)),-sspi)
! 193: SSPI = 1
! 194: endif
! 195: ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
! 196: LDAPS = 1
! 197: endif
! 198: ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
! 199: IPV6 = 1
! 200: endif
! 201: ifeq ($(findstring -winssl,$(CFG)),-winssl)
! 202: WINSSL = 1
! 203: SSPI = 1
! 204: endif
! 205: ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
! 206: NGHTTP2 = 1
! 207: endif
! 208:
! 209: INCLUDES = -I. -I../include
! 210: CFLAGS += -DBUILDING_LIBCURL
! 211: ifdef SSL
! 212: ifdef WINSSL
! 213: CFLAGS += -DCURL_WITH_MULTI_SSL
! 214: endif
! 215: endif
! 216:
! 217: ifdef SYNC
! 218: CFLAGS += -DUSE_SYNC_DNS
! 219: else
! 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
! 226: endif
! 227: ifdef RTMP
! 228: INCLUDES += -I"$(LIBRTMP_PATH)"
! 229: CFLAGS += -DUSE_LIBRTMP
! 230: DLL_LIBS += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
! 231: endif
! 232: ifdef NGHTTP2
! 233: INCLUDES += -I"$(NGHTTP2_PATH)/include"
! 234: CFLAGS += -DUSE_NGHTTP2
! 235: DLL_LIBS += -L"$(NGHTTP2_PATH)/lib" -lnghttp2
! 236: endif
! 237: ifdef 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
! 246: endif
! 247: ifdef 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_PKCS12_H \
! 274: -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
! 281: endif
! 282: ifdef WINSSL
! 283: CFLAGS += -DUSE_SCHANNEL
! 284: DLL_LIBS += -lcrypt32
! 285: endif
! 286: ifdef ZLIB
! 287: INCLUDES += -I"$(ZLIB_PATH)"
! 288: CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
! 289: DLL_LIBS += -L"$(ZLIB_PATH)" -lz
! 290: endif
! 291: ifdef 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
! 300: endif
! 301: ifdef IDN2
! 302: INCLUDES += -I"$(LIBIDN2_PATH)/include"
! 303: CFLAGS += -DUSE_LIBIDN2
! 304: DLL_LIBS += -L"$(LIBIDN2_PATH)/lib" -lidn2
! 305: else
! 306: ifdef WINIDN
! 307: CFLAGS += -DUSE_WIN32_IDN
! 308: CFLAGS += -DWANT_IDN_PROTOTYPES
! 309: DLL_LIBS += -L"$(WINIDN_PATH)" -lnormaliz
! 310: endif
! 311: endif
! 312: ifdef SSPI
! 313: CFLAGS += -DUSE_WINDOWS_SSPI
! 314: endif
! 315: ifdef SPNEGO
! 316: CFLAGS += -DHAVE_SPNEGO
! 317: endif
! 318: ifdef IPV6
! 319: CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
! 320: endif
! 321: ifdef LDAPS
! 322: CFLAGS += -DHAVE_LDAP_SSL
! 323: endif
! 324: ifdef 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
! 328: endif
! 329: ifdef USE_LDAP_OPENLDAP
! 330: INCLUDES += -I"$(LDAP_SDK)/include"
! 331: CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
! 332: DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber
! 333: endif
! 334: ifndef USE_LDAP_NOVELL
! 335: ifndef USE_LDAP_OPENLDAP
! 336: DLL_LIBS += -lwldap32
! 337: endif
! 338: endif
! 339: DLL_LIBS += -lws2_32
! 340:
! 341: # Makefile.inc provides the CSOURCES and HHEADERS defines
! 342: include Makefile.inc
! 343:
! 344: ifeq ($(CURL_DLL_A_SUFFIX),)
! 345: CURL_DLL_A_SUFFIX := dll
! 346: endif
! 347:
! 348: libcurl_dll_LIBRARY = libcurl$(CURL_DLL_SUFFIX).dll
! 349: libcurl_dll_a_LIBRARY = libcurl$(CURL_DLL_A_SUFFIX).a
! 350: libcurl_a_LIBRARY = libcurl.a
! 351:
! 352: libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
! 353: libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
! 354:
! 355: RESOURCE = libcurl.res
! 356:
! 357:
! 358: all: $(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:
! 380: clean:
! 381: @$(call DEL, $(libcurl_a_OBJECTS) $(RESOURCE))
! 382:
! 383: distclean 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
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>