-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
54 lines (44 loc) · 1.34 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
REPO_DIR := $(shell basename $(CURDIR))
PLUGIN_NAME := $(shell command ls cmd/)
PLUGIN_DIR ?= $$GOPATH/vault-plugins
PLUGIN_PATH ?= local-auth-azure
# bin generates the releasable binaries for this plugin
.PHONY: bin
bin:
@CGO_ENABLED=0 BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/build.sh'"
.PHONY: default
default: dev
.PHONY: dev
dev:
@CGO_ENABLED=0 BUILD_TAGS='$(BUILD_TAGS)' VAULT_DEV_BUILD=1 sh -c "'$(CURDIR)/scripts/build.sh'"
.PHONY: bootstrap
bootstrap:
@echo "Downloading tools ..."
@go generate -tags tools tools/tools.go
@if [ "$(PLUGIN_NAME)" != "$(REPO_DIR)" ]; then \
echo "Renaming cmd/$(PLUGIN_NAME) to cmd/$(REPO_DIR) ..."; \
mv cmd/$(PLUGIN_NAME) to cmd/$(REPO_DIR); \
echo "Renaming Go module to github.com/hashicorp/$(REPO_DIR) ..."; \
go mod edit -module github.com/hashicorp/$(REPO_DIR); \
fi
.PHONY: test
test: fmtcheck
CGO_ENABLED=0 go test ./... $(TESTARGS) -timeout=20m
.PHONY: fmtcheck
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
.PHONY: fmt
fmt:
gofumpt -l -w .
.PHONY: setup-env
setup-env:
cd bootstrap/terraform && terraform init && terraform apply -auto-approve
.PHONY: teardown-env
teardown-env:
cd bootstrap/terraform && terraform init && terraform destroy -auto-approve
.PHONY: configure
configure: dev
@./bootstrap/configure.sh \
$(PLUGIN_DIR) \
$(PLUGIN_NAME) \
$(PLUGIN_PATH)