Makefile.m32 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. #########################################################################
  2. # $Id$
  3. #
  4. ## Makefile for building libcurl.a with MingW32 (GCC-3.2 or later)
  5. ## and optionally OpenSSL (0.9.8), libssh2 (1.1), zlib (1.2.3)
  6. ##
  7. ## Usage:
  8. ## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [DYN=1]
  9. ##
  10. ## Hint: you can also set environment vars to control the build, f.e.:
  11. ## set ZLIB_PATH=c:/zlib-1.2.3
  12. ## set ZLIB=1
  13. ##
  14. ## Comments to: Troy Engel <tengel@sonic.net> or
  15. ## Joern Hartroth <hartroth@acm.org>
  16. #########################################################################
  17. # Edit the path below to point to the base of your Zlib sources.
  18. ifndef ZLIB_PATH
  19. ZLIB_PATH = ../../zlib-1.2.3
  20. endif
  21. # Edit the path below to point to the base of your OpenSSL package.
  22. ifndef OPENSSL_PATH
  23. OPENSSL_PATH = ../../openssl-0.9.8k
  24. endif
  25. # Edit the path below to point to the base of your LibSSH2 package.
  26. ifndef LIBSSH2_PATH
  27. LIBSSH2_PATH = ../../libssh2-1.1
  28. endif
  29. # Edit the path below to point to the base of your libidn package.
  30. ifndef LIBIDN_PATH
  31. LIBIDN_PATH = ../../libidn-1.13
  32. endif
  33. # Edit the path below to point to the base of your Novell LDAP NDK.
  34. ifndef LDAP_SDK
  35. LDAP_SDK = c:/novell/ndk/cldapsdk/win32
  36. endif
  37. ARES_LIB = ../ares
  38. CC = gcc
  39. AR = ar
  40. # comment LDFLAGS below to keep debug info
  41. LDFLAGS = -s
  42. RANLIB = ranlib
  43. RC = windres
  44. RCFLAGS = --include-dir=../include -DDEBUGBUILD=0 -O COFF -i
  45. RM = del /q /f > NUL 2>&1
  46. STRIP = strip -g
  47. ########################################################
  48. ## Nothing more to do below this line!
  49. INCLUDES = -I. -I../include
  50. CFLAGS = -g -O2 -DBUILDING_LIBCURL
  51. ifdef ARES
  52. INCLUDES += -I$(ARES_LIB)
  53. CFLAGS += -DUSE_ARES
  54. DLL_LIBS += -L$(ARES_LIB) -lcares
  55. libcurl_dll_DEPENDENCIES = $(ARES_LIB)/libcares.a
  56. endif
  57. ifdef SSH2
  58. INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
  59. CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
  60. DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2
  61. endif
  62. ifdef SSL
  63. INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
  64. CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
  65. -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \
  66. -DCURL_WANTS_CA_BUNDLE_ENV
  67. DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32
  68. endif
  69. ifdef ZLIB
  70. INCLUDES += -I"$(ZLIB_PATH)"
  71. CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
  72. DLL_LIBS += -L$(ZLIB_PATH) -lz
  73. endif
  74. ifdef IDN
  75. INCLUDES += -I"$(LIBIDN_PATH)/include"
  76. CFLAGS += -DUSE_LIBIDN
  77. DLL_LIBS += -L$(LIBIDN_PATH)/lib -lidn
  78. endif
  79. ifdef SSPI
  80. CFLAGS += -DUSE_WINDOWS_SSPI
  81. endif
  82. ifdef IPV6
  83. CFLAGS += -DENABLE_IPV6
  84. endif
  85. ifdef LDAPS
  86. CFLAGS += -DHAVE_LDAP_SSL
  87. endif
  88. ifdef USE_LDAP_NOVELL
  89. INCLUDES += -I"$(LDAP_SDK)/inc"
  90. CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
  91. DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
  92. endif
  93. ifdef USE_LDAP_OPENLDAP
  94. INCLUDES += -I"$(LDAP_SDK)/include"
  95. CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
  96. DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber
  97. endif
  98. ifndef USE_LDAP_NOVELL
  99. ifndef USE_LDAP_OPENLDAP
  100. DLL_LIBS += -lwldap32
  101. endif
  102. endif
  103. DLL_LIBS += -lws2_32
  104. COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
  105. # Makefile.inc provides the CSOURCES and HHEADERS defines
  106. include Makefile.inc
  107. libcurl_dll_LIBRARY = libcurl.dll
  108. libcurl_dll_a_LIBRARY = libcurldll.a
  109. libcurl_a_LIBRARY = libcurl.a
  110. libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
  111. libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
  112. RESOURCE = libcurl.res
  113. .SUFFIXES: .rc .res
  114. all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
  115. $(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
  116. -$(RM) $@
  117. $(AR) cru $@ $(libcurl_a_OBJECTS)
  118. $(RANLIB) $@
  119. $(STRIP) $@
  120. # remove the last line above to keep debug info
  121. $(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
  122. -$(RM) $@
  123. $(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \
  124. -o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
  125. .c.o:
  126. $(COMPILE) -c $<
  127. .rc.res:
  128. $(RC) $(RCFLAGS) $< -o $@
  129. clean:
  130. -$(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
  131. distrib: clean
  132. -$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY)
  133. FORCE: ;
  134. $(ARES_LIB)/libcares.a:
  135. $(MAKE) -C $(ARES_LIB) -f Makefile.m32