Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # This file is part of Mongoose project, http://code.google.com/p/mongoose
  2. # $Id: Makefile 473 2009-09-02 11:20:06Z valenok $
  3. PROG= mongoose
  4. all:
  5. @echo "make (linux|bsd|solaris|mac|windows|mingw)"
  6. # Possible COPT values: (in brackets are rough numbers for 'gcc -O2' on i386)
  7. # -DHAVE_MD5 - use system md5 library (-2kb)
  8. # -DNDEBUG - strip off all debug code (-5kb)
  9. # -DDEBUG - build debug version (very noisy) (+7kb)
  10. # -DNO_CGI - disable CGI support (-5kb)
  11. # -DNO_SSL - disable SSL functionality (-2kb)
  12. # -DCONFIG_FILE=\"file\" - use `file' as the default config file
  13. # -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
  14. ##########################################################################
  15. ### UNIX build: linux, bsd, mac, rtems
  16. ##########################################################################
  17. CFLAGS= -W -Wall -std=c99 -pedantic -O2 $(COPT)
  18. MAC_SHARED= -flat_namespace -bundle -undefined suppress
  19. LINFLAGS= -ldl -pthread $(CFLAGS)
  20. LIB= _$(PROG).so
  21. linux:
  22. $(CC) $(LINFLAGS) mongoose.c -shared -fPIC -fpic -o $(LIB)
  23. $(CC) $(LINFLAGS) mongoose.c main.c -o $(PROG)
  24. bsd:
  25. $(CC) $(CFLAGS) mongoose.c -shared -pthread -fpic -fPIC -o $(LIB)
  26. $(CC) $(CFLAGS) mongoose.c main.c -pthread -o $(PROG)
  27. mac:
  28. $(CC) $(CFLAGS) $(MAC_SHARED) mongoose.c -pthread -o $(LIB)
  29. $(CC) $(CFLAGS) mongoose.c main.c -pthread -o $(PROG)
  30. solaris:
  31. gcc $(CFLAGS) mongoose.c -pthread -lnsl \
  32. -lsocket -fpic -fPIC -shared -o $(LIB)
  33. gcc $(CFLAGS) mongoose.c main.c -pthread -lnsl -lsocket -o $(PROG)
  34. ##########################################################################
  35. ### WINDOWS build: Using Visual Studio or Mingw
  36. ##########################################################################
  37. # Using Visual Studio 6.0. To build Mongoose:
  38. # o Set VC variable below to where VS 6.0 is installed on your system
  39. # o Run "PATH_TO_VC6\bin\nmake windows"
  40. VC= z:
  41. CYA= y:
  42. #DBG= /Zi /DDEBUG /Od
  43. DBG= /DNDEBUG /O1
  44. CL= cl /MD /TC /nologo $(DBG) /Gz /W3 /DNO_SSL_DL
  45. GUILIB= user32.lib shell32.lib
  46. LINK= /link /incremental:no /libpath:$(VC)\lib /subsystem:windows \
  47. ws2_32.lib advapi32.lib cyassl.lib
  48. CYAFL= /c /I $(CYA)\ctaocrypt\include /I $(CYA)\include /D_LIB
  49. CYASRC= $(CYA)/src/cyassl_int.c \
  50. $(CYA)/src/cyassl_io.c \
  51. $(CYA)/src/keys.c \
  52. $(CYA)/src/tls.c \
  53. $(CYA)/ctaocrypt/src/aes.c \
  54. $(CYA)/ctaocrypt/src/arc4.c \
  55. $(CYA)/ctaocrypt/src/asn.c \
  56. $(CYA)/ctaocrypt/src/des3.c \
  57. $(CYA)/ctaocrypt/src/dh.c \
  58. $(CYA)/ctaocrypt/src/dsa.c \
  59. $(CYA)/ctaocrypt/src/hc128.c \
  60. $(CYA)/ctaocrypt/src/hmac.c \
  61. $(CYA)/ctaocrypt/src/integer.c \
  62. $(CYA)/ctaocrypt/src/md4.c \
  63. $(CYA)/ctaocrypt/src/md5.c \
  64. $(CYA)/ctaocrypt/src/misc.c \
  65. $(CYA)/ctaocrypt/src/rabbit.c \
  66. $(CYA)/ctaocrypt/src/random.c \
  67. $(CYA)/ctaocrypt/src/ripemd.c \
  68. $(CYA)/ctaocrypt/src/rsa.c \
  69. $(CYA)/ctaocrypt/src/sha.c \
  70. $(CYA)/ctaocrypt/src/sha256.c
  71. cyassl:
  72. $(CL) $(CYA)/src/ssl.c $(CYA)/ctaocrypt/src/coding.c \
  73. $(CYAFL) /DOPENSSL_EXTRA
  74. $(CL) $(CYASRC) $(CYAFL)
  75. lib *.obj /out:cyassl.lib
  76. windows:
  77. rc win32\res.rc
  78. $(CL) main.c mongoose.c /GA $(LINK) win32\res.res \
  79. $(GUILIB) /out:$(PROG).exe
  80. $(CL) mongoose.c /GD $(LINK) /DLL /DEF:win32\dll.def /out:_$(PROG).dll
  81. # Build for Windows under MinGW
  82. #MINGWDBG= -DDEBUG -O0
  83. MINGWDBG= -DNDEBUG -Os
  84. #MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT
  85. MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,windows $(MINGWDBG)
  86. mingw:
  87. windres win32\res.rc win32\res.o
  88. gcc $(MINGWOPT) mongoose.c -lws2_32 \
  89. -shared -Wl,--out-implib=$(PROG).lib -o _$(PROG).dll
  90. gcc $(MINGWOPT) mongoose.c main.c win32\res.o -lws2_32 -ladvapi32 \
  91. -o $(PROG).exe
  92. ##########################################################################
  93. ### Manuals, cleanup, test, release
  94. ##########################################################################
  95. man:
  96. groff -man -T ascii mongoose.1 | col -b > mongoose.txt
  97. groff -man -T ascii mongoose.1 | less
  98. # "TEST=unit make test" - perform unit test only
  99. # "TEST=embedded" - test embedded API by building and testing test/embed.c
  100. # "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
  101. test: do_test
  102. do_test:
  103. perl test/test.pl $(TEST)
  104. release: clean
  105. F=mongoose-`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`.tgz ; cd .. && tar --exclude \*.hg --exclude \*.svn --exclude \*.swp --exclude \*.nfs\* --exclude win32 -czf x mongoose && mv x mongoose/$$F
  106. clean:
  107. rm -rf *.o *.core $(PROG) *.obj $(PROG).txt *.dSYM *.tgz