-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (58 loc) · 1.96 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# # Some interesting links on Makefiles:
# https://danishpraka.sh/2019/12/07/using-makefiles-for-go.html
# https://tech.davis-hansson.com/p/make/
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
## install: compile the code and installs in binary in $GOPATH/bin
install:
> @go install
.PHONY: install
## build: compile the code
build:
> @go build
.PHONY: build
## ci: check before commiting, as we don't have a true CI yet
ci: install lint test cli
## serve: start the cozy-nextdb web server for local development
serve:
> @go run . serve --log-level=debug
.PHONY: serve
## work: start the cozy-nextdb workers for local development
work:
> @go run . work --dev --log-level=debug
.PHONY: work
## lint: enforce a consistent code style and detect code smells
lint: scripts/golangci-lint
> @scripts/golangci-lint run -E gofmt -E unconvert -E misspell -E whitespace -E bidichk -E gocritic -E bodyclose
.PHONY: lint
scripts/golangci-lint: Makefile
> @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./scripts v1.61.0
## cli: build the CLI documentation and shell completions
cli: install
> @rm -rf docs/cli/*
> @cozy-nextdb doc markdown docs/cli
> @cozy-nextdb completion bash > scripts/completion/cozy-nextdb.bash
> @cozy-nextdb completion zsh > scripts/completion/cozy-nextdb.zsh
> @cozy-nextdb completion fish > scripts/completion/cozy-nextdb.fish
.PHONY: cli
## test: run the automated tests
test:
> @go test -shuffle on -timeout 1m ./...
.PHONY: test
## clean: clean the generated files and directories
clean:
> @go clean
.PHONY: clean
## help: print this help message
help:
> @echo "Usage:"
> @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
.PHONY: help