(This will be used by my next patch which will fix clang warning/error
for -fno-merge-constants -mpreferred-stack-boundary=2)
Suppress stderr output and add -Werror.
clang emits [-Wignored-optimization-argument] for certain ignored GCC options.
Signed-off-by: Fangrui Song <maskray(a)google.com>
---
Makefile | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/Makefile b/Makefile
index e52b395..7720db9 100644
--- a/Makefile
+++ b/Makefile
@@ -49,8 +49,8 @@ SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c hw/serialio.c
DIRS=src src/hw src/fw vgasrc
# Default compiler flags
-cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
- ; then echo "$(2)"; else echo "$(3)"; fi ;)
+cc-option=$(shell if $(CC) -Werror $(1) -c -xc /dev/null -o /dev/null >/dev/null 2>&1; \
+ then echo "$(1)"; else echo "$(2)"; fi)
EXTRAVERSION=
@@ -58,27 +58,27 @@ CPPFLAGS = -P -MD -MT $@
COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \
-Wall -Wno-strict-aliasing -Wold-style-definition \
- $(call cc-option,$(CC),-Wtype-limits,) \
+ $(call cc-option,-Wtype-limits) \
-m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
-minline-all-stringops -fomit-frame-pointer \
-freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \
-ffunction-sections -fdata-sections -fno-common -fno-merge-constants
-COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
-COMMONCFLAGS += $(call cc-option,$(CC),-fno-pie,)
-COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
-COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
-COMMONCFLAGS += $(call cc-option,$(CC),-fstack-check=no,)
-COMMONCFLAGS += $(call cc-option,$(CC),-Wno-address-of-packed-member,)
+COMMONCFLAGS += $(call cc-option,-nopie)
+COMMONCFLAGS += $(call cc-option,-fno-pie)
+COMMONCFLAGS += $(call cc-option,-fno-stack-protector)
+COMMONCFLAGS += $(call cc-option,-fno-stack-protector-all)
+COMMONCFLAGS += $(call cc-option,-fstack-check=no)
+COMMONCFLAGS += $(call cc-option,-Wno-address-of-packed-member)
COMMA := ,
CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0
CFLAGSSEG := $(COMMONCFLAGS) -DMODESEGMENT=1 -fno-defer-pop \
- $(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
- $(call cc-option,$(CC),-fno-tree-switch-conversion,)
+ $(call cc-option,-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
+ $(call cc-option,-fno-tree-switch-conversion)
CFLAGS32SEG := $(CFLAGSSEG) -DMODE16=0
CFLAGS16 := $(CFLAGSSEG) -DMODE16=1 \
- $(call cc-option,$(CC),-m16,-Wa$(COMMA)src/code16gcc.s) \
- $(call cc-option,$(CC),--param large-stack-frame=4,-fno-inline)
+ $(call cc-option,-m16,-Wa$(COMMA)src/code16gcc.s) \
+ $(call cc-option,--param large-stack-frame=4,-fno-inline)
# Run with "make V=1" to see the actual compile commands
ifdef V
--
2.25.1