-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
87 lines (67 loc) · 2.26 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
#
# Makefile
# @author Maksym Shkolnyi <[email protected]>
#
.PHONY: clean build build-static dist deploy
export GO111MODULE=on
NAME := 3ff
MAJOR := $(shell cat VERSION | cut -d. -f 1)
MINOR := $(shell cat VERSION | cut -d. -f 2)
REVISION := $(shell cat VERSION | cut -d. -f 3)
BASEURL := https://tfresdif.s3.eu-central-1.amazonaws.com
OS=$(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH=amd64
LDFLAGS := \
-X main.major=${MAJOR} \
-X main.minor=${MINOR} \
-X main.revision=${REVISION}
default: build
old-clean:
@echo -e '\033[0;33mCleaning up...\033[0m'
@rm dist/* -rf
@rm bin/* -rf
@echo -e '\033[0;32mDONE!\033[0m'
old-build:
@echo -e '\033[0;33mBuilding...\033[0m'
go build -v -o ./bin/$(NAME) -ldflags '${LDFLAGS}' .
@echo -e '\033[0;32mDONE!\033[0m'
old-build-static:
@echo -e '\033[0;33mBuilding...\033[0m'
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -a -o ./bin/$(NAME) -ldflags '-s -w --extldflags "-static" ${LDFLAGS}' .
@echo -e '\033[0;32mDONE!\033[0m'
old-dist:
@# For linux 386 when building on linux amd64 you'll need 'libc6-dev-i386' package
@echo -e '\033[0;33mBuilding dist\033[0m'
@set -e ;\
# Commented Windows platform "windows amd64 0 .exe " \l
for arch in "linux amd64 0 " \
"darwin amd64 0 "; \
do \
set -- $$arch ; \
echo "******************* $$1_$$2 ********************" ;\
distpath="./dist/$$1_$$2" ;\
mkdir -p $$distpath ; \
CGO_ENABLED=$$3 GOOS=$$1 GOARCH=$$2 go build -v -a -o $$distpath/$(NAME)$$4 -ldflags '-s -w --extldflags "-static" ${LDFLAGS}' . ;\
pushd $$distpath ; md5sum $(NAME) | tee $(NAME).md5 ; popd ;\
cp "README.md" "LICENSE" $$distpath ;\
done
@echo -e '\033[0;32mDONE!\033[0m'
bazel-purge:
bazel clean --expunge
bazel-clean:
bazel clean
gazelle:
bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=third_party.bzl%third_party_dependencies
bazel-prep: bazel-clean gazelle
bazel-build:
bazel build --verbose_failures //:go-3ff
bazel-cleanbuild: bazel-prep bazel-build
bazel-build-from-scratch: bazel-purge gazelle bazel-build
.PHONY: test-cov
test-cov:
$(shell ./test_coverage.sh)
.PHONY: build-tfgrep
build-tfgrep:
@echo -e '\033[0;33mBuilding...\033[0m'
go build -v -o ./bin/tfgrep -ldflags '${LDFLAGS}' tfgrep.go
@echo -e '\033[0;32mDONE!\033[0m'