david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[build] Allow workaround-specific flags to override default flags

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2011-03-16 19:30:42 +00:00
parent d0eb4e529d
commit b8924c1aed
1 changed files with 11 additions and 7 deletions

View File

@ -109,6 +109,10 @@ VERYCLEANUP += .toolcheck
# Check for various tool workarounds # Check for various tool workarounds
# #
WORKAROUND_CFLAGS :=
WORKAROUND_ASFLAGS :=
WORKAROUND_LDFLAGS :=
# Make syntax does not allow use of comma or space in certain places. # Make syntax does not allow use of comma or space in certain places.
# This ugly workaround is suggested in the manual. # This ugly workaround is suggested in the manual.
# #
@ -119,7 +123,7 @@ SPACE := $(EMPTY) $(EMPTY)
# Check for an old version of gas (binutils 2.9.1) # Check for an old version of gas (binutils 2.9.1)
# #
OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291) OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291)
CFLAGS += $(OLDGAS) WORKAROUND_CFLAGS += $(OLDGAS)
oldgas : oldgas :
@$(ECHO) $(oldgas) @$(ECHO) $(oldgas)
@ -131,7 +135,7 @@ ifeq ($(CCTYPE),gcc)
SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \ SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \
-o /dev/null >/dev/null 2>&1 -o /dev/null >/dev/null 2>&1
SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector') SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
CFLAGS += $(SP_FLAGS) WORKAROUND_CFLAGS += $(SP_FLAGS)
endif endif
# gcc 4.4 generates .eh_frame sections by default, which distort the # gcc 4.4 generates .eh_frame sections by default, which distort the
@ -141,7 +145,7 @@ ifeq ($(CCTYPE),gcc)
CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \ CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \
-o /dev/null >/dev/null 2>&1 -o /dev/null >/dev/null 2>&1
CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm') CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm')
CFLAGS += $(CFI_FLAGS) WORKAROUND_CFLAGS += $(CFI_FLAGS)
endif endif
# Some versions of gas choke on division operators, treating them as # Some versions of gas choke on division operators, treating them as
@ -150,7 +154,7 @@ endif
# #
DIVIDE_TEST = $(AS) --divide /dev/null -o /dev/null 2>/dev/null DIVIDE_TEST = $(AS) --divide /dev/null -o /dev/null 2>/dev/null
DIVIDE_FLAGS := $(shell $(DIVIDE_TEST) && $(ECHO) '--divide') DIVIDE_FLAGS := $(shell $(DIVIDE_TEST) && $(ECHO) '--divide')
ASFLAGS += $(DIVIDE_FLAGS) WORKAROUND_ASFLAGS += $(DIVIDE_FLAGS)
############################################################################### ###############################################################################
# #
@ -375,9 +379,9 @@ CFLAGS += -diag-disable 1419 # Missing prototypes
CFLAGS += -diag-disable 1599 # Hidden variables CFLAGS += -diag-disable 1599 # Hidden variables
CFLAGS += -Wall -Wmissing-declarations CFLAGS += -Wall -Wmissing-declarations
endif endif
CFLAGS += $(EXTRA_CFLAGS) CFLAGS += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
ASFLAGS += $(EXTRA_ASFLAGS) ASFLAGS += $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
LDFLAGS += $(EXTRA_LDFLAGS) LDFLAGS += $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
# Inhibit -Werror if NO_WERROR is specified on make command line # Inhibit -Werror if NO_WERROR is specified on make command line
# #