-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (39 loc) · 1.24 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
.PHONY: default
GO := /usr/local/go
BINDIR := $(CURDIR)/bin
BINNAME := terraform-provider-eaa
BINNAME_TOOL := import-config
PLUGIN_ARCH := darwin_amd64
VERSION_STR := 1.0.0
SRC := $(shell find . -type f -name '*.go' -print)
SHELL = /usr/bin/env bash
GOBIN := $(shell which go)
GOLINTBIN := $(shell which golangci-lint)
ifneq ("$(wildcard $(GOBIN))","")
GO = $(GOBIN)
endif
default: fmt lint build buildtool install
build: $(SRC)
@echo build eaa provider binary
$(GO) build -v -o $(BINDIR)/$(BINNAME) $(CURDIR)
buildtool: $(SRC)
@echo build import tool binary
$(GO) build -v -o $(BINDIR)/$(BINNAME_TOOL) $(CURDIR)/tools
fmt:
@echo go fmt ./...
$(GO) fmt ./...
install:
# install for macOS amd64
# Create the directory holding the newly built Terraform plugins
mkdir -p ~/.terraform.d/plugins/terraform.eaaprovider.dev/eaaprovider/eaa/${VERSION_STR}/${PLUGIN_ARCH}
cp ./bin/terraform-provider-eaa ~/.terraform.d/plugins/terraform.eaaprovider.dev/eaaprovider/eaa/${VERSION_STR}/${PLUGIN_ARCH}
lint:
@echo run golangci-lint on project
if [ -z "$(GOLINTBIN)" ]; then \
echo "skipping golangci-lint on project"; \
else \
golangci-lint run --allow-parallel-runners ./...; \
fi
clean:
@rm -rf $(BINDIR)
# TESTS