forked from mantl/consul-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (27 loc) · 779 Bytes
/
Copy pathMakefile
File metadata and controls
35 lines (27 loc) · 779 Bytes
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
NAME = $(shell awk -F\" '/^const Name/ { print $$2 }' main.go)
VERSION = $(shell awk -F\" '/^const Version/ { print $$2 }' main.go)
all: build
build:
@mkdir -p bin/
go build -o bin/$(NAME)
deps:
go mod download
test:
go test ./... $(TESTARGS) -timeout=30s -parallel=4
go vet ./...
xcompile: test package-clean
@mkdir -p build
gox \
-arch="arm amd64" \
-os="darwin freebsd linux netbsd openbsd solarios windows" \
-output="build/{{.Dir}}_$(VERSION)_{{.OS}}_{{.Arch}}/$(NAME)"
package: xcompile
$(eval FILES := $(shell ls build))
@mkdir -p build/zip
for f in $(FILES); do \
(cd $$PWD/build/$$f && zip ../zip/$$f.zip consul-cli*); \
echo $$f; \
done
package-clean:
-@rm -rf build/
.PHONY: all deps updatedeps build test xcompile package package-clean