89
89
# Check for tools that can cause failed builds
92
@if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
93
$(ECHO) 'gcc 2.96 is unsuitable for compiling Etherboot'; \
94
$(ECHO) 'Use gcc 2.95 or gcc 3.x instead'; \
97
@if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
98
$(ECHO) 'Your Perl version has a Unicode handling bug'; \
99
$(ECHO) 'Execute this command before compiling Etherboot:'; \
100
$(ECHO) 'export LANG=$${LANG%.UTF-8}'; \
104
MAKEDEPS += .toolcheck
105
VERYCLEANUP += .toolcheck
93
GCC_2_96_BANNER := $(shell $(CC) -v 2>&1 | grep -is 'gcc version 2\.96')
94
ifneq ($(GCC_2_96_BANNER),)
95
$(warning gcc 2.96 is unsuitable for compiling iPXE)
96
$(warning Use gcc 2.95 or a newer version instead)
97
$(error Unsuitable build environment found)
101
PERL_UNICODE_CHECK := $(shell $(PERL) -e 'use bytes; print chr(255)' | wc -c)
102
ifeq ($(PERL_UNICODE_CHECK),2)
103
$(warning Your Perl version has a Unicode handling bug)
104
$(warning Execute this command before building iPXE:)
105
$(warning export LANG=$${LANG%.UTF-8})
106
$(error Unsuitable build environment found)
109
LD_GOLD_BANNER := $(shell $(LD) -v 2>&1 | grep 'GNU gold')
110
ifneq ($(LD_GOLD_BANNER),)
111
$(warning GNU gold is unsuitable for building iPXE)
112
$(warning Use GNU ld instead)
113
$(error Unsuitable build environment found)
107
116
###############################################################################
442
451
# Enable per-item sections and section garbage collection. Note that
443
452
# some older versions of gcc support -fdata-sections but treat it as
444
# implying -fno-common, which would break our build.
453
# implying -fno-common, which would break our build. Some other older
454
# versions issue a spurious and uninhibitable warning if
455
# -ffunction-sections is used with -g, which would also break our
456
# build since we use -Werror.
446
458
ifeq ($(CCTYPE),gcc)
447
459
DS_TEST = $(ECHO) 'char x;' | \
448
460
$(CC) -fdata-sections -S -x c - -o - 2>/dev/null | \
449
461
grep -E '\.comm' > /dev/null
450
462
DS_FLAGS := $(shell $(DS_TEST) && $(ECHO) '-fdata-sections')
451
CFLAGS += -ffunction-sections $(DS_FLAGS)
463
FS_TEST = $(CC) -ffunction-sections -g -c -x c /dev/null \
464
-o /dev/null 2>/dev/null
465
FS_FLAGS := $(shell $(FS_TEST) && $(ECHO) '-ffunction-sections')
466
CFLAGS += $(FS_FLAGS) $(DS_FLAGS)
453
468
LDFLAGS += --gc-sections
540
555
'\n$(TGT)_OBJS += $$(BIN)/$(3).$(TGT)\n' ) ) \
541
556
'\n$(BIN)/deps/$(1).d : $$($(3)_DEPS)\n' \
542
557
'\nTAGS : $$($(3)_DEPS)\n' > $(BIN)/rules/$(1).r
543
@$(PERL) $(PARSEROM) $(1) >> $(BIN)/rules/$(1).r
558
@$(if $(findstring drivers/,$(1)),\
559
$(PERL) $(PARSEROM) $(1) >> $(BIN)/rules/$(1).r)
546
562
# Rule to generate the dependency list file
591
607
# This is needed in order to correctly rebuild embedded.o whenever the
592
608
# list of objects changes.
610
EMBED := $(EMBEDDED_IMAGE) # Maintain backwards compatibility
594
611
EMBEDDED_LIST := $(BIN)/.embedded.list
595
612
ifeq ($(wildcard $(EMBEDDED_LIST)),)
596
EMBEDDED_IMAGE_OLD := <invalid>
613
EMBED_OLD := <invalid>
598
EMBEDDED_IMAGE_OLD := $(shell cat $(EMBEDDED_LIST))
615
EMBED_OLD := $(shell cat $(EMBEDDED_LIST))
600
ifneq ($(EMBEDDED_IMAGE_OLD),$(EMBEDDED_IMAGE))
601
$(shell $(ECHO) "$(EMBEDDED_IMAGE)" > $(EMBEDDED_LIST))
617
ifneq ($(EMBED_OLD),$(EMBED))
618
$(shell $(ECHO) "$(EMBED)" > $(EMBEDDED_LIST))
604
621
$(EMBEDDED_LIST) :
606
623
VERYCLEANUP += $(EMBEDDED_LIST)
608
EMBEDDED_FILES := $(subst $(COMMA), ,$(EMBEDDED_IMAGE))
625
EMBEDDED_FILES := $(subst $(COMMA), ,$(EMBED))
609
626
EMBED_ALL := $(foreach i,$(call seq,1,$(words $(EMBEDDED_FILES))),\
610
627
EMBED ( $(i), \"$(word $(i), $(EMBEDDED_FILES))\",\
611
628
\"$(notdir $(word $(i),$(EMBEDDED_FILES)))\" ))