Makefile.m32 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2011, 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 http://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. ## Makefile for building curl examples with MingW (GCC-3.2 or later)
  24. ## and optionally OpenSSL (0.9.8), libssh2 (1.3), zlib (1.2.5), librtmp (2.3)
  25. ##
  26. ## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
  27. ## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-spi-winidn
  28. ##
  29. ## Hint: you can also set environment vars to control the build, f.e.:
  30. ## set ZLIB_PATH=c:/zlib-1.2.5
  31. ## set ZLIB=1
  32. #
  33. ###########################################################################
  34. # Edit the path below to point to the base of your Zlib sources.
  35. ifndef ZLIB_PATH
  36. ZLIB_PATH = ../../../zlib-1.2.5
  37. endif
  38. # Edit the path below to point to the base of your OpenSSL package.
  39. ifndef OPENSSL_PATH
  40. OPENSSL_PATH = ../../../openssl-0.9.8r
  41. endif
  42. ifndef OPENSSL_LIBPATH
  43. OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
  44. endif
  45. ifndef OPENSSL_LIBS
  46. OPENSSL_LIBS = -leay32 -lssl32
  47. endif
  48. # Edit the path below to point to the base of your LibSSH2 package.
  49. ifndef LIBSSH2_PATH
  50. LIBSSH2_PATH = ../../../libssh2-1.3.0
  51. endif
  52. # Edit the path below to point to the base of your librtmp package.
  53. ifndef LIBRTMP_PATH
  54. LIBRTMP_PATH = ../../../librtmp-2.3
  55. endif
  56. # Edit the path below to point to the base of your libidn package.
  57. ifndef LIBIDN_PATH
  58. LIBIDN_PATH = ../../../libidn-1.18
  59. endif
  60. # Edit the path below to point to the base of your MS idndlpackage.
  61. # Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
  62. # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815
  63. ifndef WINIDN_PATH
  64. WINIDN_PATH = ../../../Microsoft IDN Mitigation APIs
  65. endif
  66. # Edit the path below to point to the base of your Novell LDAP NDK.
  67. ifndef LDAP_SDK
  68. LDAP_SDK = c:/novell/ndk/cldapsdk/win32
  69. endif
  70. PROOT = ../..
  71. # Edit the path below to point to the base of your c-ares package.
  72. ifndef LIBCARES_PATH
  73. LIBCARES_PATH = $(PROOT)/ares
  74. endif
  75. # Edit the var below to set to your architecture or set environment var.
  76. ifndef ARCH
  77. ARCH = w32
  78. endif
  79. SSL = 1
  80. ZLIB = 1
  81. CC = gcc
  82. CFLAGS = -g -O2 -Wall
  83. CFLAGS += -fno-strict-aliasing
  84. ifeq ($(ARCH),w64)
  85. CFLAGS += -D_AMD64_
  86. endif
  87. # comment LDFLAGS below to keep debug info
  88. LDFLAGS = -s
  89. RC = windres
  90. RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
  91. RM = del /q /f 2>NUL
  92. CP = copy
  93. ########################################################
  94. ## Nothing more to do below this line!
  95. ifeq ($(findstring -dyn,$(CFG)),-dyn)
  96. DYN = 1
  97. endif
  98. ifeq ($(findstring -ares,$(CFG)),-ares)
  99. ARES = 1
  100. endif
  101. ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
  102. RTMP = 1
  103. SSL = 1
  104. ZLIB = 1
  105. endif
  106. ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
  107. SSH2 = 1
  108. SSL = 1
  109. ZLIB = 1
  110. endif
  111. ifeq ($(findstring -ssl,$(CFG)),-ssl)
  112. SSL = 1
  113. endif
  114. ifeq ($(findstring -zlib,$(CFG)),-zlib)
  115. ZLIB = 1
  116. endif
  117. ifeq ($(findstring -idn,$(CFG)),-idn)
  118. IDN = 1
  119. endif
  120. ifeq ($(findstring -winidn,$(CFG)),-winidn)
  121. WINIDN = 1
  122. endif
  123. ifeq ($(findstring -sspi,$(CFG)),-sspi)
  124. SSPI = 1
  125. endif
  126. ifeq ($(findstring -spnego,$(CFG)),-spnego)
  127. SPNEGO = 1
  128. endif
  129. ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
  130. LDAPS = 1
  131. endif
  132. ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
  133. IPV6 = 1
  134. endif
  135. INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
  136. ifdef DYN
  137. curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
  138. curl_LDADD = -L$(PROOT)/lib -lcurldll
  139. else
  140. curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
  141. curl_LDADD = -L$(PROOT)/lib -lcurl
  142. CFLAGS += -DCURL_STATICLIB
  143. endif
  144. ifdef ARES
  145. ifndef DYN
  146. curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
  147. endif
  148. CFLAGS += -DUSE_ARES
  149. curl_LDADD += -L"$(LIBCARES_PATH)" -lcares
  150. endif
  151. ifdef RTMP
  152. CFLAGS += -DUSE_LIBRTMP
  153. curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
  154. endif
  155. ifdef SSH2
  156. CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
  157. curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2
  158. endif
  159. ifdef SSL
  160. CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
  161. curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
  162. endif
  163. ifdef ZLIB
  164. INCLUDES += -I"$(ZLIB_PATH)"
  165. CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
  166. curl_LDADD += -L"$(ZLIB_PATH)" -lz
  167. endif
  168. ifdef IDN
  169. CFLAGS += -DUSE_LIBIDN
  170. curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn
  171. else
  172. ifdef WINIDN
  173. CFLAGS += -DUSE_WIN32_IDN
  174. curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz
  175. endif
  176. endif
  177. ifdef SSPI
  178. CFLAGS += -DUSE_WINDOWS_SSPI
  179. endif
  180. ifdef SPNEGO
  181. CFLAGS += -DHAVE_SPNEGO
  182. endif
  183. ifdef IPV6
  184. CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
  185. endif
  186. ifdef LDAPS
  187. CFLAGS += -DHAVE_LDAP_SSL
  188. endif
  189. ifdef USE_LDAP_NOVELL
  190. CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
  191. curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
  192. endif
  193. ifdef USE_LDAP_OPENLDAP
  194. CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
  195. curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
  196. endif
  197. ifndef USE_LDAP_NOVELL
  198. ifndef USE_LDAP_OPENLDAP
  199. curl_LDADD += -lwldap32
  200. endif
  201. endif
  202. curl_LDADD += -lws2_32
  203. # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
  204. include Makefile.inc
  205. check_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
  206. check_PROGRAMS += ftpuploadresume.exe synctime.exe
  207. all: $(check_PROGRAMS)
  208. %.exe: %.o $(curl_DEPENDENCIES)
  209. $(CC) $(LDFLAGS) -o $@ $< $(curl_LDADD)
  210. %.o: %.c
  211. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  212. %.res: %.rc
  213. $(RC) $(RCFLAGS) $< -o $@
  214. clean:
  215. -$(RM) $(check_PROGRAMS:.exe=.o)
  216. distclean vclean: clean
  217. -$(RM) $(check_PROGRAMS)