-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
64 lines (52 loc) · 1.75 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
TEST = ./bigip
TESTARGS = -v
PROJ = terraform-provider-bigip
ARCHS = amd64 386
OS = windows darwin 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:
@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}}/terraform-{{.Dir}}" -arch="$(ARCHS)" -os="$(OS)" "github.com/DealerDotCom/terraform-provider-bigip"
dist:
@mkdir -p $(PKG_DIR) 2>/dev/null
@for arch in $(ARCHS); do \
for os in $(OS); do \
echo "$(PKG_DIR)/$(PROJ)_$${os}_$${arch}.tar.gz"; \
tar czf $(PKG_DIR)/$(PROJ)_$${os}_$${arch}.tar.gz -C $(BIN_DIR)/$${os}_$${arch} .; \
done \
done
fmt:
@gofmt -l -w . bigip/
# vet runs the Go source code static analysis tool `vet` to find
# any common errors.
vet:
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
go get golang.org/x/tools/cmd/vet; \
fi
@echo "go tool vet $(VETARGS) ."
@go tool vet $(VETARGS) $$(ls -d */ | grep -v vendor) ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi
test: build
@TF_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4
testacc: fmt build
@if [[ "$(BIGIP_USER)" == "" || "$(BIGIP_HOST)" == "" || "-z $(BIGIP_PASSWORD)" == "" ]]; then \
echo "ERROR: BIGIP_USER, BIGIP_PASSWORD and BIGIP_HOST must be set."; \
exit 1; \
fi
@TF_ACC=1 go test $(TEST) $(TESTARGS) -timeout 120m
clean:
@go clean
@rm -rf target/