Annotation of embedaddon/curl/docs/examples/Makefile.m32, revision 1.1.1.1

1.1       misho       1: #***************************************************************************
                      2: #                                  _   _ ____  _
                      3: #  Project                     ___| | | |  _ \| |
                      4: #                             / __| | | | |_) | |
                      5: #                            | (__| |_| |  _ <| |___
                      6: #                             \___|\___/|_| \_\_____|
                      7: #
                      8: # Copyright (C) 1998 - 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 curl examples with MingW (GCC-3.2 or later)
                     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 libmetalink package.
                     59: ifndef LIBMETALINK_PATH
                     60: LIBMETALINK_PATH = ../../../libmetalink-0.1.3
                     61: endif
                     62: # Edit the path below to point to the base of your libexpat package.
                     63: ifndef LIBEXPAT_PATH
                     64: LIBEXPAT_PATH = ../../../expat-2.1.0
                     65: endif
                     66: # Edit the path below to point to the base of your libxml2 package.
                     67: ifndef LIBXML2_PATH
                     68: LIBXML2_PATH = ../../../libxml2-2.9.2
                     69: endif
                     70: # Edit the path below to point to the base of your libidn2 package.
                     71: ifndef LIBIDN2_PATH
                     72: LIBIDN2_PATH = ../../../libidn2-2.0.3
                     73: endif
                     74: # Edit the path below to point to the base of your MS IDN package.
                     75: # Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
                     76: # https://www.microsoft.com/en-us/download/details.aspx?id=734
                     77: ifndef WINIDN_PATH
                     78: WINIDN_PATH = ../../../Microsoft IDN Mitigation APIs
                     79: endif
                     80: # Edit the path below to point to the base of your Novell LDAP NDK.
                     81: ifndef LDAP_SDK
                     82: LDAP_SDK = c:/novell/ndk/cldapsdk/win32
                     83: endif
                     84: # Edit the path below to point to the base of your nghttp2 package.
                     85: ifndef NGHTTP2_PATH
                     86: NGHTTP2_PATH = ../../../nghttp2-1.0.0
                     87: endif
                     88: 
                     89: PROOT = ../..
                     90: 
                     91: # Edit the path below to point to the base of your c-ares package.
                     92: ifndef LIBCARES_PATH
                     93: LIBCARES_PATH = $(PROOT)/ares
                     94: endif
                     95: 
                     96: ifeq ($(CURL_CC),)
                     97: CURL_CC := $(CROSSPREFIX)gcc
                     98: endif
                     99: ifeq ($(CURL_AR),)
                    100: CURL_AR := $(CROSSPREFIX)ar
                    101: endif
                    102: 
                    103: CC = $(CURL_CC)
                    104: CFLAGS = $(CURL_CFLAG_EXTRAS) -g -O2 -Wall -W
                    105: CFLAGS += -fno-strict-aliasing
                    106: # comment LDFLAGS below to keep debug info
                    107: LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_EXE) -s
                    108: RC = $(CROSSPREFIX)windres
                    109: RCFLAGS = --include-dir=$(PROOT)/include -O coff
                    110: 
                    111: # Set environment var ARCH to your architecture to override autodetection.
                    112: ifndef ARCH
                    113: ifeq ($(findstring x86_64,$(shell $(CC) -dumpmachine)),x86_64)
                    114: ARCH = w64
                    115: else
                    116: ARCH = w32
                    117: endif
                    118: endif
                    119: 
                    120: ifeq ($(ARCH),w64)
                    121: CFLAGS  += -m64 -D_AMD64_
                    122: LDFLAGS += -m64
                    123: RCFLAGS += -F pe-x86-64
                    124: else
                    125: CFLAGS  += -m32
                    126: LDFLAGS += -m32
                    127: RCFLAGS += -F pe-i386
                    128: endif
                    129: 
                    130: # Platform-dependent helper tool macros
                    131: ifeq ($(findstring /sh,$(SHELL)),/sh)
                    132: DEL     = rm -f $1
                    133: RMDIR   = rm -fr $1
                    134: MKDIR   = mkdir -p $1
                    135: COPY    = -cp -afv $1 $2
                    136: #COPYR  = -cp -afr $1/* $2
                    137: COPYR   = -rsync -aC $1/* $2
                    138: TOUCH   = touch $1
                    139: CAT     = cat
                    140: ECHONL  = echo ""
                    141: DL = '
                    142: else
                    143: ifeq "$(OS)" "Windows_NT"
                    144: DEL     = -del 2>NUL /q /f $(subst /,\,$1)
                    145: RMDIR   = -rd 2>NUL /q /s $(subst /,\,$1)
                    146: else
                    147: DEL     = -del 2>NUL $(subst /,\,$1)
                    148: RMDIR   = -deltree 2>NUL /y $(subst /,\,$1)
                    149: endif
                    150: MKDIR   = -md 2>NUL $(subst /,\,$1)
                    151: COPY    = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
                    152: COPYR   = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
                    153: TOUCH   = copy 2>&1>NUL /b $(subst /,\,$1) +,,
                    154: CAT     = type
                    155: ECHONL  = $(ComSpec) /c echo.
                    156: endif
                    157: 
                    158: ########################################################
                    159: ## Nothing more to do below this line!
                    160: 
                    161: ifeq ($(findstring -dyn,$(CFG)),-dyn)
                    162: DYN = 1
                    163: endif
                    164: ifeq ($(findstring -ares,$(CFG)),-ares)
                    165: ARES = 1
                    166: endif
                    167: ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
                    168: RTMP = 1
                    169: SSL = 1
                    170: ZLIB = 1
                    171: endif
                    172: ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
                    173: SSH2 = 1
                    174: SSL = 1
                    175: ZLIB = 1
                    176: endif
                    177: ifeq ($(findstring -ssl,$(CFG)),-ssl)
                    178: SSL = 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 -metalink,$(CFG)),-metalink)
                    202: METALINK = 1
                    203: endif
                    204: ifeq ($(findstring -winssl,$(CFG)),-winssl)
                    205: WINSSL = 1
                    206: SSPI = 1
                    207: endif
                    208: ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
                    209: NGHTTP2 = 1
                    210: endif
                    211: 
                    212: INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
                    213: 
                    214: ifdef DYN
                    215:   curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
                    216:   curl_LDADD = -L$(PROOT)/lib -lcurldll
                    217: else
                    218:   curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
                    219:   curl_LDADD = -L$(PROOT)/lib -lcurl
                    220:   CFLAGS += -DCURL_STATICLIB
                    221:   LDFLAGS += -static
                    222: endif
                    223: ifdef ARES
                    224:   ifndef DYN
                    225:     curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
                    226:   endif
                    227:   CFLAGS += -DUSE_ARES
                    228:   curl_LDADD += -L"$(LIBCARES_PATH)" -lcares
                    229: endif
                    230: ifdef RTMP
                    231:   CFLAGS += -DUSE_LIBRTMP
                    232:   curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
                    233: endif
                    234: ifdef NGHTTP2
                    235:   CFLAGS += -DUSE_NGHTTP2
                    236:   curl_LDADD += -L"$(NGHTTP2_PATH)/lib" -lnghttp2
                    237: endif
                    238: ifdef SSH2
                    239:   CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
                    240:   curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2
                    241:   ifdef WINSSL
                    242:     ifndef DYN
                    243:       curl_LDADD += -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:     OPENSSL_LIBS = -lssl -lcrypto
                    261:     ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out"
                    262:       OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
                    263:       ifdef DYN
                    264:         OPENSSL_LIBS = -lssl32 -leay32
                    265:       endif
                    266:     endif
                    267:     ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib"
                    268:       OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib
                    269:     endif
                    270:   endif
                    271:   ifndef DYN
                    272:     OPENSSL_LIBS += -lgdi32 -lcrypt32
                    273:   endif
                    274:   INCLUDES += -I"$(OPENSSL_INCLUDE)"
                    275:   CFLAGS += -DUSE_OPENSSL
                    276:   curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
                    277: endif
                    278: ifdef WINSSL
                    279:   CFLAGS += -DUSE_SCHANNEL
                    280:   curl_LDADD += -lcrypt32
                    281: endif
                    282: ifdef ZLIB
                    283:   INCLUDES += -I"$(ZLIB_PATH)"
                    284:   CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
                    285:   curl_LDADD += -L"$(ZLIB_PATH)" -lz
                    286: endif
                    287: ifdef BROTLI
                    288:   INCLUDES += -I"$(BROTLI_PATH)/include"
                    289:   CFLAGS += -DHAVE_BROTLI
                    290:   curl_LDADD += -L"$(BROTLI_PATH)/lib"
                    291:   ifdef BROTLI_LIBS
                    292:     curl_LDADD += $(BROTLI_LIBS)
                    293:   else
                    294:     curl_LDADD += -lbrotlidec
                    295:   endif
                    296: endif
                    297: ifdef IDN2
                    298:   CFLAGS += -DUSE_LIBIDN2
                    299:   curl_LDADD += -L"$(LIBIDN2_PATH)/lib" -lidn2
                    300: else
                    301: ifdef WINIDN
                    302:   CFLAGS += -DUSE_WIN32_IDN
                    303:   curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz
                    304: endif
                    305: endif
                    306: ifdef METALINK
                    307:   INCLUDES += -I"$(LIBMETALINK_PATH)/include"
                    308:   CFLAGS += -DUSE_METALINK
                    309:   curl_LDADD += -L"$(LIBMETALINK_PATH)/lib" -lmetalink
                    310:   ifndef DYN
                    311:     ifeq ($(findstring libexpat_metalink_parser.o,$(shell $(AR) t "$(LIBMETALINK_PATH)/lib/libmetalink.a")),libexpat_metalink_parser.o)
                    312:       curl_LDADD += -L"$(LIBEXPAT_PATH)/lib" -lexpat
                    313:     else
                    314:       curl_LDADD += -L"$(LIBXML2_PATH)/lib" -lxml2
                    315:     endif
                    316:   endif
                    317: endif
                    318: ifdef SSPI
                    319:   CFLAGS += -DUSE_WINDOWS_SSPI
                    320: endif
                    321: ifdef IPV6
                    322:   CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
                    323: endif
                    324: ifdef LDAPS
                    325:   CFLAGS += -DHAVE_LDAP_SSL
                    326: endif
                    327: ifdef USE_LDAP_NOVELL
                    328:   CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
                    329:   curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
                    330: endif
                    331: ifdef USE_LDAP_OPENLDAP
                    332:   CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
                    333:   curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
                    334: endif
                    335: ifndef USE_LDAP_NOVELL
                    336: ifndef USE_LDAP_OPENLDAP
                    337:   curl_LDADD += -lwldap32
                    338: endif
                    339: endif
                    340: curl_LDADD += -lws2_32
                    341: 
                    342: # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
                    343: include Makefile.inc
                    344: 
                    345: check_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
                    346: check_PROGRAMS += ftpuploadresume.exe synctime.exe
                    347: 
                    348: .PRECIOUS: %.o
                    349: 
                    350: 
                    351: all: $(check_PROGRAMS)
                    352: 
                    353: %.exe: %.o $(curl_DEPENDENCIES)
                    354:        $(CC) $(LDFLAGS) -o $@ $< $(curl_LDADD)
                    355: 
                    356: %.o: %.c
                    357:        $(CC) $(INCLUDES) $(CFLAGS) -c $<
                    358: 
                    359: %.res: %.rc
                    360:        $(RC) $(RCFLAGS) -i $< -o $@
                    361: 
                    362: clean:
                    363:        @$(call DEL, $(check_PROGRAMS:.exe=.o))
                    364: 
                    365: distclean vclean: clean
                    366:        @$(call DEL, $(check_PROGRAMS))

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>