-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
138 lines (122 loc) · 3.21 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Old-skool build tools.
#
# Targets (see each target for more information):
# all: Build code.
# build: Build code.
# check: Run verify, build, unit tests and cmd tests.
# verify: Verify code conventions are properly setup.
# verify-commits: Verify commit comments.
# test-unit: Run unit tests.
# clean: Clean up.
# build-cross: Build the cross compiled release binaries.
# build-rpms: Build RPMs only for the Linux AMD64 target.
# build-images: Build images from the official RPMs.
# run-dev: Run autoheal server using dev defaults.
OUT_DIR = _output
OS_OUTPUT_GOPATH ?= 1
export GOFLAGS
export TESTFLAGS
# If set to 1, create an isolated GOPATH inside _output using symlinks to avoid
# other packages being accidentally included. Defaults to on.
export OS_OUTPUT_GOPATH
# May be used to set additional arguments passed to the image build commands for
# mounting secrets specific to a build environment.
export OS_BUILD_IMAGE_ARGS
# Tests run using `make` are most often run by the CI system, so we are OK to
# assume the user wants jUnit output and will turn it off if they don't.
JUNIT_REPORT ?= true
# Build code.
#
# Args:
# WHAT: Directory names to build. If any of these directories has a 'main'
# package, the build will produce executable files under $(OUT_DIR)/local/bin.
# If not specified, "everything" will be built.
# GOFLAGS: Extra flags to pass to 'go' when building.
# TESTFLAGS: Extra flags that should only be passed to hack/test-go.sh
#
# Example:
# make
# make all
# make all WHAT=cmd/oc GOFLAGS=-v
all build:
hack/build-go.sh $(WHAT) $(GOFLAGS)
.PHONY: all build
# Run core verification and all self contained tests.
#
# Example:
# make check
check: | verify test-unit
.PHONY: check
# Verify code conventions are properly setup.
#
# Example:
# make verify
verify:
{ \
hack/verify-gofmt.sh ||r=1;\
hack/verify-govet.sh ||r=1;\
hack/verify-imports.sh ||r=1;\
exit $$r ;\
}
.PHONY: verify
# Verify commit comments.
#
# Example:
# make verify-commits
verify-commits:
hack/verify-upstream-commits.sh
.PHONY: verify-commits
# Run unit tests.
#
# Args:
# WHAT: Directory names to test. All *_test.go files under these
# directories will be run. If not specified, "everything" will be tested.
# TESTS: Same as WHAT.
# GOFLAGS: Extra flags to pass to 'go' when building.
# TESTFLAGS: Extra flags that should only be passed to hack/test-go.sh
#
# Example:
# make test-unit
# make test-unit WHAT=pkg/build TESTFLAGS=-v
test-unit:
GOTEST_FLAGS="$(TESTFLAGS)" hack/test-go.sh $(WHAT) $(TESTS)
.PHONY: test-unit
# Remove all build artifacts.
#
# Example:
# make clean
clean:
rm -rf $(OUT_DIR)
.PHONY: clean
# Build the cross compiled release binaries
#
# Example:
# make build-cross
build-cross:
hack/build-cross.sh
.PHONY: build-cross
# Build RPMs only for the Linux AMD64 target
#
# Args:
#
# Example:
# make build-rpms
build-rpms:
OS_ONLY_BUILD_PLATFORMS='linux/amd64' hack/build-rpms.sh
.PHONY: build-rpms
# Build images from the official RPMs
#
# Args:
#
# Example:
# make build-images
build-images: build-rpms
hack/build-images.sh
.PHONY: build-images
# Run autoheal server using dev defaults.
#
# Example:
# make run-dev
run-dev:
hack/run-dev.sh
.PHONY: run-dev