-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
42 lines (32 loc) · 958 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
40
41
42
PROJ = terraform-provisioner-clc_exec
VERSION=0.0.1
ARCHS = amd64
OS = darwin windows linux
OUT_DIR = target
BIN_DIR = $(OUT_DIR)/bin
PKG_DIR = $(OUT_DIR)/pkg
PKGS = $(foreach arch,$(ARCHS),$(foreach os,$(OS),$(PKG_DIR)/$(PROJ)_$(os)_$(arch)$(PKG_SUFFIX)))
BINS = $(foreach arch,$(ARCHS),$(foreach os,$(OS),$(BIN_DIR)/$(os)_$(arch)/$(PROJ)))
default: bin
build: get-deps
@go build ./...
bin: test
@gox -help >/dev/null 2>&1 ; if [ $$? -ne 2 ]; then \
go get github.com/mitchellh/gox; \
fi
@gox -output="$(BIN_DIR)/{{.OS}}_{{.Arch}}/{{.Dir}}" -arch="$(ARCHS)" -os="$(OS)"
dist: bin
@mkdir -p $(PKG_DIR) 2>/dev/null
@for arch in $(ARCHS); do \
for os in $(OS); do \
echo "$(PKG_DIR)/$(PROJ)_$${os}_${VERSION}_$${arch}.tar.gz"; \
tar czf $(PKG_DIR)/$(PROJ)_$${os}_${VERSION}_$${arch}.tar.gz -C $(BIN_DIR)/$${os}_$${arch} .; \
done \
done
get-deps:
@go get -t -v ./...
test: build
# @bin/cibuild
clean:
@go clean
@rm -rf target/