From 2c4db50d9124ed637265b3426574856446d9c163 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Tue, 26 Apr 2022 18:51:03 +0200 Subject: [PATCH] Fix Makefile Signed-off-by: Tom Wieczorek --- Makefile | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index ea4a6bf99c49..33e6408a578f 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ EMBEDDED_BINS_BUILDMODE ?= docker TARGET_OS ?= linux GOARCH ?= $(shell go env GOARCH) GOPATH ?= $(shell go env GOPATH) +GOBIN ?= $(shell go env GOBIN) BUILD_UID ?= $(shell id -u) BUILD_GID ?= $(shell id -g) BUILD_GO_FLAGS := -tags osusergo @@ -56,25 +57,10 @@ LD_FLAGS += -X k8s.io/component-base/version.buildDate=$(BUILD_DATE) LD_FLAGS += -X k8s.io/component-base/version.gitCommit="not_available" LD_FLAGS += $(BUILD_GO_LDFLAGS_EXTRA) -golint := $(shell which golangci-lint 2>/dev/null) -ifeq ($(golint),) -golint := cd hack/ci-deps && go install github.com/golangci/golangci-lint/cmd/golangci-lint && cd ../.. && "${GOPATH}/bin/golangci-lint" -endif - -go_bindata := $(shell which go-bindata 2>/dev/null) -ifeq ($(go_bindata),) -go_bindata := cd hack/ci-deps && go install github.com/kevinburke/go-bindata/... && cd ../.. && "${GOPATH}/bin/go-bindata" -endif - -go_clientgen := $(shell which client-gen 2>/dev/null) -ifeq ($(go_clientgen),) -go_clientgen := cd hack/ci-deps && go install k8s.io/code-generator/cmd/client-gen@v0.22.2 && cd ../.. && "${GOPATH}/bin/client-gen" -endif - -go_controllergen := $(shell which controller-gen 2>/dev/null) -ifeq ($(go_controllergen),) -go_controllergen := cd hack/ci-deps && go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0 && cd ../.. && "${GOPATH}/bin/controller-gen" -endif +golint := (cd hack/ci-deps && go install github.com/golangci/golangci-lint/cmd/golangci-lint) && "${GOBIN}/golangci-lint" +go_bindata := (cd hack/ci-deps && go install github.com/kevinburke/go-bindata/...) && "${GOBIN}/go-bindata" +go_clientgen := (cd hack/ci-deps && go install k8s.io/code-generator/cmd/client-gen) && "${GOBIN}/client-gen" +go_controllergen := (cd hack/ci-deps && go install sigs.k8s.io/controller-tools/cmd/controller-gen) && "${GOBIN}/controller-gen" GOLANG_IMAGE = golang:$(go_version)-alpine GO ?= GOCACHE=/go/src/github.com/k0sproject/k0s/build/cache/go/build GOMODCACHE=/go/src/github.com/k0sproject/k0s/build/cache/go/mod docker run --rm \ @@ -105,7 +91,7 @@ endif .PHONY: all all: k0s k0s.exe -go.sum: go.mod +go.sum: go.mod static/gen_manifests.go .k0sbuild.docker-image.k0s $(GO) mod tidy zz_os = $(patsubst pkg/assets/zz_generated_offsets_%.go,%,$@) @@ -157,7 +143,7 @@ k0s.exe k0s: $(GO_SRCS) go.sum .PHONY: lint -lint: pkg/assets/zz_generated_offsets_$(shell go env GOOS).go +lint: go.sum static/gen_manifests.go pkg/assets/zz_generated_offsets_$(shell go env GOOS).go $(golint) run --verbose $(GO_DIRS) .PHONY: $(smoketests)