Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Makefile improvements #1140

Merged
merged 4 commits into from
Apr 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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