Makefile.m32 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #########################################################################
  2. # $Id$
  3. #
  4. ## Makefile for building curl examples with MingW32
  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. #########################################################################
  15. # Edit the path below to point to the base of your Zlib sources.
  16. ifndef ZLIB_PATH
  17. ZLIB_PATH = ../../zlib-1.2.3
  18. endif
  19. # Edit the path below to point to the base of your OpenSSL package.
  20. ifndef OPENSSL_PATH
  21. OPENSSL_PATH = ../../openssl-0.9.8g
  22. endif
  23. # Edit the path below to point to the base of your LibSSH2 package.
  24. ifndef LIBSSH2_PATH
  25. LIBSSH2_PATH = ../../libssh2-0.18
  26. endif
  27. # Edit the path below to point to the base of your Novell LDAP NDK.
  28. ifndef LDAP_SDK
  29. LDAP_SDK = c:/novell/ndk/cldapsdk/win32
  30. endif
  31. PROOT = ../..
  32. ARES_LIB = $(PROOT)/ares
  33. SSL = 1
  34. ZLIB = 1
  35. CC = gcc
  36. CFLAGS = -g -O2 -Wall
  37. # comment LDFLAGS below to keep debug info
  38. LDFLAGS = -s
  39. RC = windres
  40. RCFLAGS = --include-dir=$(PROOT)/include -O COFF -i
  41. RM = del /q /f > NUL 2>&1
  42. CP = copy
  43. ########################################################
  44. ## Nothing more to do below this line!
  45. INCLUDES = -I. -I$(PROOT) -I$(PROOT)/include -I$(PROOT)/lib
  46. LINK = $(CC) $(LDFLAGS) -o $@
  47. ifdef DYN
  48. curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
  49. curl_LDADD = -L$(PROOT)/lib -lcurldll
  50. else
  51. curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
  52. curl_LDADD = -L$(PROOT)/lib -lcurl
  53. CFLAGS += -DCURL_STATICLIB
  54. endif
  55. ifdef ARES
  56. ifndef DYN
  57. curl_DEPENDENCIES += $(ARES_LIB)/libcares.a
  58. endif
  59. CFLAGS += -DUSE_ARES
  60. curl_LDADD += -L$(ARES_LIB) -lcares
  61. endif
  62. ifdef SSH2
  63. CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
  64. curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2
  65. endif
  66. ifdef SSL
  67. INCLUDES += -I"$(OPENSSL_PATH)/outinc"
  68. CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H
  69. ifdef DYN
  70. curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32
  71. else
  72. curl_LDADD += -L$(OPENSSL_PATH)/out -lssl -lcrypto -lgdi32
  73. endif
  74. endif
  75. ifdef ZLIB
  76. INCLUDES += -I"$(ZLIB_PATH)"
  77. CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
  78. curl_LDADD += -L$(ZLIB_PATH) -lz
  79. endif
  80. ifdef SSPI
  81. CFLAGS += -DUSE_WINDOWS_SSPI
  82. endif
  83. ifdef IPV6
  84. CFLAGS += -DENABLE_IPV6
  85. endif
  86. ifdef LDAPS
  87. CFLAGS += -DHAVE_LDAP_SSL
  88. endif
  89. ifdef USE_LDAP_NOVELL
  90. CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
  91. curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
  92. endif
  93. ifdef USE_LDAP_OPENLDAP
  94. CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
  95. curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
  96. endif
  97. ifndef USE_LDAP_NOVELL
  98. ifndef USE_LDAP_OPENLDAP
  99. curl_LDADD += -lwldap32
  100. endif
  101. endif
  102. curl_LDADD += -lws2_32
  103. COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
  104. # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
  105. include Makefile.inc
  106. example_PROGRAMS := $(patsubst %,%.exe,$(strip $(check_PROGRAMS)))
  107. .SUFFIXES: .rc .res .o .exe
  108. all: $(example_PROGRAMS)
  109. .o.exe: $(curl_DEPENDENCIES)
  110. $(LINK) $< $(curl_LDADD)
  111. .c.o:
  112. $(COMPILE) -c $<
  113. .rc.res:
  114. $(RC) $(RCFLAGS) $< -o $@
  115. clean:
  116. $(RM) $(example_PROGRAMS)