Makefile.m32 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #############################################################
  2. # $Id$
  3. #
  4. ## Makefile for building libcurl.a with MingW32 (GCC-3.2) and
  5. ## optionally OpenSSL (0.9.8)
  6. ##
  7. ## Use: make -f Makefile.m32 [SSL=1] [SSH2=1] [DYN=1]
  8. ##
  9. ## Comments to: Troy Engel <tengel@sonic.net> or
  10. ## Joern Hartroth <hartroth@acm.org>
  11. ifndef OPENSSL_PATH
  12. OPENSSL_PATH = ../../openssl-0.9.8d
  13. endif
  14. ifndef LIBSSH2_PATH
  15. LIBSSH2_PATH = ../../libssh2-0.14
  16. endif
  17. ifndef ZLIB_PATH
  18. ZLIB_PATH = ../../zlib-1.2.3
  19. endif
  20. CC = gcc
  21. AR = ar
  22. RM = rm -f
  23. RANLIB = ranlib
  24. STRIP = strip -g
  25. ########################################################
  26. ## Nothing more to do below this line!
  27. INCLUDES = -I. -I../include
  28. CFLAGS = -g -O2 -DBUILDING_LIBCURL -DHAVE_LONGLONG
  29. ifdef SSH2
  30. INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
  31. CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
  32. DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2
  33. endif
  34. ifdef SSL
  35. INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
  36. CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
  37. -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \
  38. -DCURL_CA_BUNDLE='getenv("CURL_CA_BUNDLE")'
  39. DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32
  40. endif
  41. ifdef ZLIB
  42. INCLUDES += -I"$(ZLIB_PATH)"
  43. CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
  44. DLL_LIBS += -L$(ZLIB_PATH) -lz
  45. endif
  46. COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
  47. # Makefile.inc provides the CSOURCES and HHEADERS defines
  48. include Makefile.inc
  49. libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
  50. libcurl_a_LIBRARIES = libcurl.a
  51. libcurl_a_DEPENDENCIES = $(strip $(CSOURCES) $(HHEADERS))
  52. all: libcurl.a libcurl.dll libcurldll.a
  53. libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
  54. $(RM) libcurl.a
  55. $(AR) cru libcurl.a $(libcurl_a_OBJECTS)
  56. $(RANLIB) libcurl.a
  57. $(STRIP) $@
  58. RESOURCE = libcurl.res
  59. # remove the last line above to keep debug info
  60. libcurl.dll libcurldll.a: $(libcurl_a_OBJECTS) $(RESOURCE)
  61. $(RM) $@
  62. $(CC) -s -shared -Wl,--out-implib,libcurldll.a -o libcurl.dll \
  63. $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS) -lws2_32 -lwinmm
  64. # remove the above '-s' to keep debug info
  65. .c.o:
  66. $(COMPILE) -c $<
  67. libcurl.res: libcurl.rc
  68. windres -DCURLDEBUG=0 -O COFF -o $@ -i $^
  69. clean:
  70. $(RM) $(libcurl_a_OBJECTS) $(RESOURCE)
  71. distrib: clean
  72. $(RM) $(libcurl_a_LIBRARIES)