2008-01-09 17:14:43 +05:30
|
|
|
# Copyright 2008 Roy Marples <roy@marples.name>
|
2008-03-26 23:23:37 +05:30
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
2008-01-06 00:55:55 +05:30
|
|
|
|
|
|
|
# Setup some good default CFLAGS
|
2008-02-20 16:04:11 +05:30
|
|
|
CFLAGS?= -O2
|
2008-01-06 00:55:55 +05:30
|
|
|
|
2008-02-20 16:04:11 +05:30
|
|
|
# Default to using the C99 standard
|
2008-02-19 22:19:28 +05:30
|
|
|
CSTD?= c99
|
|
|
|
_CSTD_SH= if test -n "${CSTD}"; then echo "-std=${CSTD}"; else echo ""; fi
|
|
|
|
_CSTD!= ${_CSTD_SH}
|
2008-02-19 23:21:20 +05:30
|
|
|
CFLAGS+= ${_CSTD}$(shell ${_CSTD_SH})
|
2008-02-19 22:19:28 +05:30
|
|
|
|
2008-02-20 16:04:11 +05:30
|
|
|
# Try and use some good cc flags
|
|
|
|
_CC_FLAGS= -pedantic -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
|
2008-01-09 17:14:43 +05:30
|
|
|
-Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
|
|
|
|
-Wbad-function-cast -Wnested-externs -Wcomment -Winline \
|
|
|
|
-Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
|
2008-02-20 16:04:11 +05:30
|
|
|
-Wdeclaration-after-statement -Wsequence-point -Wextra
|
|
|
|
_CC_FLAGS_SH= for f in ${_CC_FLAGS}; do \
|
|
|
|
if ${CC} $$f -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
|
|
|
then printf "%s" "$$f "; fi \
|
|
|
|
done
|
|
|
|
_CC_FLAGS!= ${_CC_FLAGS_SH}
|
|
|
|
CFLAGS+= ${_CC_FLAGS}$(shell ${CC_FLAGS_SH})
|