2009-05-01 15:11:40 +01:00
|
|
|
# Copyright (c) 2008 Roy Marples <roy@marples.name>
|
2008-01-05 19:25:55 +00:00
|
|
|
|
|
|
|
# Setup some good default CFLAGS
|
2011-05-28 12:00:13 -04:00
|
|
|
CFLAGS?= -O2 -g
|
2008-01-05 19:25:55 +00:00
|
|
|
|
2008-02-20 10:34:11 +00:00
|
|
|
# Default to using the C99 standard
|
2008-02-19 16:49:28 +00:00
|
|
|
CSTD?= c99
|
2011-02-02 14:57:10 -06:00
|
|
|
ifneq (${CSTD},)
|
|
|
|
CFLAGS+= -std=${CSTD}
|
|
|
|
endif
|
2008-02-19 16:49:28 +00:00
|
|
|
|
2008-09-18 13:49:58 +00:00
|
|
|
# Try and use some good cc flags if we're building from git
|
|
|
|
# We don't use -pedantic as it will warn about our perfectly valid
|
|
|
|
# use of %m in our logger.
|
|
|
|
_CCFLAGS= -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 \
|
|
|
|
-Wmissing-prototypes -Wmissing-declarations \
|
|
|
|
-Wmissing-noreturn -Wmissing-format-attribute \
|
|
|
|
-Wnested-externs \
|
|
|
|
-Winline -Wwrite-strings -Wcast-align -Wcast-qual \
|
|
|
|
-Wpointer-arith \
|
|
|
|
-Wdeclaration-after-statement -Wsequence-point
|
|
|
|
|
|
|
|
# We should be using -Wredundant-decls, but our library hidden proto stuff
|
|
|
|
# gives loads of warnings. I don't fully understand it (the hidden proto,
|
|
|
|
# not the warning) so we just silence the warning.
|
|
|
|
|
|
|
|
_CC_FLAGS_SH= for f in ${_CCFLAGS}; do \
|
|
|
|
if echo "int main(void) { return 0;} " | \
|
|
|
|
${CC} $$f -S -xc -o /dev/null - ; \
|
2008-02-20 10:34:11 +00:00
|
|
|
then printf "%s" "$$f "; fi \
|
2008-09-18 13:49:58 +00:00
|
|
|
done;
|
2011-01-29 17:32:38 -06:00
|
|
|
_CC_FLAGS:= $(shell ${_CC_FLAGS_SH})
|
|
|
|
CFLAGS+= ${_CC_FLAGS}
|
2011-05-28 12:00:34 -04:00
|
|
|
|
|
|
|
include ${MK}/debug.mk
|