diff options
author | Michael Brown | 2005-04-18 14:43:18 +0200 |
---|---|---|
committer | Michael Brown | 2005-04-18 14:43:18 +0200 |
commit | cf79681b80f2fe4c1d70f02f3ee1bf07a902698f (patch) | |
tree | 9b9016729db119e4261490f175715de405bb24a3 /src/Makefile.housekeeping | |
parent | Move RELOCATE into config.h (diff) | |
download | ipxe-cf79681b80f2fe4c1d70f02f3ee1bf07a902698f.tar.gz ipxe-cf79681b80f2fe4c1d70f02f3ee1bf07a902698f.tar.xz ipxe-cf79681b80f2fe4c1d70f02f3ee1bf07a902698f.zip |
Fix BUILD_SERIAL.
Change from using #if to #ifdef, since #if can't cope with string
constants.
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r-- | src/Makefile.housekeeping | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index 1dfc34d1..dd4bd084 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -359,26 +359,24 @@ CLEANUP += $(NRV2B) # build targets to get a serial number printed at the end of the # build. Enable -DBUILD_SERIAL in order to see it when the code runs. # -BUILDSERIAL_H = include/.buildserial.h +BUILDSERIAL_H = config/.buildserial.h +BUILDSERIAL_NOW = config/.buildserial.now +BUILDSERIAL_NEXT = config/.buildserial.next -$(BUILDSERIAL_H) : - @if [ ! -s $@ ]; then echo '#define BUILD_SERIAL_NUM 0' > $@; fi - @perl -pi -e 's/(BUILD_SERIAL_NUM)\s+(\d+)/"$${1} ".($${2}+1)/e' $@ +$(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) : + echo 1 > $@ -bs : $(BUILDSERIAL_H) - @perl -n -e '/BUILD_SERIAL_NUM\s+(\d+)/ && ' \ - -e 'print "Build serial number is $$1\n";' $< +$(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) + echo '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@ ifeq ($(filter bs,$(MAKECMDGOALS)),bs) -.PHONY : $(BUILDSERIAL_H) +$(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \ + cp -f $(BUILDSERIAL_NEXT) $(BUILDSERIAL_NOW)) endif -# Ensure that include/.buildserial.h always exists, to solve the -# problem of bootstrapping a BUILD_SERIAL-enabled build. -# -ifeq ($(wildcard $(BUILDSERIAL_H)),) -$(shell $(TOUCH) $(BUILDSERIAL_H)) -endif +bs : $(BUILDSERIAL_NOW) + @echo $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT) + @echo "Build serial number is $(shell cat $<)" # List of available architectures # |