-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (29 loc) · 1.06 KB
/
Makefile
File metadata and controls
37 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
VERSION := v0.1.0
DATE := $(shell date)
COMMIT := $(shell git rev-parse --short HEAD)
VERSION_LINKER_FLAG := 'github.com/IBM/image-prune/cmd.ImagePruneVersion=$(VERSION)'
DATE_LINKER_FLAG := 'github.com/IBM/image-prune/cmd.ImagePruneBuildDate=$(DATE)'
COMMIT_LINKER_FLAG := 'github.com/IBM/image-prune/cmd.ImagePruneCommit=$(COMMIT)'
LINKER_FLAGS := "-X $(VERSION_LINKER_FLAG) -X $(DATE_LINKER_FLAG) -X $(COMMIT_LINKER_FLAG)"
PLATFORMS ?= darwin/amd64 darwin/arm64 windows/amd64 linux/amd64 linux/arm64 linux/ppc64le linux/s390x
RELEASE_UPLOAD_URL ?=
build:
@for plt in $(PLATFORMS); \
do \
os=$${plt%%/*}; \
arv=$${plt#*/}; \
arch=$${arv%/*}; \
CGO_ENABLED=0 GOOS=$${os} GOARCH=$${arch} go build \
-o dist/image-prune-$${os}-$${arch} \
-ldflags=$(LINKER_FLAGS) \
-tags exclude_graphdriver_btrfs \
.; \
done \
lint-dependencies:
@GOBIN=/usr/local/bin/ go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.2.2
lint:
@golangci-lint run
release:
@bash ci/release.sh "$(RELEASE_UPLOAD_URL)" "$(PLATFORMS)"
test-setup:
@bash ci/test/setup.sh