Commit 001cd78b authored by Sergey Lyubka's avatar Sergey Lyubka

Styling changes plus extra GCC options to suppress certain warnings

parent 3d335991
...@@ -22,11 +22,13 @@ all: ...@@ -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 \
-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 MAC_SHARED = -flat_namespace -bundle -undefined suppress
LINFLAGS = -ldl -pthread $(CFLAGS) LINFLAGS = -ldl -pthread $(CFLAGS)
LIB = _$(PROG).so LIB = _$(PROG).so
#CC = g++ 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: ...@@ -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,13 +60,13 @@ solaris: ...@@ -58,13 +60,13 @@ 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: ...@@ -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: ...@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment