diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-05-01 14:36:27 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-05-01 14:36:27 +0000 |
commit | 77695b344ba23756729cb4eec80c88cf92e91b90 (patch) | |
tree | 8979b70be7a719d3bcd23783b08b390e83d0d578 /share/mk | |
parent | f67666fcb77361b9487c3f52f6e626fd4ee7cafc (diff) | |
download | src-77695b344ba23756729cb4eec80c88cf92e91b90.tar.gz src-77695b344ba23756729cb4eec80c88cf92e91b90.zip |
Add a mechanism to allow Makefiles to specify the particular C dialect
in which the source code is written. This is controlled by the CSTD
variable, which can have one of the following values:
- "k&r" => -traditional
- "c89" or "c90" => -std=iso9899:1990
- "c94" or "c95" => -std=iso9899:199409
- "c99" => -std=iso9899:1999
The corresponding option is added to CFLAGS regardless of WARNS level.
This also removes -ansi from WARNS level 6, but adds -Wno-long-long to
work around a weird gcc bug (-ansi, which is supposedly equivalent to
-std=iso9899:1990, seems to turn long long warnings off instead of on)
If CSTD is undefined, CFLAGS are unchanged except for the -ansi /
-Wno-long-long change mentioned above for WARNS level 6.
Notes
Notes:
svn path=/head/; revision=114419
Diffstat (limited to 'share/mk')
-rw-r--r-- | share/mk/bsd.sys.mk | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 0b164a9f5fcf..65d8e6fa9b00 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -9,6 +9,17 @@ # for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143 .if !defined(NO_WARNS) +. if defined(CSTD) +. if ${CSTD} == "k&r" +CFLAGS += -traditional +. elif ${CSTD} == "c89" || ${CSTD} == "c90" +CFLAGS += -std=iso9899:1990 +. elif ${CSTD} == "c94" || ${CSTD} == "c95" +CFLAGS += -std=iso9899:199409 +. elif ${CSTD} == "c99" +CFLAGS += -std=iso9899:1999 +. endif +. endif . if defined(WARNS) . if ${WARNS} > 0 CFLAGS += -Wsystem-headers @@ -27,7 +38,7 @@ CFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-al . endif # BDECFLAGS . if ${WARNS} > 5 -CFLAGS += -ansi -pedantic -Wbad-function-cast -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls +CFLAGS += -pedantic -Wno-long-long -Wbad-function-cast -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls . endif . if ${WARNS} > 1 && ${WARNS} < 5 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't |