diff --git a/external/common/rules.mk b/external/common/rules.mk index bb12fd5b286b..8c5749b57f89 100644 --- a/external/common/rules.mk +++ b/external/common/rules.mk @@ -49,7 +49,7 @@ ARCH_OBJS := $(addprefix common-,$(ARCH_FILES:.c=.o)) # Arch links are like this so we can have dependencies work (so that we don't # run the rule when the links exist), pretty build output (knowing the target # name) and a list of the files so we can clean them up. -ARCH_LINKS := common/ast-sf-ctrl.c common/ast.h common/io.h +ARCH_LINKS ?= common/ast-sf-ctrl.c common/ast.h common/io.h arch_links: $(ARCH_LINKS) common/ast.h : ../../include/ast.h | common diff --git a/external/gard/.gitignore b/external/gard/.gitignore index 7c81877cfaa5..7e8f83f2044a 100644 --- a/external/gard/.gitignore +++ b/external/gard/.gitignore @@ -8,3 +8,4 @@ gard test/test.sh libflash make_version.sh +gard-*.tar diff --git a/external/gard/Makefile b/external/gard/Makefile index b54923d20083..2ccd1440df6b 100644 --- a/external/gard/Makefile +++ b/external/gard/Makefile @@ -8,11 +8,10 @@ all: links arch_links $(EXE) #Rebuild version.o so that the the version always matches #what the test suite will get from ./make_version.sh check: version.o all + @ln -sf ../../make_version.sh make_version.sh @ln -sf ../../test/test.sh test/test.sh @test/test-gard -links += make_version.sh - .PHONY: VERSION-always .version: VERSION-always @echo $(GARD_VERSION) > $@.tmp @@ -20,20 +19,20 @@ links += make_version.sh @rm -f $@.tmp .PHONY: dist -#File is named $(PFLASH_VERSION).tar because the expectation is that pflash- +#File is named $(GARD_VERSION).tar because the expectation is that gard- #is always at the start of the verion. This remains consistent with skiboot #version strings -dist: links .version - find -L ../pflash/ -iname '*.[ch]' -print0 | xargs -0 tar -rhf $(PFLASH_VERSION).tar - tar --transform 's/Makefile.dist/Makefile/' -rhf $(PFLASH_VERSION).tar \ - ../pflash/Makefile.dist ../pflash/rules.mk \ - ../pflash/.version ../pflash/make_version.sh \ - ../pflash/common/* +dist: arch_links links .version + @find -L ../gard/ -iname '*.[ch]' -print0 | xargs -0 tar -rhf $(GARD_VERSION).tar + @tar --transform 's/Makefile.dist/Makefile/' -rhf $(GARD_VERSION).tar \ + ../gard/Makefile.dist ../gard/rules.mk \ + ../gard/.version ../gard/common/* clean: arch_clean rm -f $(OBJS) $(EXE) *.o *.d .version .version.tmp distclean: clean rm -f *.c~ *.h~ *.sh~ Makefile~ config.mk~ libflash/*.c~ libflash/*.h~ - rm -f libflash ccan common io.h make_version.sh + rm -f libflash ccan common io.h version.c make_version.sh + rm -f gard-*.tar diff --git a/external/gard/Makefile.dist b/external/gard/Makefile.dist index 46edcb13c905..759b3eab56b5 100644 --- a/external/gard/Makefile.dist +++ b/external/gard/Makefile.dist @@ -1,3 +1,9 @@ +#Prevent make from trying to remake arch links symlinks +#which are fixed files now +ARCH_LINKS := + +GARD_VERSION := $(shell cat .version) + include rules.mk GET_ARCH = common/get_arch.sh include common/rules.mk diff --git a/external/gard/rules.mk b/external/gard/rules.mk index acaf723eb113..c0b8a57f9658 100644 --- a/external/gard/rules.mk +++ b/external/gard/rules.mk @@ -14,9 +14,11 @@ sbindir = $(prefix)/sbin datadir = $(prefix)/share mandir = $(datadir)/man -GARD_VERSION ?= $(shell ./make_version.sh $(EXE)) +#This will only be unset if we're running out of git tree, +#../../make_version.sh is garanteed to exist that way +GARD_VERSION ?= $(shell ../../make_version.sh $(EXE)) -version.c: make_version.sh .version +version.c: .version @(if [ "a$(GARD_VERSION)" = "a" ]; then \ echo "#error You need to set GARD_VERSION environment variable" > $@ ;\ else \