mirror of
https://github.com/foomo/squadron.git
synced 2025-10-16 12:35:42 +00:00
60 lines
1.2 KiB
Makefile
60 lines
1.2 KiB
Makefile
.DEFAULT_GOAL:=help
|
|
|
|
export PROJECT_ROOT=$(PWD)
|
|
|
|
## === Tasks ===
|
|
|
|
.PHONY: list
|
|
## Show config
|
|
list:
|
|
@go run ../../cmd/main.go list
|
|
|
|
.PHONY: config
|
|
## Show config
|
|
config:
|
|
@go run ../../cmd/main.go config
|
|
|
|
.PHONY: build
|
|
## Show config
|
|
build:
|
|
@go run ../../cmd/main.go build
|
|
|
|
.PHONY: template
|
|
## Show config
|
|
template:
|
|
@go run ../../cmd/main.go template
|
|
|
|
## === Utils ===
|
|
|
|
## Show help text
|
|
help:
|
|
@awk '{ \
|
|
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
|
|
helpCommand = substr($$0, index($$0, ":") + 2); \
|
|
if (helpMessage) { \
|
|
printf "\033[36m%-23s\033[0m %s\n", \
|
|
helpCommand, helpMessage; \
|
|
helpMessage = ""; \
|
|
} \
|
|
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
|
|
helpCommand = substr($$0, 0, index($$0, ":")); \
|
|
if (helpMessage) { \
|
|
printf "\033[36m%-23s\033[0m %s\n", \
|
|
helpCommand, helpMessage"\n"; \
|
|
helpMessage = ""; \
|
|
} \
|
|
} else if ($$0 ~ /^##/) { \
|
|
if (helpMessage) { \
|
|
helpMessage = helpMessage"\n "substr($$0, 3); \
|
|
} else { \
|
|
helpMessage = substr($$0, 3); \
|
|
} \
|
|
} else { \
|
|
if (helpMessage) { \
|
|
print "\n "helpMessage"\n" \
|
|
} \
|
|
helpMessage = ""; \
|
|
} \
|
|
}' \
|
|
$(MAKEFILE_LIST)
|