rules: provide default C and C++ standards

Default CSTD to c99, no default for CXXSTD, but if provided it will be used.

Add required gnu99 flags to projects using gnu styles.
This commit is contained in:
Karl Palsson
2016-04-18 00:34:29 +00:00
parent 408b83f47a
commit b227e1609c
22 changed files with 9 additions and 17 deletions

View File

@@ -43,6 +43,7 @@ STYLECHECK := /checkpatch.pl
STYLECHECKFLAGS := --no-tree -f --terse --mailback
STYLECHECKFILES := $(shell find . -name '*.[ch]')
OPT := -Os
CSTD ?= -std=c99
###############################################################################
@@ -96,7 +97,7 @@ SCRIPT_DIR = $(OPENCM3_DIR)/scripts
###############################################################################
# C flags
TGT_CFLAGS += $(OPT) -g
TGT_CFLAGS += $(OPT) $(CSTD) -g
TGT_CFLAGS += $(ARCH_FLAGS)
TGT_CFLAGS += -Wextra -Wshadow -Wimplicit-function-declaration
TGT_CFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes
@@ -105,7 +106,7 @@ TGT_CFLAGS += -fno-common -ffunction-sections -fdata-sections
###############################################################################
# C++ flags
TGT_CXXFLAGS += $(OPT) -g
TGT_CXXFLAGS += $(OPT) $(CXXSTD) -g
TGT_CXXFLAGS += $(ARCH_FLAGS)
TGT_CXXFLAGS += -Wextra -Wshadow -Wredundant-decls -Weffc++
TGT_CXXFLAGS += -fno-common -ffunction-sections -fdata-sections