-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
39 lines (30 loc) · 854 Bytes
/
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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
NAME=step
TARGETS=darwin linux windows
VERSION=0.1.0
default: build
build:
rm -f "bin/$(NAME)"
packr2 build -mod=vendor -o "bin/$(NAME)"
packr2 clean
fmt:
gofmt -w $(GOFMT_FILES)
test:
packr2 test -v
init:
packr2 get ./...
targets: $(TARGETS)
$(TARGETS):
rm -f "dist/$@/$(NAME)" "dist/$(NAME)_v$(VERSION)_$@_amd64.zip"
GOOS=$@ GOARCH=amd64 CGO_ENABLED=0 packr2 build \
-mod=vendor \
-o "dist/$@/$(NAME)" \
-a -ldflags '-extldflags "-static"'
zip \
-j "dist/$(NAME)_v$(VERSION)_$@_amd64.zip" \
"dist/$@/$(NAME)"
packr2 clean
.PHONY: build fmt test init targets $(TARGETS)