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 <dave@dtucker.co.uk>
This commit is contained in:
Dave Tucker 2021-05-26 09:57:58 +01:00
parent f4c4ab1c8c
commit 452910c625
2 changed files with 4 additions and 4 deletions

View File

@ -35,12 +35,12 @@ RTF_COMMIT=2351267f358ce6621c0c0d9a069f361268dba5fc
RTF_CMD=github.com/linuxkit/rtf/cmd RTF_CMD=github.com/linuxkit/rtf/cmd
RTF_VERSION=0.0 RTF_VERSION=0.0
$(RTF): tmp_rtf_bin.tar | bin $(RTF): tmp_rtf_bin.tar | bin
tar xf $< tar -C $(dir $(RTF)) -xf $<
rm $< rm $<
touch $@ touch $@
tmp_rtf_bin.tar: Makefile 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 # Manifest tool for multi-arch images
MT_COMMIT=bfbd11963b8e0eb5f6e400afaebeaf39820b4e90 MT_COMMIT=bfbd11963b8e0eb5f6e400afaebeaf39820b4e90

View File

@ -26,12 +26,12 @@ all: default
LINUXKIT_DEPS=$(wildcard *.go) $(wildcard */*.go) Makefile LINUXKIT_DEPS=$(wildcard *.go) $(wildcard */*.go) Makefile
$(LINUXKIT): tmp_linuxkit_bin.tar | bin $(LINUXKIT): tmp_linuxkit_bin.tar | bin
tar xf $< tar -C $(dir $(LINUXKIT)) -xf $<
rm $< rm $<
touch $@ touch $@
tmp_linuxkit_bin.tar: $(LINUXKIT_DEPS) 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 .PHONY: test-cross
test-cross: test-cross: