mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-26 22:50:39 +08:00
Styling changes plus extra GCC options to suppress certain warnings
This commit is contained in:
parent
3d3359910f
commit
001cd78b45
69
Makefile
69
Makefile
@ -7,14 +7,14 @@ all:
|
|||||||
@echo "make (linux|bsd|solaris|mac|windows|mingw)"
|
@echo "make (linux|bsd|solaris|mac|windows|mingw)"
|
||||||
|
|
||||||
# Possible COPT values: (in brackets are rough numbers for 'gcc -O2' on i386)
|
# Possible COPT values: (in brackets are rough numbers for 'gcc -O2' on i386)
|
||||||
# -DHAVE_MD5 - use system md5 library (-2kb)
|
# -DHAVE_MD5 - use system md5 library (-2kb)
|
||||||
# -DNDEBUG - strip off all debug code (-5kb)
|
# -DNDEBUG - strip off all debug code (-5kb)
|
||||||
# -DDEBUG - build debug version (very noisy) (+7kb)
|
# -DDEBUG - build debug version (very noisy) (+7kb)
|
||||||
# -DNO_CGI - disable CGI support (-5kb)
|
# -DNO_CGI - disable CGI support (-5kb)
|
||||||
# -DNO_SSL - disable SSL functionality (-2kb)
|
# -DNO_SSL - disable SSL functionality (-2kb)
|
||||||
# -DCONFIG_FILE=\"file\" - use `file' as the default config file
|
# -DCONFIG_FILE=\"file\" - use `file' as the default config file
|
||||||
# -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
|
# -DHAVE_STRTOUI64 - use system strtoui64() function for strtoull()
|
||||||
# -DSSL_LIB=\"libssl.so.<version>\" - use system versioned SSL shared object
|
# -DSSL_LIB=\"libssl.so.<version>\" - use system versioned SSL shared object
|
||||||
# -DCRYPTO_LIB=\"libcrypto.so.<version>\" - use system versioned CRYPTO so
|
# -DCRYPTO_LIB=\"libcrypto.so.<version>\" - use system versioned CRYPTO so
|
||||||
|
|
||||||
|
|
||||||
@ -22,11 +22,13 @@ all:
|
|||||||
### UNIX build: linux, bsd, mac, rtems
|
### UNIX build: linux, bsd, mac, rtems
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
CFLAGS = -W -Wall -std=c99 -pedantic -O2 $(COPT)
|
GCC_WARNS = -W -Wall -pedantic -Wno-missing-field-initializers \
|
||||||
MAC_SHARED = -flat_namespace -bundle -undefined suppress
|
-Wno-unused-parameter -Wno-format-zero-length -Wno-missing-braces
|
||||||
LINFLAGS = -ldl -pthread $(CFLAGS)
|
CFLAGS = -W -Wall -std=c99 -O2 $(GCC_WARNS) $(COPT)
|
||||||
LIB = _$(PROG).so
|
MAC_SHARED = -flat_namespace -bundle -undefined suppress
|
||||||
#CC = g++
|
LINFLAGS = -ldl -pthread $(CFLAGS)
|
||||||
|
LIB = _$(PROG).so
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
# Make sure that the compiler flags come last in the compilation string.
|
# Make sure that the compiler flags come last in the compilation string.
|
||||||
# If not so, this can break some on some Linux distros which use
|
# If not so, this can break some on some Linux distros which use
|
||||||
@ -45,9 +47,9 @@ mac:
|
|||||||
$(CC) mongoose.c main.c -pthread -o $(PROG) $(CFLAGS)
|
$(CC) mongoose.c main.c -pthread -o $(PROG) $(CFLAGS)
|
||||||
|
|
||||||
solaris:
|
solaris:
|
||||||
gcc mongoose.c -pthread -lnsl \
|
$(CC) mongoose.c -pthread -lnsl \
|
||||||
-lsocket -fpic -fPIC -shared -o $(LIB) $(CFLAGS)
|
-lsocket -fpic -fPIC -shared -o $(LIB) $(CFLAGS)
|
||||||
gcc mongoose.c main.c -pthread -lnsl -lsocket -o $(PROG) $(CFLAGS)
|
$(CC) mongoose.c main.c -pthread -lnsl -lsocket -o $(PROG) $(CFLAGS)
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -58,14 +60,14 @@ solaris:
|
|||||||
# o Set VC variable below to where VS 6.0 is installed on your system
|
# o Set VC variable below to where VS 6.0 is installed on your system
|
||||||
# o Run "PATH_TO_VC6\bin\nmake windows"
|
# o Run "PATH_TO_VC6\bin\nmake windows"
|
||||||
|
|
||||||
VC= z:
|
VC = z:
|
||||||
CYA= y:
|
CYA = y:
|
||||||
#DBG= /Zi /DDEBUG /Od
|
#DBG = /Zi /DDEBUG /Od
|
||||||
DBG= /DNDEBUG /O1
|
DBG = /DNDEBUG /O1
|
||||||
CL= cl /MD /TC /nologo $(DBG) /Gz /W3 /DNO_SSL_DL
|
CL = cl /MD /TC /nologo $(DBG) /Gz /W3 /DNO_SSL_DL
|
||||||
GUILIB= user32.lib shell32.lib
|
GUILIB= user32.lib shell32.lib
|
||||||
LINK= /link /incremental:no /libpath:$(VC)\lib /subsystem:windows \
|
LINK = /link /incremental:no /libpath:$(VC)\lib /subsystem:windows \
|
||||||
ws2_32.lib advapi32.lib cyassl.lib
|
ws2_32.lib advapi32.lib cyassl.lib
|
||||||
CYAFL = /c /I $(CYA)/include -I $(CYA)/include/openssl \
|
CYAFL = /c /I $(CYA)/include -I $(CYA)/include/openssl \
|
||||||
/I $(CYA)/ctaocrypt/include /D _LIB /D OPENSSL_EXTRA
|
/I $(CYA)/ctaocrypt/include /D _LIB /D OPENSSL_EXTRA
|
||||||
|
|
||||||
@ -107,20 +109,20 @@ cyassl:
|
|||||||
|
|
||||||
windows:
|
windows:
|
||||||
rc win32\res.rc
|
rc win32\res.rc
|
||||||
$(CL) main.c mongoose.c /GA $(LINK) win32\res.res \
|
$(CL) /I win32 main.c mongoose.c /GA $(LINK) win32\res.res \
|
||||||
$(GUILIB) /out:$(PROG).exe
|
$(GUILIB) /out:$(PROG).exe
|
||||||
$(CL) mongoose.c /GD $(LINK) /DLL /DEF:win32\dll.def /out:_$(PROG).dll
|
$(CL) mongoose.c /GD $(LINK) /DLL /DEF:win32\dll.def /out:_$(PROG).dll
|
||||||
|
|
||||||
# Build for Windows under MinGW
|
# Build for Windows under MinGW
|
||||||
#MINGWDBG= -DDEBUG -O0
|
#MINGWDBG= -DDEBUG -O0 -ggdb
|
||||||
MINGWDBG= -DNDEBUG -Os
|
MINGWDBG= -DNDEBUG -Os
|
||||||
#MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT
|
MINGWOPT= -std=c99 -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
|
||||||
MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,windows $(MINGWDBG)
|
#MINGWOPT= -std=c99 -mthreads -Wl,--subsystem,windows $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
|
||||||
mingw:
|
mingw:
|
||||||
windres win32\res.rc win32\res.o
|
windres win32\res.rc win32\res.o
|
||||||
gcc $(MINGWOPT) mongoose.c -lws2_32 \
|
$(CC) $(MINGWOPT) mongoose.c -lws2_32 \
|
||||||
-shared -Wl,--out-implib=$(PROG).lib -o _$(PROG).dll
|
-shared -Wl,--out-implib=$(PROG).lib -o _$(PROG).dll
|
||||||
gcc $(MINGWOPT) mongoose.c main.c win32\res.o -lws2_32 -ladvapi32 \
|
$(CC) $(MINGWOPT) -Iwin32 mongoose.c main.c win32\res.o -lws2_32 -ladvapi32 \
|
||||||
-o $(PROG).exe
|
-o $(PROG).exe
|
||||||
|
|
||||||
|
|
||||||
@ -135,12 +137,15 @@ man:
|
|||||||
# "TEST=unit make test" - perform unit test only
|
# "TEST=unit make test" - perform unit test only
|
||||||
# "TEST=embedded" - test embedded API by building and testing test/embed.c
|
# "TEST=embedded" - test embedded API by building and testing test/embed.c
|
||||||
# "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
|
# "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
|
||||||
test: do_test
|
tests:
|
||||||
do_test:
|
|
||||||
perl test/test.pl $(TEST)
|
perl test/test.pl $(TEST)
|
||||||
|
|
||||||
release: clean
|
release: clean
|
||||||
F=mongoose-`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`.tgz ; cd .. && tar -czf x mongoose/{LICENSE,Makefile,bindings,examples,test,win32,mongoose.c,mongoose.h,mongoose.1,main.c} && mv x mongoose/$$F
|
F=mongoose-`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`.tgz ; cd .. && tar -czf x mongoose/{LICENSE,Makefile,bindings,examples,test,win32,mongoose.c,mongoose.h,mongoose.1,main.c} && mv x mongoose/$$F
|
||||||
|
|
||||||
|
mongoose.c: mongoose.h
|
||||||
|
main.c: mongoose.h
|
||||||
|
.PHONY: mongoose.c main.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o *.core $(PROG) *.obj *.so $(PROG).txt *.dSYM *.tgz
|
rm -rf *.o *.core $(PROG) *.obj *.so $(PROG).txt *.dSYM *.tgz $(PROG).exe *.dll *.lib
|
||||||
|
Loading…
Reference in New Issue
Block a user