-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (41 loc) · 1.49 KB
/
Makefile
File metadata and controls
52 lines (41 loc) · 1.49 KB
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
VERSION := $(shell cat VERSION)
LDFLAGS := -X main.version=$(VERSION)
TERRAFORMRC := $(HOME)/.terraformrc
DEV_MARKER := \# splitsecure-dev-override
.PHONY: build lint test docs check-docs clean install-dev uninstall-dev
build:
go build -ldflags '$(LDFLAGS)' -o terraform-provider-splitsecure .
lint:
golangci-lint run ./...
test:
go test ./...
docs:
go generate ./...
check-docs: docs
@if [ -n "$$(git status --porcelain docs/)" ]; then \
echo "docs/ is out of date. Run 'make docs' and commit." >&2; \
git diff docs/ >&2; \
exit 1; \
fi
clean:
rm -f terraform-provider-splitsecure
install-dev: build
@if [ -f $(TERRAFORMRC) ] && ! grep -q '^$(DEV_MARKER)' $(TERRAFORMRC); then \
echo "$(TERRAFORMRC) exists and is not managed by this Makefile." >&2; \
echo "Back it up and re-run 'make install-dev'." >&2; \
exit 1; \
fi
@printf '$(DEV_MARKER)\nprovider_installation {\n dev_overrides {\n "splitsecure/splitsecure" = "%s"\n }\n direct {}\n}\n' "$(CURDIR)" > $(TERRAFORMRC)
@echo "Dev override installed in $(TERRAFORMRC)."
@echo "All terraform invocations now use $(CURDIR)/terraform-provider-splitsecure."
@echo "Run 'make uninstall-dev' to remove."
uninstall-dev:
@if [ ! -f $(TERRAFORMRC) ]; then \
echo "$(TERRAFORMRC) does not exist -- nothing to remove."; \
elif grep -q '^$(DEV_MARKER)' $(TERRAFORMRC); then \
rm $(TERRAFORMRC); \
echo "Removed $(TERRAFORMRC)."; \
else \
echo "$(TERRAFORMRC) is not managed by this Makefile -- not touched." >&2; \
exit 1; \
fi