build: Fix on OpenBSD. TIL awk.

This commit is contained in:
Cory McWilliams 2024-11-27 09:06:02 -05:00
parent aa40084010
commit 50fef2edfa

View File

@ -3,7 +3,7 @@
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
## == Tilde Friends makefile build. ==
## == Tilde Friends build. ==
##
## This is a list of all supported build targets.
##
@ -1245,9 +1245,12 @@ clean: ## Clean all generated files from the out/ directory.
## Documentation:
##
help: ## Display this help message.
@awk -F: ' \
/^##/ { sub(/^##\s?/, ""); print $$0 } \
/^\w+: .*##/ { sub(/^/, ""); sub(/:.*##\s?/, ":"); printf "%-32s %s\n", $$1, $$2 } \
@awk \
-F: \
-vG=$$(tput setaf 2) \
-vR=$$(tput sgr0) ' \
/^##/ { sub(/^##\s?/, ""); printf "%s%s%s\n", G, $$0, R } \
/^[[:alnum:]-]+:.*##/ { sub(/:.*##\s?/, ":"); printf "%s%-20s%s %s\n", G, $$1, R, $$2 } \
' < $(filter-out %.d,$(MAKEFILE_LIST))
@echo "" # Blank line.
.PHONY: help