Styling changes plus extra GCC options to suppress certain warnings

This commit is contained in:
Sergey Lyubka 2012-08-19 12:22:28 +01:00
parent 3d3359910f
commit 001cd78b45

View File

@ -22,11 +22,13 @@ all:
### UNIX build: linux, bsd, mac, rtems
##########################################################################
CFLAGS = -W -Wall -std=c99 -pedantic -O2 $(COPT)
GCC_WARNS = -W -Wall -pedantic -Wno-missing-field-initializers \
-Wno-unused-parameter -Wno-format-zero-length -Wno-missing-braces
CFLAGS = -W -Wall -std=c99 -O2 $(GCC_WARNS) $(COPT)
MAC_SHARED = -flat_namespace -bundle -undefined suppress
LINFLAGS = -ldl -pthread $(CFLAGS)
LIB = _$(PROG).so
#CC = g++
CC = gcc
# 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
@ -45,9 +47,9 @@ mac:
$(CC) mongoose.c main.c -pthread -o $(PROG) $(CFLAGS)
solaris:
gcc mongoose.c -pthread -lnsl \
$(CC) mongoose.c -pthread -lnsl \
-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)
##########################################################################
@ -107,20 +109,20 @@ cyassl:
windows:
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
$(CL) mongoose.c /GD $(LINK) /DLL /DEF:win32\dll.def /out:_$(PROG).dll
# Build for Windows under MinGW
#MINGWDBG= -DDEBUG -O0
#MINGWDBG= -DDEBUG -O0 -ggdb
MINGWDBG= -DNDEBUG -Os
#MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT
MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,windows $(MINGWDBG)
MINGWOPT= -std=c99 -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
#MINGWOPT= -std=c99 -mthreads -Wl,--subsystem,windows $(MINGWDBG) -DHAVE_STDINT $(GCC_WARNINGS) $(COPT)
mingw:
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
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
@ -135,12 +137,15 @@ man:
# "TEST=unit make test" - perform unit test only
# "TEST=embedded" - test embedded API by building and testing test/embed.c
# "TEST=basic_tests" - perform basic tests only (no CGI, SSI..)
test: do_test
do_test:
tests:
perl test/test.pl $(TEST)
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
mongoose.c: mongoose.h
main.c: mongoose.h
.PHONY: mongoose.c main.c
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