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. # -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 -fomit-frame-pointer $(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= q:\vc6
  41. #DBG= /Zi /DDEBUG /Od /DDEBUG
  42. DBG= /DNDEBUG /Os
  43. CL= $(VC)\bin\cl.exe /MD /TC /nologo /W4 /c $(DBG) /I $(VC)/include
  44. LINK= $(VC)\bin\link.exe /incremental:no /libpath:$(VC)\lib ws2_32.lib
  45. OUT= c:\out
  46. DLL= $(OUT)\_$(PROG).dll
  47. EXE= $(OUT)\$(PROG).exe
  48. windows:
  49. $(CL) main.c /Fd$(OUT)\main.pdb /Fo$(OUT)\main.obj
  50. $(CL) mongoose.c /Fd$(OUT)\mongoose.pdb /Fo$(OUT)\mongoose.obj
  51. $(LINK) $(OUT)\mongoose.obj /DLL /DEF:win32\dll.def /out:$(DLL)
  52. $(LINK) $(OUT)\main.obj $(OUT)\mongoose.obj /out:$(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