From ac21d75300dabe83578e4373fcfd09d67c3a083b Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sat, 5 Jan 2008 19:25:55 +0000 Subject: Add some .mk stubs to impersonate bsk .mk files to make writing our Makefiles easier. libeinfo, librc and rc now have their own seperate directories. More work is needed to tidy this up though. --- src/cc.mk | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/cc.mk (limited to 'src/cc.mk') diff --git a/src/cc.mk b/src/cc.mk new file mode 100644 index 00000000..d3c96a65 --- /dev/null +++ b/src/cc.mk @@ -0,0 +1,25 @@ +# Copyright 2008 Roy Marples + +# Setup some good default CFLAGS + +CFLAGS ?= -O2 -pipe + +# GNU Make way of detecting gcc flags we can use +check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ + then echo "$(1)"; else echo "$(2)"; fi) + +# pmake check for extra cflags +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; \ + then echo -n "$$x "; fi \ + done + +# Loads of nice flags to ensure our code is good +CFLAGS += -pedantic -std=c99 \ + -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) -- cgit v1.2.3