1 # Copyright 2008 Roy Marples <roy@marples.name>
3 # Setup some good default CFLAGS
6 # Try and use some good cc flags if we're building from svn
7 # We don't use -pedantic as it will warn about our perfectly valid
8 # use of %m in our logger.
9 _CCFLAGS= -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 \
10 -Wmissing-prototypes -Wmissing-declarations \
11 -Wmissing-noreturn -Wmissing-format-attribute \
12 -Wredundant-decls -Wnested-externs \
13 -Winline -Wwrite-strings -Wcast-align -Wcast-qual \
15 -Wdeclaration-after-statement -Wsequence-point
16 _CC_FLAGS_SH= if ! test -d .svn; then echo ""; else for f in ${_CCFLAGS}; do \
17 if echo "int main(void) { return 0;} " | \
18 ${CC} $$f -S -xc -o /dev/null - ; \
19 then printf "%s" "$$f "; fi \
21 _CC_FLAGS!= ${_CC_FLAGS_SH}
22 CFLAGS+= ${_CC_FLAGS}$(shell ${_CC_FLAGS_SH})