forked from warrensbox/terraform-switcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (23 loc) · 823 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
EXE := tfswitch
PKG := github.com/warrensbox/terraform-switcher
VER := $(shell git ls-remote --tags git://github.com/warrensbox/terraform-switcher | awk '{print $$2}'| awk -F"/" '{print $$3}' | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -n 2 | head -n1)
PATH := build:$(PATH)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
$(EXE): go.mod *.go lib/*.go
go build -v -ldflags "-X main.version=$(VER)" -o $@ $(PKG)
.PHONY: release
release: $(EXE) darwin linux
.PHONY: darwin linux
darwin linux:
GOOS=$@ go build -ldflags "-X main.version=$(VER)" -o $(EXE)-$(VER)-$@-$(GOARCH) $(PKG)
.PHONY: clean
clean:
rm -f $(EXE) $(EXE)-*-*-*
.PHONY: test
test: $(EXE)
mv $(EXE) build
go test -v ./...
.PHONY: docs
docs:
cd docs; bundle install --path vendor/bundler; bundle exec jekyll build -c _config.yml; cd ..