[Skiboot] [PATCH] external/gard: Fix make dist target
Cyril Bur
cyril.bur at au1.ibm.com
Wed Jan 25 16:38:13 AEDT 2017
Several problems:
Firstly, it could never have worked, it was using the wrong variable.
Secondly, if it was using GARD_VERSION it produced a broken tarball that
still looked into the skiboot source for files despite them having been
copied into the tarball.
Lastly (and not really a make dist issue) the current way of symlinking
make_version.sh was racey. Get around the issue by refering to it in its
actual location (if we know it will be there) or by looking at .version
if building from tarball.
Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
external/common/rules.mk | 2 +-
external/gard/.gitignore | 1 +
external/gard/Makefile | 19 +++++++++----------
external/gard/Makefile.dist | 6 ++++++
external/gard/rules.mk | 6 ++++--
5 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/external/common/rules.mk b/external/common/rules.mk
index bb12fd5b..8c5749b5 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 7c81877c..7e8f83f2 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 b54923d2..2ccd1440 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 46edcb13..759b3eab 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 acaf723e..c0b8a57f 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 \
--
2.11.0
More information about the Skiboot
mailing list