-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
92 lines (72 loc) · 2.24 KB
/
Makefile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Ensure go modules are enabled:
export GO111MODULE=on
# Disable CGO so that we always generate static binaries:
export CGO_ENABLED=0
BUILD_DIR ?= $(PWD)/build
IMG ?= quay.io/ocp-cert/opct
VERSION=$(shell git rev-parse --short HEAD)
RELEASE_TAG ?= 0.0.0
BIN_NAME ?= opct
GO_BUILD_FLAGS := -ldflags '-s -w -X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.commit=$(VERSION) -X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.version=$(RELEASE_TAG)'
GOOS ?= linux
GOARCH ?= amd64
# Unset GOFLAG for CI and ensure we've got nothing accidently set
unexport GOFLAGS
.PHONY: all
all: build-linux-amd64
all: build-windows-amd64
all: build-darwin-amd64
all: build-darwin-arm64
.PHONY: build-dep
build-dep:
@mkdir -p $(BUILD_DIR)
.PHONY: build
build: build-dep
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BUILD_DIR)/opct-$(GOOS)-$(GOARCH)$(GOEXT) $(GO_BUILD_FLAGS)
@cd $(BUILD_DIR); md5sum $(BUILD_DIR)/opct-$(GOOS)-$(GOARCH)$(GOEXT) > $(BUILD_DIR)/opct-$(GOOS)-$(GOARCH)$(GOEXT).sum; cd -
.PHONY: build-linux-amd64
build-linux-amd64: GOOS = linux
build-linux-amd64: GOARCH = amd64
build-linux-amd64: build
.PHONY: build-windows-amd64
build-windows-amd64: GOOS = windows
build-windows-amd64: GOARCH = amd64
build-windows-amd64: GOEXT = .exe
build-windows-amd64: build
.PHONY: build-darwin-amd64
build-darwin-amd64: GOOS = darwin
build-darwin-amd64: GOARCH = amd64
build-darwin-amd64: build
.PHONY: build-darwin-arm64
build-darwin-arm64: GOOS = darwin
build-darwin-arm64: GOARCH = arm64
build-darwin-arm64: build
.PHONY: linux-amd64-container
linux-amd64-container: build-linux-amd64
podman build -t $(IMG):latest -f hack/Containerfile --build-arg=RELEASE_TAG=$(RELEASE_TAG) .
.PHONY: image-mirror-sonobuoy
image-mirror-sonobuoy:
./hack/image-mirror-sonobuoy/mirror.sh
# Utils dev
.PHONY: update-go
update-go:
go get -u
go mod tidy
.PHONY: test
test:
go test ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: clean
clean:
rm -rvf ./build/ ./openshift-provider-cert-* ./opct-*
# For dependencies, see:
# .github/workflows/static-website.yml
# hack/docs-requirements.txt
.PHONY: build-changelog
build-changelog:
./hack/generate-changelog.sh
.PHONY: build-docs
build-docs: build-changelog
mkdocs build --site-dir ./site