forked from f5devcentral/terraform-provider-bigip-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
82 lines (66 loc) · 2.16 KB
/
GNUmakefile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
TEST = ./bigip
TESTARGS = -v
PROJ = terraform-provider-bigip
ARCHS = amd64 386
OS = windows darwin linux
// BIGIP_HOST := 13.56.242.22
BIGIP_HOST := 10.192.74.73
export BIGIP_HOST
BIGIP_USER := admin
export BIGIP_USER
BIGIP_PASSWORD := cisco123
export BIGIP_PASSWORD
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/f5devcentral/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=600s -parallel=1
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= go test $(TEST) $(TESTARGS) -timeout 170m
test-compile: fmtcheck generate
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
echo " make test-compile TEST=./builtin/providers/bigip"; \
exit 1; \
fi
go test -c $(TEST) $(TESTARGS)
clean:
@go clean
@rm -rf target/