2008-01-09 17:14:43 +05:30
|
|
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
2008-01-06 00:55:55 +05:30
|
|
|
|
|
|
|
# Setup some good default CFLAGS
|
|
|
|
|
2008-01-09 17:14:43 +05:30
|
|
|
CFLAGS?= -O2 -pipe
|
|
|
|
CSTD?= c99
|
2008-01-06 00:55:55 +05:30
|
|
|
|
|
|
|
# GNU Make way of detecting gcc flags we can use
|
2008-01-09 17:14:43 +05:30
|
|
|
check_gcc=$(shell if ${CC} $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
|
|
|
then echo "$(1)"; else echo "$(2)"; fi)
|
2008-01-06 00:55:55 +05:30
|
|
|
|
|
|
|
# pmake check for extra cflags
|
2008-01-09 17:14:43 +05:30
|
|
|
WEXTRA!= for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \
|
|
|
|
if ${CC} $$x -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
2008-01-06 00:55:55 +05:30
|
|
|
then echo -n "$$x "; fi \
|
|
|
|
done
|
|
|
|
|
|
|
|
# Loads of nice flags to ensure our code is good
|
2008-01-09 17:14:43 +05:30
|
|
|
CFLAGS+= -pedantic -std=${CSTD} \
|
|
|
|
-Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
|
|
|
|
-Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
|
|
|
|
-Wbad-function-cast -Wnested-externs -Wcomment -Winline \
|
|
|
|
-Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
|
|
|
|
$(call check_gcc, -Wdeclaration-after-statement) \
|
|
|
|
$(call check_gcc, -Wsequence-point) \
|
|
|
|
$(call check_gcc, -Wextra) ${WEXTRA}
|
2008-01-07 19:50:13 +05:30
|
|
|
|