-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathMakefile
72 lines (55 loc) · 2.65 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
# Copyright Contributors to the Open Cluster Management project
BEFORE_SCRIPT := $(shell build/before-make.sh)
SCRIPTS_PATH ?= build
# Install software dependencies
INSTALL_DEPENDENCIES ?= ${SCRIPTS_PATH}/install-dependencies.sh
GOPATH := ${shell go env GOPATH}
export PROJECT_DIR = $(shell 'pwd')
export PROJECT_NAME = $(shell basename ${PROJECT_DIR})
export GOPACKAGES = $(shell go list ./... | grep -v /vendor | grep -v /build | grep -v /test )
.PHONY: clean
clean: clean-test
kind delete cluster --name ${PROJECT_NAME}-functional-test-hub
kind delete cluster --name ${PROJECT_NAME}-functional-test-c1
kind delete cluster --name ${PROJECT_NAME}-functional-test-c2
.PHONY: deps
deps:
@$(INSTALL_DEPENDENCIES)
.PHONY: build
build:
rm -f ${GOPATH}/bin/clusteradm
go install ./cmd/clusteradm.go
.PHONY:
build-bin:
@rm -rf bin
@mkdir -p bin
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -gcflags=-trimpath=x/y -o bin/clusteradm_darwin_amd64 ./cmd/clusteradm.go && tar -czf bin/clusteradm_darwin_amd64.tar.gz -C bin/ clusteradm_darwin_amd64
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -gcflags=-trimpath=x/y -o bin/clusteradm_linux_amd64 ./cmd/clusteradm.go && tar -czf bin/clusteradm_linux_amd64.tar.gz -C bin/ clusteradm_linux_amd64
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -gcflags=-trimpath=x/y -o bin/clusteradm_linux_arm64 ./cmd/clusteradm.go && tar -czf bin/clusteradm_linux_arm64.tar.gz -C bin/ clusteradm_linux_arm64
GOOS=linux GOARCH=ppc64le go build -ldflags="-s -w" -gcflags=-trimpath=x/y -o bin/clusteradm_linux_ppc64le ./cmd/clusteradm.go && tar -czf bin/clusteradm_linux_ppc64le.tar.gz -C bin/ clusteradm_linux_ppc64le
GOOS=linux GOARCH=s390x go build -ldflags="-s -w" -gcflags=-trimpath=x/y -o bin/clusteradm_linux_s390x ./cmd/clusteradm.go && tar -czf bin/clusteradm_linux_s390x.tar.gz -C bin/ clusteradm_linux_s390x
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -gcflags=-trimpath=x/y -o bin/clusteradm_windows_amd64.exe ./cmd/clusteradm.go && zip -q bin/clusteradm_windows_amd64.zip -j bin/clusteradm_windows_amd64.exe
.PHONY: install
install: build
.PHONY: plugin
plugin: build
cp ${GOPATH}/bin/clusteradm ${GOPATH}/bin/oc-clusteradm
cp ${GOPATH}/bin/clusteradm ${GOPATH}/bin/kubectl-clusteradm
.PHONY: check
## Runs a set of required checks
check: check-copyright
.PHONY: check-copyright
check-copyright:
@build/check-copyright.sh
.PHONY: test
test:
@build/run-unit-tests.sh
.PHONY: clean-test
clean-test:
-rm -r ./test/unit/coverage
-rm -r ./test/unit/tmp
-rm -r ./test/functional/tmp
-rm -r ./test/out
.PHONY: functional-test-full
functional-test-full: deps install
@build/run-functional-tests.sh