Created
March 26, 2025 15:42
-
-
Save kborovik/0290597a9d09814a019e70649362c9f7 to your computer and use it in GitHub Desktop.
Makefile help
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.EXPORT_ALL_VARIABLES: | |
.ONESHELL: | |
.SILENT: | |
MAKEFLAGS += --no-builtin-rules --no-builtin-variables | |
default: help | |
############################################################################### | |
# Git Management | |
############################################################################### | |
commit: ## Commit Changes | |
git commit -m "$(shell date +%Y.%m.%d-%H%M)" | |
############################################################################### | |
# Colors and Headers | |
############################################################################### | |
TERM := xterm-256color | |
black := $$(tput setaf 0) | |
red := $$(tput setaf 1) | |
green := $$(tput setaf 2) | |
yellow := $$(tput setaf 3) | |
blue := $$(tput setaf 4) | |
magenta := $$(tput setaf 5) | |
cyan := $$(tput setaf 6) | |
white := $$(tput setaf 7) | |
reset := $$(tput sgr0) | |
define header | |
echo "$(blue)==> $(1) <==$(reset)" | |
endef | |
define var | |
echo "$(magenta)$(1)$(white): $(yellow)$(2)$(reset)" | |
endef | |
help: | |
echo "$(blue)Usage: $(green)make [recipe]$(reset)" | |
echo "$(blue)Recipes:$(reset)" | |
awk 'BEGIN {FS = ":.*?## "; sort_cmd = "sort"} /^[a-zA-Z0-9_-]+:.*?## / \ | |
{ printf " \033[33m%-15s\033[0m %s\n", $$1, $$2 | sort_cmd; } \ | |
END {close(sort_cmd)}' $(MAKEFILE_LIST) | |
prompt: | |
printf "$(magenta)Continue $(white)? $(cyan)(yes/no)$(reset)" | |
read -p ": " answer && [ "$$answer" = "yes" ] || exit 127 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment