Skip to content

Commit

Permalink
Merge pull request #1140 from dvzrv/dvzrv/makefile
Browse files Browse the repository at this point in the history
Various Makefile improvements
  • Loading branch information
k8s-ci-robot authored Apr 26, 2023
2 parents 471c53d + ae7a5eb commit 11dfe65
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ endif
PROJECT := github.com/kubernetes-sigs/cri-tools
BINDIR ?= /usr/local/bin

VERSION := $(shell git describe --tags --dirty --always)
VERSION := $(VERSION:v%=%)
GO_LDFLAGS := -X $(PROJECT)/pkg/version.Version=$(VERSION)
VERSION ?= $(shell git describe --tags --dirty --always | sed 's/^v//')
CGO_ENABLED ?= 0
GOFLAGS ?= -trimpath
GO_LDFLAGS := $(GO_LDFLAGS) -X $(PROJECT)/pkg/version.Version=$(VERSION)

BUILD_PATH := $(shell pwd)/build
BUILD_BIN_PATH := $(BUILD_PATH)/bin/$(GOOS)/$(GOARCH)
Expand Down Expand Up @@ -64,18 +65,18 @@ critest:
@$(MAKE) -B $(CRITEST)

$(CRITEST):
CGO_ENABLED=0 $(GO_TEST) -c -o $@ \
CGO_ENABLED=$(CGO_ENABLED) $(GO_TEST) -c -o $@ \
-ldflags '$(GO_LDFLAGS)' \
-trimpath \
$(GOFLAGS) \
$(PROJECT)/cmd/critest

crictl:
@$(MAKE) -B $(CRICTL)

$(CRICTL):
CGO_ENABLED=0 $(GO_BUILD) -o $@ \
CGO_ENABLED=$(CGO_ENABLED) $(GO_BUILD) -o $@ \
-ldflags '$(GO_LDFLAGS)' \
-trimpath \
$(GOFLAGS) \
$(PROJECT)/cmd/crictl

clean:
Expand Down

0 comments on commit 11dfe65

Please sign in to comment.