-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
60 lines (48 loc) · 1.1 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
GOOS ?= linux
GOARCH ?= $(shell go env GOARCH)
GOFLAGS ?=""
SOURCES := $(shell find . -type f -name '*.go')
REGISTRY ?= "docker.io/hyperledgerk8s"
DOCKER_TARGETS := bc-cli
TARGETS := ${DOCKER_TARGETS}
WHAT ?= $(TARGETS)
# Build binary
#
# Args:
# WHAT: Target to build.
# GOOS: OS to build.
# GOARCH: Arch to build.
#
# Example:
# make all
.PHONY: all
all: binary
binary:
@GOFLAGS=$(GOFLAGS) BUILD_PLATFORMS=$(GOOS)/$(GOARCH) hack/build.sh $(WHAT)
.PHONY: clean
clean:
rm -rf _output
.PHONY: test
test:
@hack/run-unit-tests.sh
.PHONY: verify
verify:
@hack/verify-copyright.sh
@hack/verify-golangci-lint.sh
@hack/verify-shfmt.sh
.PHONY: golanglint-fix
golanglint-fix:
@hack/fix-golang-lint-error.sh
# Build image.
#
# Args:
# WHAT: Target to build.
# GOOS: OS to build.
# GOARCH: Arch to build.
# OUTPUT_TYPE: Destination to save image(docker/registry).
#
# Example:
# make image
.PHONY: images
image:
@REGISTRY=$(REGISTRY) OUTPUT_TYPE=$(OUTPUT_TYPE) BUILD_PLATFORMS=$(GOOS)/$(GOARCH) OS=$(GOOS) ARCH=$(GOARCH) hack/build-image.sh $(filter ${DOCKER_TARGETS}, ${WHAT})