Makefile.m32 3.9 KB

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