0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-29 18:21:10 +00:00
terraform-provider-proxmox/Makefile
2019-12-07 19:58:29 +01:00

40 lines
955 B
Makefile

GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
NAME=$$(grep TerraformProviderName version.go | grep -o -P 'terraform-provider-[a-z]+')
TARGETS=darwin linux windows
VERSION=$$(grep TerraformProviderVersion version.go | grep -o -P '\d\.\d\.\d')
default: build
build:
go build -o "bin/$(NAME)_v$(VERSION)-custom_x4"
example:
rm -f "example/$(NAME)_v"*
go build -o "example/$(NAME)_v$(VERSION)-custom_x4"
cd ./example && \
terraform init && \
terraform apply -auto-approve && \
terraform apply -auto-approve && \
terraform destroy -auto-approve
fmt:
gofmt -w $(GOFMT_FILES)
test:
go test -v
init:
go get ./...
targets: $(TARGETS)
$(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 fmt test init targets $(TARGETS)