aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2007-09-08 23:38:17 +0100
committerMichael Brown <mcb30@etherboot.org>2007-09-08 23:38:17 +0100
commit6f799db5bd64ad408d7903679ac4d40ef9f48958 (patch)
treea926b532ff047767764f9bc398c6abbaf1b95a4e
parent972f293e46d936ade9613abfeb0953936f7389a5 (diff)
downloadipxe-6f799db5bd64ad408d7903679ac4d40ef9f48958.zip
ipxe-6f799db5bd64ad408d7903679ac4d40ef9f48958.tar.gz
ipxe-6f799db5bd64ad408d7903679ac4d40ef9f48958.tar.bz2
Use "/bin/echo -e" instead of shell builtin echo; some shells don't
implement the -e option. (Thanks to Jim McQuillan for this suggestion.)
-rw-r--r--src/Makefile45
-rw-r--r--src/Makefile.housekeeping138
2 files changed, 88 insertions, 95 deletions
diff --git a/src/Makefile b/src/Makefile
index 0f8ddca..0682dc5 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -42,30 +42,31 @@ include arch/$(ARCH)/Config
# message.
#
noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb
- @echo '==========================================================='
- @echo
- @echo 'To create a bootable floppy, type'
- @echo ' cat $(BIN)/gpxe.dsk > /dev/fd0'
- @echo 'where /dev/fd0 is your floppy drive. This will erase any'
- @echo 'data already on the disk.'
- @echo
- @echo 'To create a bootable USB key, type'
- @echo ' cat $(BIN)/gpxe.usb > /dev/sdX'
- @echo 'where /dev/sdX is your USB key, and is *not* a real hard'
- @echo 'disk on your system. This will erase any data already on'
- @echo 'the USB key.'
- @echo
- @echo 'To create a bootable CD-ROM, burn the ISO image '
- @echo '$(BIN)/gpxe.iso to a blank CD-ROM.'
- @echo
- @echo 'These images contain drivers for all supported cards. You'
- @echo 'can build more customised images, and ROM images, using'
- @echo ' make bin/<rom-name>.<output-format>'
- @echo
- @echo '==========================================================='
+ @$(ECHO) '==========================================================='
+ @$(ECHO)
+ @$(ECHO) 'To create a bootable floppy, type'
+ @$(ECHO) ' cat $(BIN)/gpxe.dsk > /dev/fd0'
+ @$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
+ @$(ECHO) 'data already on the disk.'
+ @$(ECHO)
+ @$(ECHO) 'To create a bootable USB key, type'
+ @$(ECHO) ' cat $(BIN)/gpxe.usb > /dev/sdX'
+ @$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
+ @$(ECHO) 'disk on your system. This will erase any data already on'
+ @$(ECHO) 'the USB key.'
+ @$(ECHO)
+ @$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
+ @$(ECHO) '$(BIN)/gpxe.iso to a blank CD-ROM.'
+ @$(ECHO)
+ @$(ECHO) 'These images contain drivers for all supported cards. You'
+ @$(ECHO) 'can build more customised images, and ROM images, using'
+ @$(ECHO) ' make bin/<rom-name>.<output-format>'
+ @$(ECHO)
+ @$(ECHO) '==========================================================='
# Locations of utilities
#
+ECHO ?= /bin/echo -e
HOST_CC ?= gcc
CPP ?= gcc -E -Wp,-Wall
RM ?= rm -f
@@ -120,7 +121,7 @@ OBJECT = $(firstword $(subst ., ,$(@F)))
#
OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
$(BIN)/%.flags :
- @echo $(OBJ_CFLAGS)
+ @$(ECHO) $(OBJ_CFLAGS)
# Rules for specific object types.
#
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 2fb41a8..5384229 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -20,33 +20,25 @@ CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION=\"$(VERSION)\"
IDENT = '$(@F) $(VERSION) (GPL) etherboot.org'
version :
- @echo $(VERSION)
+ @$(ECHO) $(VERSION)
# Check for tools that can cause failed builds
#
.toolcheck : Makefile Config
@if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
- echo 'gcc 2.96 is unsuitable for compiling Etherboot'; \
- echo 'Use gcc 2.95 or gcc 3.x instead'; \
+ $(ECHO) 'gcc 2.96 is unsuitable for compiling Etherboot'; \
+ $(ECHO) 'Use gcc 2.95 or gcc 3.x instead'; \
exit 1; \
fi
@if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
- echo 'Your Perl version has a Unicode handling bug'; \
- echo 'Execute this command before compiling Etherboot:'; \
- echo 'export LANG=$${LANG%.UTF-8}'; \
+ $(ECHO) 'Your Perl version has a Unicode handling bug'; \
+ $(ECHO) 'Execute this command before compiling Etherboot:'; \
+ $(ECHO) 'export LANG=$${LANG%.UTF-8}'; \
exit 1; \
fi
@$(TOUCH) $@
VERYCLEANUP += .toolcheck
-# Check for correct syntax for echo -e
-#
-ifeq ($(shell echo '\0101'),A)
-ECHO_E = echo
-else
-ECHO_E = echo -e
-endif
-
# Build verbosity
#
ifeq ($(V),1)
@@ -59,10 +51,10 @@ endif
# 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)
oldgas :
- @echo $(oldgas)
+ @$(ECHO) $(oldgas)
# compiler.h is needed for our linking and debugging system
#
@@ -75,14 +67,14 @@ CLEANUP += config/*.h
# SRCDIRS lists all directories containing source files.
srcdirs :
- @echo $(SRCDIRS)
+ @$(ECHO) $(SRCDIRS)
# SRCS lists all .c or .S files found in any SRCDIR
#
SRCS += $(wildcard $(patsubst %,%/*.c,$(SRCDIRS)))
SRCS += $(wildcard $(patsubst %,%/*.S,$(SRCDIRS)))
srcs :
- @echo $(SRCS)
+ @$(ECHO) $(SRCS)
# AUTO_SRCS lists all files in SRCS that are not mentioned in
# NON_AUTO_SRCS. Files should be added to NON_AUTO_SRCS if they
@@ -90,7 +82,7 @@ srcs :
#
AUTO_SRCS = $(filter-out $(NON_AUTO_SRCS),$(SRCS))
autosrcs :
- @echo $(AUTO_SRCS)
+ @$(ECHO) $(AUTO_SRCS)
# We automatically generate rules for any file mentioned in AUTO_SRCS
# using the following set of templates. It would be cleaner to use
@@ -105,7 +97,7 @@ autosrcs :
#
define src_template
- @echo "Generating Makefile rules for $(1)"
+ @$(ECHO) "Generating Makefile rules for $(1)"
@$(MKDIR) -p $(dir $(2))
@$(RM) $(2)
@$(TOUCH) $(2)
@@ -129,14 +121,14 @@ define obj_template
@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
-Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
- @$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
- '\n\t$$(QM)echo " [BUILD] $$@"\n' \
+ @$(ECHO) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
+ '\n\t$$(QM)$(ECHO) " [BUILD] $$@"\n' \
'\n\t$$(RULE_$(3))\n' \
'\nBOBJS += $$(BIN)/$(4).o\n' \
$(foreach TGT,$(DEBUG_TARGETS), \
$(if $(RULE_$(3)_to_$(TGT)), \
'\n$$(BIN)/$(4).$(TGT) : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
- '\n\t$$(QM)echo " [BUILD] $$@"\n' \
+ '\n\t$$(QM)$(ECHO) " [BUILD] $$@"\n' \
'\n\t$$(RULE_$(3)_to_$(TGT))\n' \
'\n$(TGT)_OBJS += $$(BIN)/$(4).$(TGT)\n' ) ) \
'\n$(2) : $$($(4)_DEPS)\n' \
@@ -148,34 +140,34 @@ endef
# Rule to generate the Makefile rules files to be included
#
$(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
- $(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@echo 'ERROR: $< is not an AUTO_SRC' ; exit 1)
+ $(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@$(ECHO) 'ERROR: $< is not an AUTO_SRC' ; exit 1)
# Calculate and include the list of Makefile rules files
#
AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS))
include $(AUTO_DEPS)
autodeps :
- @echo $(AUTO_DEPS)
+ @$(ECHO) $(AUTO_DEPS)
VERYCLEANUP += $(BIN)/deps
# The following variables are created by the Makefile rules files
#
bobjs :
- @echo $(BOBJS)
+ @$(ECHO) $(BOBJS)
drivers :
- @echo $(DRIVERS)
+ @$(ECHO) $(DRIVERS)
.PHONY : drivers
roms :
- @echo $(ROMS)
+ @$(ECHO) $(ROMS)
# Generate the NIC file from the parsed source files. The NIC file is
# only for rom-o-matic.
#
$(BIN)/NIC : $(AUTO_DEPS)
- @echo '# This is an automatically generated file, do not edit' > $@
- @echo '# It does not affect anything in the build, ' \
+ @$(ECHO) '# This is an automatically generated file, do not edit' > $@
+ @$(ECHO) '# It does not affect anything in the build, ' \
'it is only for rom-o-matic' >> $@
- @echo >> $@
+ @$(ECHO) >> $@
@perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@
CLEANUP += $(BIN)/NIC
@@ -258,25 +250,25 @@ BLIB_OBJS = $(DEBUG_OBJS) $(filter-out $(DEBUG_ORIG_OBJS),$(BOBJS))
# Print out all derived information for a given target.
#
$(BIN)/%.info :
- @echo 'Elements : $(TGT_ELEMENTS)'
- @echo 'Prefix : $(TGT_PREFIX)'
- @echo 'Drivers : $(TGT_DRIVERS)'
- @echo 'ROM name : $(TGT_ROM_NAME)'
- @echo 'Media : $(TGT_MEDIA)'
- @echo
- @echo 'PCI vendor : $(TGT_PCI_VENDOR)'
- @echo 'PCI device : $(TGT_PCI_DEVICE)'
- @echo
- @echo 'LD driver symbols : $(TGT_LD_DRIVERS)'
- @echo 'LD prefix symbols : $(TGT_LD_PREFIX)'
- @echo 'LD ID symbols : $(TGT_LD_IDS)'
- @echo
- @echo 'LD target flags : $(TGT_LD_FLAGS)'
- @echo
- @echo 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
- @echo
- @echo 'Debugging objects : $(DEBUG_OBJS)'
- @echo 'Replaced objects : $(DEBUG_ORIG_OBJS)'
+ @$(ECHO) 'Elements : $(TGT_ELEMENTS)'
+ @$(ECHO) 'Prefix : $(TGT_PREFIX)'
+ @$(ECHO) 'Drivers : $(TGT_DRIVERS)'
+ @$(ECHO) 'ROM name : $(TGT_ROM_NAME)'
+ @$(ECHO) 'Media : $(TGT_MEDIA)'
+ @$(ECHO)
+ @$(ECHO) 'PCI vendor : $(TGT_PCI_VENDOR)'
+ @$(ECHO) 'PCI device : $(TGT_PCI_DEVICE)'
+ @$(ECHO)
+ @$(ECHO) 'LD driver symbols : $(TGT_LD_DRIVERS)'
+ @$(ECHO) 'LD prefix symbols : $(TGT_LD_PREFIX)'
+ @$(ECHO) 'LD ID symbols : $(TGT_LD_IDS)'
+ @$(ECHO)
+ @$(ECHO) 'LD target flags : $(TGT_LD_FLAGS)'
+ @$(ECHO)
+ @$(ECHO) 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
+ @$(ECHO)
+ @$(ECHO) 'Debugging objects : $(DEBUG_OBJS)'
+ @$(ECHO) 'Replaced objects : $(DEBUG_ORIG_OBJS)'
# List of objects included in the last build of blib. This is needed
# in order to correctly rebuild blib whenever the list of objects
@@ -284,7 +276,7 @@ $(BIN)/%.info :
#
BLIB_LIST = $(BIN)/.blib.list
ifneq ($(shell cat $(BLIB_LIST)),$(BLIB_OBJS))
-$(shell echo "$(BLIB_OBJS)" > $(BLIB_LIST))
+$(shell $(ECHO) "$(BLIB_OBJS)" > $(BLIB_LIST))
endif
$(BLIB_LIST) :
@@ -296,7 +288,7 @@ VERYCLEANUP += $(BLIB_LIST)
BLIB = $(BIN)/blib.a
$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
$(Q)$(RM) $(BLIB)
- $(QM)echo " [AR] $@"
+ $(QM)$(ECHO) " [AR] $@"
$(Q)$(AR) r $@ $(BLIB_OBJS)
$(Q)$(RANLIB) $@
blib : $(BLIB)
@@ -305,7 +297,7 @@ blib : $(BLIB)
# specified target.
#
$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
- $(QM)echo " [LD] $@"
+ $(QM)$(ECHO) " [LD] $@"
$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
-Map $(BIN)/$*.tmp.map
$(Q)$(OBJDUMP) -ht $@ | $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
@@ -318,19 +310,19 @@ $(BIN)/%.map : $(BIN)/%.tmp
# Extract compression information from intermediate object file
#
$(BIN)/%.zinfo : $(BIN)/%.tmp
- $(QM)echo " [ZINFO] $@"
+ $(QM)$(ECHO) " [ZINFO] $@"
$(Q)$(OBJCOPY) -O binary -j .zinfo $< $@
# Build raw binary file from intermediate object file
#
$(BIN)/%.bin : $(BIN)/%.tmp
- $(QM)echo " [BIN] $@"
+ $(QM)$(ECHO) " [BIN] $@"
$(Q)$(OBJCOPY) -O binary -R .zinfo $< $@
# Compress raw binary file
#
$(BIN)/%.zbin : $(BIN)/%.bin $(BIN)/%.zinfo $(ZBIN)
- $(QM)echo " [ZBIN] $@"
+ $(QM)$(ECHO) " [ZBIN] $@"
$(Q)$(ZBIN) $(BIN)/$*.bin $(BIN)/$*.zinfo > $@
# Build bochs symbol table
@@ -359,11 +351,11 @@ $(BIN)/%.bxs : $(BIN)/%.tmp
# much difference to the overall build time.
media :
- @echo $(MEDIA)
+ @$(ECHO) $(MEDIA)
AUTO_MEDIA = $(filter-out $(NON_AUTO_MEDIA),$(MEDIA))
automedia :
- @echo $(AUTO_MEDIA)
+ @$(ECHO) $(AUTO_MEDIA)
# media_template : create Makefile rules for specified media
#
@@ -372,12 +364,12 @@ automedia :
#
define media_template
- @echo "Generating Makefile rules for $(1) media"
+ @$(ECHO) "Generating Makefile rules for $(1) media"
@$(MKDIR) -p $(dir $(2))
@$(RM) $(2)
@$(TOUCH) $(2)
- @$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
- '\n\t$$(QM)echo " [FINISH] $$@"' \
+ @$(ECHO) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
+ '\n\t$$(QM)$(ECHO) " [FINISH] $$@"' \
'\n\t$$(Q)$$(CP) $$< $$@' \
'\n\t$$(Q)$$(FINALISE_$(1))' \
> $(2)
@@ -389,13 +381,13 @@ endef
$(BIN)/deps/%.media.d : $(MAKEDEPS)
$(if $(filter $(AUTO_MEDIA),$*), \
$(call media_template,$*,$@), \
- @echo 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
+ @$(ECHO) 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
# Calculate and include the list of Makefile rules files
#
MEDIA_DEPS = $(patsubst %,$(BIN)/deps/%.media.d,$(AUTO_MEDIA))
mediadeps :
- @echo $(MEDIA_DEPS)
+ @$(ECHO) $(MEDIA_DEPS)
include $(MEDIA_DEPS)
# The "allXXXs" targets for each suffix
@@ -412,13 +404,13 @@ $(BIN)/etherboot.% : $(BIN)/gpxe.%
# The compression utilities
#
$(NRV2B) : util/nrv2b.c $(MAKEDEPS)
- $(QM)echo " [HOSTCC] $@"
+ $(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG \
-DBITSIZE=32 -DENDIAN=0 -o $@ $<
CLEANUP += $(NRV2B)
$(ZBIN) : util/zbin.c util/nrv2b.c $(MAKEDEPS)
- $(QM)echo " [HOSTCC] $@"
+ $(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) -O2 -o $@ $<
CLEANUP += $(ZBIN)
@@ -431,10 +423,10 @@ BUILDSERIAL_NOW = config/.buildserial.now
BUILDSERIAL_NEXT = config/.buildserial.next
$(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) :
- echo 1 > $@
+ $(ECHO) 1 > $@
$(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT)
- echo '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
+ $(ECHO) '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
ifeq ($(filter bs,$(MAKECMDGOALS)),bs)
$(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
@@ -442,18 +434,18 @@ $(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
endif
bs : $(BUILDSERIAL_NOW)
- @echo $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
- @echo "Build serial number is $(shell cat $<)"
+ @$(ECHO) $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
+ @$(ECHO) "Build serial number is $(shell cat $<)"
# List of available architectures
#
ARCHS = $(filter-out CVS,$(patsubst arch/%,%,$(wildcard arch/*)))
archs :
- @echo $(ARCHS)
+ @$(ECHO) $(ARCHS)
OTHER_ARCHS = $(filter-out $(ARCH),$(ARCHS))
otherarchs :
- @echo $(OTHER_ARCHS)
+ @$(ECHO) $(OTHER_ARCHS)
# Build the TAGS file for emacs
#
@@ -503,7 +495,7 @@ docview :
@if [ -n "$$BROWSER" ] ; then \
( $$BROWSER $(BIN)/doc/html/index.html & ) ; \
else \
- echo "Documentation index in $(BIN)/doc/html/index.html" ; \
+ $(ECHO) "Documentation index in $(BIN)/doc/html/index.html" ; \
fi
# Clean-up
@@ -517,7 +509,7 @@ veryclean : clean
# Make clean tarballs for release
gpxe-tarball : ../VERSION
- (echo -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
+ ($(ECHO) -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
$(RM) -r /tmp/gpxe/gpxe-$(VERSION)
mkdir -p /tmp/gpxe/gpxe-$(VERSION)
cp -rP .. /tmp/gpxe/gpxe-$(VERSION)