Browse Source

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
b8924c1aed
1 changed files with 11 additions and 7 deletions
  1. 11
    7
      src/Makefile.housekeeping

+ 11
- 7
src/Makefile.housekeeping View File

@@ -109,6 +109,10 @@ VERYCLEANUP	+= .toolcheck
109 109
 # Check for various tool workarounds
110 110
 #
111 111
 
112
+WORKAROUND_CFLAGS :=
113
+WORKAROUND_ASFLAGS :=
114
+WORKAROUND_LDFLAGS :=
115
+
112 116
 # Make syntax does not allow use of comma or space in certain places.
113 117
 # This ugly workaround is suggested in the manual.
114 118
 #
@@ -119,7 +123,7 @@ SPACE	:= $(EMPTY) $(EMPTY)
119 123
 # Check for an old version of gas (binutils 2.9.1)
120 124
 #
121 125
 OLDGAS	:= $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291)
122
-CFLAGS	+= $(OLDGAS)
126
+WORKAROUND_CFLAGS += $(OLDGAS)
123 127
 oldgas :
124 128
 	@$(ECHO) $(oldgas)
125 129
 
@@ -131,7 +135,7 @@ ifeq ($(CCTYPE),gcc)
131 135
 SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \
132 136
 		-o /dev/null >/dev/null 2>&1
133 137
 SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
134
-CFLAGS	+= $(SP_FLAGS)
138
+WORKAROUND_CFLAGS += $(SP_FLAGS)
135 139
 endif
136 140
 
137 141
 # gcc 4.4 generates .eh_frame sections by default, which distort the
@@ -141,7 +145,7 @@ ifeq ($(CCTYPE),gcc)
141 145
 CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \
142 146
 		 -o /dev/null >/dev/null 2>&1
143 147
 CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm')
144
-CFLAGS	+= $(CFI_FLAGS)
148
+WORKAROUND_CFLAGS += $(CFI_FLAGS)
145 149
 endif
146 150
 
147 151
 # Some versions of gas choke on division operators, treating them as
@@ -150,7 +154,7 @@ endif
150 154
 #
151 155
 DIVIDE_TEST = $(AS) --divide /dev/null -o /dev/null 2>/dev/null
152 156
 DIVIDE_FLAGS := $(shell $(DIVIDE_TEST) && $(ECHO) '--divide')
153
-ASFLAGS	+= $(DIVIDE_FLAGS)
157
+WORKAROUND_ASFLAGS += $(DIVIDE_FLAGS)
154 158
 
155 159
 ###############################################################################
156 160
 #
@@ -375,9 +379,9 @@ CFLAGS		+= -diag-disable 1419 # Missing prototypes
375 379
 CFLAGS		+= -diag-disable 1599 # Hidden variables
376 380
 CFLAGS		+= -Wall -Wmissing-declarations
377 381
 endif
378
-CFLAGS		+= $(EXTRA_CFLAGS)
379
-ASFLAGS		+= $(EXTRA_ASFLAGS)
380
-LDFLAGS		+= $(EXTRA_LDFLAGS)
382
+CFLAGS		+= $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
383
+ASFLAGS		+= $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
384
+LDFLAGS		+= $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
381 385
 
382 386
 # Inhibit -Werror if NO_WERROR is specified on make command line
383 387
 #

Loading…
Cancel
Save