From ae7166d7d3ee8b17513a6476c7f3bcc1c5f820e4 Mon Sep 17 00:00:00 2001 From: "ryan-distrust.co" Date: Thu, 8 Jun 2023 21:46:25 -0400 Subject: [PATCH] Makefile: fix gopath issues --- Makefile | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 2709cad..bede3ff 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ REGION := sfo3 ROOT_DIR := $(shell pwd) TERRAFORM := $(ROOT_DIR)/out/terraform SOPS := $(ROOT_DIR)/out/sops +GO := cache/fetch/go/bin/go KEYS := \ 6B61ECD76088748C70590D55E90A401336C8AAA9 \ 88823A75ECAA786B0FF38B148E401478A3FBEF72 \ @@ -132,63 +133,59 @@ $(FETCH_DIR)/talosctl: $(FETCH_DIR)/kubectl: $(call git_clone,$@,$(KUBECTL_REPO),$(KUBECTL_REF)) -$(OUT_DIR)/go: $(FETCH_DIR)/go +$(FETCH_DIR)/go/bin/go: $(FETCH_DIR)/go $(call toolchain," \ cd $(FETCH_DIR)/go/src && \ - mkdir -p /home/build/$@-root/pkg && \ - GOROOT_FINAL=/home/build/$@-root/ \ - ./make.bash && \ - cp /home/build/$(FETCH_DIR)/go/bin/go /home/build/$@ && \ - cp -r /home/build/$(FETCH_DIR)/go/pkg/* /home/build/$@-root/pkg \ + ./make.bash \ ") -$(OUT_DIR)/terraform: $(FETCH_DIR)/terraform $(OUT_DIR)/go +$(OUT_DIR)/terraform: $(FETCH_DIR)/terraform $(GO) $(call toolchain," \ cd $(FETCH_DIR)/terraform && \ export SSL_CERT_DIR=/etc/ssl/certs && \ export CGO_ENABLED=0 && \ export GOCACHE=/home/build/$(CACHE_DIR) && \ export GOPATH=/home/build/$(CACHE_DIR) && \ - /home/build/$(OUT_DIR)/go build \ + /home/build/$(GO) build \ -v \ -trimpath \ -ldflags='-w -extldflags=-static' \ -o /home/build/$@ \ ") -$(OUT_DIR)/sops: $(FETCH_DIR)/sops $(OUT_DIR)/go +$(OUT_DIR)/sops: $(FETCH_DIR)/sops $(GO) $(call toolchain," \ cd $(FETCH_DIR)/sops && \ export CGO_ENABLED=0 && \ export GOCACHE=/home/build/$(CACHE_DIR) && \ export GOPATH=/home/build/$(CACHE_DIR) && \ - /home/build/$(OUT_DIR)/go build \ + /home/build/$(GO) build \ -v \ -trimpath \ -ldflags='-w -extldflags=-static' \ -o /home/build/$@ $(SOPS_PKG) \ ") -$(OUT_DIR)/talosctl: $(FETCH_DIR)/talosctl $(OUT_DIR)/go +$(OUT_DIR)/talosctl: $(FETCH_DIR)/talosctl $(GO) $(call toolchain," \ cd $(FETCH_DIR)/talosctl && \ export CGO_ENABLED=0 && \ export GOCACHE=/home/build/$(CACHE_DIR) && \ export GOPATH=/home/build/$(CACHE_DIR) && \ - /home/build/$(OUT_DIR)/go build \ + /home/build/$(GO) build \ -v \ -trimpath \ -ldflags='-w -extldflags=-static' \ -o /home/build/$@ $(TALOSCTL_PKG) \ ") -$(OUT_DIR)/kubectl: $(FETCH_DIR)/kubectl $(OUT_DIR)/go +$(OUT_DIR)/kubectl: $(FETCH_DIR)/kubectl $(GO) $(call toolchain," \ cd $(FETCH_DIR)/kubectl && \ export CGO_ENABLED=0 && \ export GOCACHE=/home/build/$(CACHE_DIR) && \ export GOPATH=/home/build/$(CACHE_DIR) && \ - /home/build/$(OUT_DIR)/go build \ + /home/build/$(GO) build \ -v \ -trimpath \ -ldflags='-w -extldflags=-static' \