-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
37 lines (25 loc) · 1.11 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
NAME=oauth-sample
# Set the build dir, where built cross-compiled binaries will be output
BUILDDIR := bin
# VERSION defines the project version for the bundle.
VERSION ?= 0.0.1
# List the GOOS and GOARCH to build
GO_LDFLAGS_STATIC="-s -w $(CTIMEVAR) -extldflags -static"
.DEFAULT_GOAL := help
##@ Build
build: ## Builds a single binary given the current OS
go build -o $(NAME) ./...
##@ Testing
test: lint ## Lints Krok then runs all tests
go test -count=1 ./...
clean: ## Runs go clean
go clean -i
lint: ## Runs golangci-lint on crd
golangci-lint run ./...
##@ Utilities
help: ## Display this help. Thanks to https://www.thapaliya.com/en/writings/well-documented-makefiles/
ifeq ($(OS),Windows_NT)
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make <target>\n"} /^[a-zA-Z_-]+:.*?##/ { printf " %-40s %s\n", $$1, $$2 } /^##@/ { printf "\n%s\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
else
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-40s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
endif