From 452910c625fbc5088236a984e51e765f7c5d3062 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Wed, 26 May 2021 09:57:58 +0100 Subject: [PATCH] Makefile: Don't encode bindir in the tar archive Prior to this commit we go build -o bin/foo, archive it, and expand the archive, leaving the resulting artifact in bin. This doesn't allow us to easily change the bin directory, or move parts of the makefile around to make things more modular. This commit changes the behaviour to: go build -o foo, archive it, expand to `bin` Signed-off-by: Dave Tucker --- Makefile | 4 ++-- src/cmd/linuxkit/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dfd2a40a4..f99dbd447 100644 --- a/Makefile +++ b/Makefile @@ -35,12 +35,12 @@ RTF_COMMIT=2351267f358ce6621c0c0d9a069f361268dba5fc RTF_CMD=github.com/linuxkit/rtf/cmd RTF_VERSION=0.0 $(RTF): tmp_rtf_bin.tar | bin - tar xf $< + tar -C $(dir $(RTF)) -xf $< rm $< touch $@ tmp_rtf_bin.tar: Makefile - docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/linuxkit/rtf --clone https://github.com/linuxkit/rtf.git --commit $(RTF_COMMIT) --package github.com/linuxkit/rtf --ldflags "-X $(RTF_CMD).GitCommit=$(RTF_COMMIT) -X $(RTF_CMD).Version=$(RTF_VERSION)" -o $(RTF) > $@ + docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/linuxkit/rtf --clone https://github.com/linuxkit/rtf.git --commit $(RTF_COMMIT) --package github.com/linuxkit/rtf --ldflags "-X $(RTF_CMD).GitCommit=$(RTF_COMMIT) -X $(RTF_CMD).Version=$(RTF_VERSION)" -o $(notdir $(RTF)) > $@ # Manifest tool for multi-arch images MT_COMMIT=bfbd11963b8e0eb5f6e400afaebeaf39820b4e90 diff --git a/src/cmd/linuxkit/Makefile b/src/cmd/linuxkit/Makefile index cbeeb96fa..d5f320bca 100644 --- a/src/cmd/linuxkit/Makefile +++ b/src/cmd/linuxkit/Makefile @@ -26,12 +26,12 @@ all: default LINUXKIT_DEPS=$(wildcard *.go) $(wildcard */*.go) Makefile $(LINUXKIT): tmp_linuxkit_bin.tar | bin - tar xf $< + tar -C $(dir $(LINUXKIT)) -xf $< rm $< touch $@ tmp_linuxkit_bin.tar: $(LINUXKIT_DEPS) - tar cf - -C . . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION)" -o bin/linuxkit > $@ + tar cf - -C . . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION)" -o $(notdir $(LINUXKIT)) > $@ .PHONY: test-cross test-cross: