blog make help

A useful I found from a gist that I have been using recently # COLORS GREEN := $(shell tput -Txterm setaf 2) YELLOW := $(shell tput -Txterm setaf 3) WHITE := $(shell tput -Txterm setaf 7) RESET := $(shell tput -Txterm sgr0) TARGET_MAX_CHAR_NUM=20 ## Show help help: @echo '' @echo 'Usage:' @echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}' @echo '' @echo 'Targets:' @awk '/^[a-zA-Z\-\_0-9]+:/ { \ helpMessage = match(lastLine, /^## (.*)/); \ if (helpMessage) { \ helpCommand = substr($$1, 0, index($$1, ":")-1); \ helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ } \ } \ { lastLine = $$0 }' $(MAKEFILE_LIST) Which allows you to add a make help command to your Makefiles

Read More →

blog Auto Cleanup

Taking advantage of cron and the rmtrash tool from homebrew, I often setup several simple cron entries to automatically move old files to Trash @hourly find ~/Downloads -mindepth 1 -maxdepth 1 -mtime +7d -exec /usr/local/bin/rmtrash '{}' \;