Skip to content

Commit

Permalink
Fix Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
  • Loading branch information
twz123 committed Apr 28, 2022
1 parent 98d2473 commit 2c4db50
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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,%,$@)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2c4db50

Please sign in to comment.