-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (53 loc) · 1.62 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
##@ All shortcut collections(generates code, install tools, etc...) for app script.
##@
##@ [Set up commands]
##@
setup: ##@ Set up develop. Install all tools
-@go work init . tools
make install-tools
##@
##@ [Generates files commands]
##@
gen: ##@ Generates all files(oapi, sqlc and tbls).
make gen-oapi
make gen-sqlc
make gen-tbls
gen-oapi: ##@ Generates backend code defined by open api with oapi-code-gen
go generate --tags oapi ./...
gen-sqlc: ##@ Generates backend queries with sqlc.
go generate --tags sqlc ./...
gen-tbls: ##@ Generates db schema docs with tbls.
go generate --tags tbls ./...
##@
##@ [Install tools commands]
##@
install-tools: ##@ Install all tools for this app.
make install-tools-go
make install-tools-tbls
make install-tools-redoc ## Install all tools for this app.
install-tools-go: ##@ Install tools via go install tool.
go install tool
install-tools-tbls: ##@ Install tbls.
export TBLS_VERSION=1.81.0
curl -o tbls.deb -L https://github.com/k1LoW/tbls/releases/download/v$(TBLS_VERSION)/tbls_$(TBLS_VERSION)-1_arm64.deb
sudo dpkg -i tbls.deb
rm tbls.deb
install-tools-redoc: ##@ Install redoc.
npm i -g @redocly/cli@1.29.0
##@
##@ [Misc commands]
##@
help: ##@ (Default) Show helps.
@printf "\nUsage: make <command>\n"
@grep -F -h "##@" $(MAKEFILE_LIST) | grep -F -v grep -F | sed -e 's/\\$$//' | awk 'BEGIN {FS = ":*[[:space:]]*##@[[:space:]]*"}; \
{ \
if($$2 == "") \
pass; \
else if($$0 ~ /^#/) \
printf "\n%s\n", $$2; \
else if($$1 == "") \
printf " %-20s%s\n", "", $$2; \
else \
printf "\n \033[34m%-20s\033[0m %s\n", $$1, $$2; \
}'
.DEFAULT_GOAL := help