Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. # -DNO_SSI - disable SSI support (-4kb)
  14. # -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
  15. ##########################################################################
  16. ### UNIX build: linux, bsd, mac, rtems
  17. ##########################################################################
  18. CFLAGS= -W -Wall -std=c99 -pedantic -Os -fomit-frame-pointer $(COPT)
  19. MAC_SHARED= -flat_namespace -bundle -undefined suppress
  20. LINFLAGS= -ldl -pthread $(CFLAGS)
  21. LIB= _$(PROG).so
  22. linux:
  23. $(CC) $(LINFLAGS) mongoose.c -shared -fPIC -fpic -s -o $(LIB)
  24. $(CC) $(LINFLAGS) mongoose.c main.c -s -o $(PROG)
  25. bsd:
  26. $(CC) $(CFLAGS) mongoose.c -shared -pthread -s -fpic -fPIC -o $(LIB)
  27. $(CC) $(CFLAGS) mongoose.c main.c -pthread -s -o $(PROG)
  28. mac:
  29. $(CC) $(CFLAGS) $(MAC_SHARED) mongoose.c -pthread -o $(LIB)
  30. $(CC) $(CFLAGS) mongoose.c main.c -pthread -o $(PROG)
  31. solaris:
  32. gcc $(CFLAGS) mongoose.c -pthread -lnsl \
  33. -lsocket -s -fpic -fPIC -shared -o $(LIB)
  34. gcc $(CFLAGS) mongoose.c main.c -pthread -lnsl -lsocket -s -o $(PROG)
  35. ##########################################################################
  36. ### WINDOWS build: Using Visual Studio or Mingw
  37. ##########################################################################
  38. # Using Visual Studio Express
  39. # 1. Download and install Visual Studio Express 2008 to c:\msvc8
  40. # 2. Download and install Windows SDK to c:\sdk
  41. # 3. Go to c:\msvc8\vc\bin and start "VIsual Studio 2008 Command prompt"
  42. # (or Itanium/amd64 command promt to build x64 version)
  43. # 4. In the command prompt, go to mongoose directory and do "nmake windows"
  44. #WINDBG= /Zi /DDEBUG /Od /DDEBUG
  45. WINDBG= /DNDEBUG /Os
  46. WINFLAGS= /MT /TC /nologo /W4 $(WINDBG)
  47. windows:
  48. cl $(WINFLAGS) mongoose.c /link /incremental:no /DLL \
  49. /DEF:win32\dll.def /out:_$(PROG).dll ws2_32.lib
  50. cl $(WINFLAGS) mongoose.c main.c /link /incremental:no \
  51. /out:$(PROG).exe ws2_32.lib
  52. # Build for Windows under MinGW
  53. #MINGWDBG= -DDEBUG -O0
  54. MINGWDBG= -DNDEBUG -Os
  55. MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT
  56. mingw:
  57. gcc $(MINGWOPT) mongoose.c -lws2_32 \
  58. -shared -Wl,--out-implib=$(PROG).lib -o _$(PROG).dll
  59. gcc $(MINGWOPT) mongoose.c main.c -lws2_32 -ladvapi32 -o $(PROG).exe
  60. ##########################################################################
  61. ### Manuals, cleanup, test, release
  62. ##########################################################################
  63. man:
  64. cat mongoose.1 | tbl | groff -man -Tascii | col -b > mongoose.1.txt
  65. cat mongoose.1 | tbl | groff -man -Tascii | less
  66. # "TEST=unit make test" - perform unit test only
  67. # "TEST=embedded" - test embedded API by building and testing test/embed.c
  68. # "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
  69. test: do_test
  70. do_test:
  71. perl test/test.pl $(TEST)
  72. release: clean
  73. F=mongoose-`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`.tgz ; cd .. && tar --exclude \*.svn --exclude \*.swp --exclude \*.nfs\* --exclude win32 -czf x mongoose && mv x mongoose/$$F
  74. clean:
  75. rm -rf *.o *.core $(PROG) *.obj $(PROG).1.txt *.dSYM *.tgz