Makefile 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 6.0
  39. # Assuming that studio is installed in d:\vc6, change VC variable below to
  40. # the correct path on your system. Run "d:\vc6\bin\nmake windows"
  41. VC= d:\vc2010\vc
  42. #VC= d:\vc6
  43. SDK= d:\sdk\v7.1
  44. #WINDBG= /Zi /DDEBUG /Od /DDEBUG
  45. WINDBG= /DNDEBUG /Os
  46. WINFLAGS= /MT /TC /nologo /W4 $(WINDBG) /I $(VC)/include \
  47. /I $(SDK)\include /link /incremental:no /libpath:$(VC)\lib \
  48. /libpath:$(SDK)/lib ws2_32.lib
  49. windows:
  50. $(VC)\bin\cl.exe mongoose.c $(WINFLAGS) \
  51. /DLL /DEF:win32\dll.def /out:_$(PROG).dll
  52. $(VC)\bin\cl.exe mongoose.c main.c $(WINFLAGS) /out:$(PROG).exe
  53. # Build for Windows under MinGW
  54. #MINGWDBG= -DDEBUG -O0
  55. MINGWDBG= -DNDEBUG -Os
  56. MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT
  57. mingw:
  58. gcc $(MINGWOPT) mongoose.c -lws2_32 \
  59. -shared -Wl,--out-implib=$(PROG).lib -o _$(PROG).dll
  60. gcc $(MINGWOPT) mongoose.c main.c -lws2_32 -ladvapi32 -o $(PROG).exe
  61. ##########################################################################
  62. ### Manuals, cleanup, test, release
  63. ##########################################################################
  64. man:
  65. cat mongoose.1 | tbl | groff -man -Tascii | col -b > mongoose.1.txt
  66. cat mongoose.1 | tbl | groff -man -Tascii | less
  67. # "TEST=unit make test" - perform unit test only
  68. # "TEST=embedded" - test embedded API by building and testing test/embed.c
  69. # "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
  70. test: do_test
  71. do_test:
  72. perl test/test.pl $(TEST)
  73. release: clean
  74. 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
  75. clean:
  76. rm -rf *.o *.core $(PROG) *.obj $(PROG).1.txt *.dSYM *.tgz