[Skiboot] [PATCH 13/15] Makefile: Add -Werror to try-cflag so it works on clang

Oliver O'Halloran oohall at gmail.com
Fri Jun 12 12:24:50 AEST 2020


Clangs prints warnings when it sees unknown command line options. Adding
-Werror to the command line to upgrade them to errors results in clang
exiting with exit code 1 which is what try-cflag expects.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 Makefile.main | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.main b/Makefile.main
index bf0fcfaebf76..ec69b2d2c882 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -20,8 +20,8 @@ try = $(shell set -e; if ($(1)) >/dev/null 2>&1; \
 	then echo "$(2)"; \
 	else echo "$(3)"; fi )
 
-try-cflag = $(call try,$(1) $(2) -x c -c /dev/null -o /dev/null,$(2))
-test_cflag = $(call try,$(1) $(2) -x c -c /dev/null -o /dev/null,1,0)
+try-cflag = $(call try,$(1) -Werror $(2) -x c -c /dev/null -o /dev/null,$(2))
+test_cflag = $(call try,$(1) -Werror $(2) -x c -c /dev/null -o /dev/null,1,0)
 
 cc-name := $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
 
-- 
2.26.2



More information about the Skiboot mailing list