-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (33 loc) · 1.15 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
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
NAME=$$(grep TerraformProviderName clouddktf/version.go | grep -o -e 'terraform-provider-[a-z]*')
TARGETS=darwin linux windows
VERSION=$$(grep TerraformProviderVersion clouddktf/version.go | grep -o -e '[0-9]\.[0-9]\.[0-9]')
default: build
build:
go build -o "bin/$(NAME)_v$(VERSION)-custom_x4"
example: example-init example-apply example-apply example-destroy
example-apply:
cd ./example && terraform apply -auto-approve
example-destroy:
cd ./example && terraform destroy -auto-approve
example-init:
rm -f "example/$(NAME)_v"*
go build -o "example/$(NAME)_v$(VERSION)-custom_x4"
cd ./example && terraform init
example-plan:
cd ./example && terraform plan
fmt:
gofmt -w $(GOFMT_FILES)
init:
go get ./...
targets: $(TARGETS)
test:
go test -v ./...
$(TARGETS):
GOOS=$@ GOARCH=amd64 CGO_ENABLED=0 go build \
-o "dist/$@/$(NAME)_v$(VERSION)-custom_x4" \
-a -ldflags '-extldflags "-static"'
zip \
-j "dist/$(NAME)_v$(VERSION)-custom_$@_amd64.zip" \
"dist/$@/$(NAME)_v$(VERSION)-custom_x4"
.PHONY: build example example-apply example-destroy example-init example-plan fmt init targets test $(TARGETS)