-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (26 loc) · 1.03 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
NAMES=iamtf josso
VERSION=$(shell git describe --tags --always --dirty)
PLATFORMS=darwin linux windows openbsd
ARCHITECTURES=amd64 386 arm64 arm
default: build
dep: # Download required dependencies
go mod tidy
go mod vendor
install:
go install ./...
build: fmtcheck
go install -ldflags "-X main.version=$(VERSION)" ./...
fmtcheck: dep
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
dist:
$(foreach NAME,$(NAMES),\
$(foreach GOOS,$(PLATFORMS),\
$(foreach GOARCH,$(ARCHITECTURES),\
$(shell export GOOS=$(GOOS);\
export BINARY=$(NAME)ctl;\
export GOARCH=$(GOARCH);\
OUT_DIR='./.tmp/$(NAME)/$(GOOS)/$(GOARCH)/$(VERSION)';\
go build -ldflags "-X main.version=$(VERSION)" -v -o $${OUT_DIR%.}/$(BINARY) ./$(NAME)ctl; \
if test -f $${OUT_DIR}/$${BINARY} ; then cd $${OUT_DIR} ; zip -q ../../../$${BINARY}-$(GOOS)-$(GOARCH)-$(VERSION).zip $${BINARY} ; fi; \
if test -f $${OUT_DIR}/$${BINARY}.exe ; then cd $${OUT_DIR} ; zip -q ../../../$${BINARY}-$(GOOS)-$(GOARCH)-$(VERSION).zip $${BINARY}.exe ; fi \
))))