Makefile 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. # -DSSL_LIB=\"libssl.so.<version>\" - use system versioned SSL shared object
  15. # -DCRYPTO_LIB=\"libcrypto.so.<version>\" - use system versioned CRYPTO so
  16. ##########################################################################
  17. ### UNIX build: linux, bsd, mac, rtems
  18. ##########################################################################
  19. CFLAGS = -W -Wall -std=c99 -pedantic -O2 $(COPT)
  20. MAC_SHARED = -flat_namespace -bundle -undefined suppress
  21. LINFLAGS = -ldl -pthread $(CFLAGS)
  22. LIB = _$(PROG).so
  23. #CC = g++
  24. # Make sure that the compiler flags come last in the compilation string.
  25. # If not so, this can break some on some Linux distros which use
  26. # "-Wl,--as-needed" turned on by default in cc command.
  27. # Also, this is turned in many other distros in static linkage builds.
  28. linux:
  29. $(CC) mongoose.c -shared -fPIC -fpic -o $(LIB) $(LINFLAGS)
  30. $(CC) mongoose.c main.c -o $(PROG) $(LINFLAGS)
  31. bsd:
  32. $(CC) mongoose.c -shared -pthread -fpic -fPIC -o $(LIB) $(CFLAGS)
  33. $(CC) mongoose.c main.c -pthread -o $(PROG) $(CFLAGS)
  34. mac:
  35. $(CC) mongoose.c -pthread -o $(LIB) $(MAC_SHARED) $(CFLAGS)
  36. $(CC) mongoose.c main.c -pthread -o $(PROG) $(CFLAGS)
  37. solaris:
  38. gcc mongoose.c -pthread -lnsl \
  39. -lsocket -fpic -fPIC -shared -o $(LIB) $(CFLAGS)
  40. gcc mongoose.c main.c -pthread -lnsl -lsocket -o $(PROG) $(CFLAGS)
  41. ##########################################################################
  42. ### WINDOWS build: Using Visual Studio or Mingw
  43. ##########################################################################
  44. # Using Visual Studio 6.0. To build Mongoose:
  45. # o Set VC variable below to where VS 6.0 is installed on your system
  46. # o Run "PATH_TO_VC6\bin\nmake windows"
  47. VC= z:
  48. CYA= y:
  49. #DBG= /Zi /DDEBUG /Od
  50. DBG= /DNDEBUG /O1
  51. CL= cl /MD /TC /nologo $(DBG) /Gz /W3 /DNO_SSL_DL
  52. GUILIB= user32.lib shell32.lib
  53. LINK= /link /incremental:no /libpath:$(VC)\lib /subsystem:windows \
  54. ws2_32.lib advapi32.lib cyassl.lib
  55. CYAFL = /c /I $(CYA)/include -I $(CYA)/include/openssl \
  56. /I $(CYA)/ctaocrypt/include /D _LIB /D OPENSSL_EXTRA
  57. CYASRC= \
  58. $(CYA)/src/cyassl_int.c \
  59. $(CYA)/src/cyassl_io.c \
  60. $(CYA)/src/keys.c \
  61. $(CYA)/src/tls.c \
  62. $(CYA)/src/ssl.c \
  63. $(CYA)/ctaocrypt/src/aes.c \
  64. $(CYA)/ctaocrypt/src/arc4.c \
  65. $(CYA)/ctaocrypt/src/asn.c \
  66. $(CYA)/ctaocrypt/src/coding.c \
  67. $(CYA)/ctaocrypt/src/ctc_asm.c \
  68. $(CYA)/ctaocrypt/src/ctc_misc.c \
  69. $(CYA)/ctaocrypt/src/cyassl_memory.c \
  70. $(CYA)/ctaocrypt/src/des3.c \
  71. $(CYA)/ctaocrypt/src/dh.c \
  72. $(CYA)/ctaocrypt/src/dsa.c \
  73. $(CYA)/ctaocrypt/src/ecc.c \
  74. $(CYA)/ctaocrypt/src/hc128.c \
  75. $(CYA)/ctaocrypt/src/hmac.c \
  76. $(CYA)/ctaocrypt/src/integer.c \
  77. $(CYA)/ctaocrypt/src/md4.c \
  78. $(CYA)/ctaocrypt/src/md5.c \
  79. $(CYA)/ctaocrypt/src/pwdbased.c \
  80. $(CYA)/ctaocrypt/src/rabbit.c \
  81. $(CYA)/ctaocrypt/src/random.c \
  82. $(CYA)/ctaocrypt/src/ripemd.c \
  83. $(CYA)/ctaocrypt/src/rsa.c \
  84. $(CYA)/ctaocrypt/src/sha.c \
  85. $(CYA)/ctaocrypt/src/sha256.c \
  86. $(CYA)/ctaocrypt/src/sha512.c \
  87. $(CYA)/ctaocrypt/src/tfm.c
  88. cyassl:
  89. $(CL) $(CYASRC) $(CYAFL) $(DEF)
  90. lib *.obj /out:cyassl.lib
  91. windows:
  92. rc win32\res.rc
  93. $(CL) main.c mongoose.c /GA $(LINK) win32\res.res \
  94. $(GUILIB) /out:$(PROG).exe
  95. $(CL) mongoose.c /GD $(LINK) /DLL /DEF:win32\dll.def /out:_$(PROG).dll
  96. # Build for Windows under MinGW
  97. #MINGWDBG= -DDEBUG -O0
  98. MINGWDBG= -DNDEBUG -Os
  99. #MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT
  100. MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,windows $(MINGWDBG)
  101. mingw:
  102. windres win32\res.rc win32\res.o
  103. gcc $(MINGWOPT) mongoose.c -lws2_32 \
  104. -shared -Wl,--out-implib=$(PROG).lib -o _$(PROG).dll
  105. gcc $(MINGWOPT) mongoose.c main.c win32\res.o -lws2_32 -ladvapi32 \
  106. -o $(PROG).exe
  107. ##########################################################################
  108. ### Manuals, cleanup, test, release
  109. ##########################################################################
  110. man:
  111. groff -man -T ascii mongoose.1 | col -b > mongoose.txt
  112. groff -man -T ascii mongoose.1 | less
  113. # "TEST=unit make test" - perform unit test only
  114. # "TEST=embedded" - test embedded API by building and testing test/embed.c
  115. # "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
  116. test: do_test
  117. do_test:
  118. perl test/test.pl $(TEST)
  119. release: clean
  120. 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\* -czf x mongoose && mv x mongoose/$$F
  121. clean:
  122. rm -rf *.o *.core $(PROG) *.obj *.so $(PROG).txt *.dSYM *.tgz