Fix Makefile to run tools on host OS/ARCH

This commit is contained in:
Tim Hockin 2022-06-06 14:24:41 -07:00
parent 944fb19697
commit 660024b973
1 changed files with 46 additions and 44 deletions

View File

@ -122,8 +122,10 @@ DOTFILE_IMAGE = $(subst /,_,$(IMAGE))-$(TAG)
LICENSES = .licenses
$(LICENSES): bin/$(shell go env GOOS)_$(shell go env GOARCH)/$(BIN)
@go build -o ./bin/tools github.com/google/go-licenses
$(LICENSES):
@GOOS=$(shell go env GOHOSTOS) \
GOARCH=$(shell go env GOHOSTARCH) \
go build -o ./bin/tools github.com/google/go-licenses
@rm -rf $(LICENSES)
@./bin/tools/go-licenses save ./... --save_path=$(LICENSES)
@chmod -R a+rx $(LICENSES)