[Skiboot] [PATCH] Allow CFLAGS to be overidden.
Alastair D'Silva
alastair at d-silva.org
Wed Apr 27 16:52:03 AEST 2016
When building in CI, we want to see all potential problems noted by
compilers & static analysers that masquerade as a compiler, rather than
halting on the first one.
This is especially important as we tend to implement
different/stricter/expensive checks compared to a typical compiler, and
as such, these may not be visible when performing a normal build.
This patch allows additional warning/compile flags to be injected after
the hardcoded ones to allow -Wno-error to be injected, via
SKIBOOT_CFLAGS_EXTRA and SKIBOOT_CWARNS_EXTRA.
Signed-off-by: Alastair D'Silva <alastair at d-silva.org>
---
Makefile.main | 4 ++++
external/gard/rules.mk | 1 +
external/memboot/Makefile | 2 +-
external/opal-prd/Makefile | 1 +
external/pflash/rules.mk | 3 ++-
external/shared/Makefile | 2 +-
external/trace/Makefile | 2 +-
external/xscom-utils/Makefile | 2 +-
8 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/Makefile.main b/Makefile.main
index 30c22be..e4f936c 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -30,6 +30,8 @@ CWARNS := -Wall -Wundef -Wstrict-prototypes -Wno-
trigraphs \
-Wframe-larger-than=1024 \
-Werror
+CWARNS += $(SKIBOOT_CWARNS_EXTRA)
+
# Host tools and options
HOSTCC=gcc
HOSTEND=$(shell uname -m | sed -e 's/^i.*86$$/LITTLE/' -e
's/^x86.*/LITTLE/' -e 's/^ppc64le/LITTLE/' -e 's/^ppc.*/BIG/')
@@ -108,6 +110,8 @@ CFLAGS += $(call try-cflag,$(CC),-mno-vsx) \
$(call try-cflag,$(CC),-mno-direct-move) \
$(call try-cflag,$(CC),-mno-altivec)
+CFLAGS += $(SKIBOOT_CFLAGS_EXTRA)
+
# Do not use load/store update. You REALLY do not want to use this!
# The async safety of the ABI stack depends on the atomicity
# of update on store.
diff --git a/external/gard/rules.mk b/external/gard/rules.mk
index 0dd14ed..78ce606 100644
--- a/external/gard/rules.mk
+++ b/external/gard/rules.mk
@@ -1,6 +1,7 @@
.DEFAULT_GOAL := all
override CFLAGS += -O2 -Wall -Werror -I.
+override CFLAGS += $(SKIBOOT_CWARNS_EXTRA) $(SKIBOOT_CFLAGS_EXTRA)
OBJS = version.o gard.o
LIBFLASH_OBJS += libflash-file.o libflash-libflash.o libflash-
libffs.o libflash-ecc.o libflash-blocklevel.o
OBJS += $(LIBFLASH_OBJS)
diff --git a/external/memboot/Makefile b/external/memboot/Makefile
index 9b526a3..67e6ba6 100644
--- a/external/memboot/Makefile
+++ b/external/memboot/Makefile
@@ -1,6 +1,6 @@
all: memboot
-CFLAGS=-O2 -Wall
+CFLAGS=-O2 -Wall ${SKIBOOT_CWARNS_EXTRA} ${SKIBOOT_CFLAGS_EXTRA}
memboot: memboot.c
$(CC) $(CFLAGS) -o $@ $^
diff --git a/external/opal-prd/Makefile b/external/opal-prd/Makefile
index 7482af3..9481655 100644
--- a/external/opal-prd/Makefile
+++ b/external/opal-prd/Makefile
@@ -1,4 +1,5 @@
CFLAGS += -m64 -Werror -Wall -g2 -ggdb
+CFLAGS += ${SKIBOOT_CWARNS_EXTRA} ${SKIBOOT_CFLAGS_EXTRA}
LDFLAGS += -m64
ASFLAGS = -m64
CPPFLAGS += -I. -I../../include -I../../
diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk
index aa426b5..cf1b7f3 100644
--- a/external/pflash/rules.mk
+++ b/external/pflash/rules.mk
@@ -1,6 +1,7 @@
.DEFAULT_GOAL := all
-override CFLAGS += -O2 -Wall -I.
+override CFLAGS += -O2 -Wall -I. \
+ ${SKIBOOT_CWARNS_EXTRA} ${SKIBOOT_CFLAGS_EXTRA}
OBJS = pflash.o progress.o version.o
LIBFLASH_FILES := libflash.c libffs.c ecc.c blocklevel.c file.c
LIBFLASH_OBJS := $(addprefix libflash-, $(LIBFLASH_FILES:.c=.o))
diff --git a/external/shared/Makefile b/external/shared/Makefile
index 4c31657..c337b1f 100644
--- a/external/shared/Makefile
+++ b/external/shared/Makefile
@@ -8,7 +8,7 @@ INCDIR = $(PREFIX)/include/libflash
VERSION = $(shell ../../make_version.sh)
-CFLAGS += -m64 -Werror -Wall -g2 -ggdb -I. -fPIC
+CFLAGS += -m64 -Werror -Wall -g2 -ggdb -I. -fPIC
${SKIBOOT_CWARNS_EXTRA} ${SKIBOOT_CFLAGS_EXTRA}
.PHONY: links
links: libflash ccan common
diff --git a/external/trace/Makefile b/external/trace/Makefile
index b397380..1b5c321 100644
--- a/external/trace/Makefile
+++ b/external/trace/Makefile
@@ -1,5 +1,5 @@
HOSTEND=$(shell uname -m | sed -e 's/^i.*86$$/LITTLE/' -e
's/^x86.*/LITTLE/' -e 's/^ppc.*/BIG/')
-CFLAGS=-g -Wall -DHAVE_$(HOSTEND)_ENDIAN -I../../include
+CFLAGS=-g -Wall -DHAVE_$(HOSTEND)_ENDIAN -I../../include
${SKIBOOT_CWARNS_EXTRA} ${SKIBOOT_CFLAGS_EXTRA}
dump_trace: dump_trace.c
diff --git a/external/xscom-utils/Makefile b/external/xscom-
utils/Makefile
index 3fee247..b50cbac 100644
--- a/external/xscom-utils/Makefile
+++ b/external/xscom-utils/Makefile
@@ -1,7 +1,7 @@
CC = $(CROSS_COMPILE)gcc
XSCOM_VERSION ?= $(shell ../../make_version.sh xscom-utils)
-CFLAGS += -O2 -g -Wall -m64
+CFLAGS += -O2 -g -Wall -m64 ${SKIBOOT_CWARNS_EXTRA}
${SKIBOOT_CFLAGS_EXTRA}
prefix = /usr/local/
sbindir = $(prefix)/sbin
--
2.5.5
--
Alastair D'Silva
Open Source Developer
Linux Technology Centre, IBM Australia
mob: 0423 762 819
More information about the Skiboot
mailing list