From 8935d6f3a905d3888863af9fcdee9db42fd736ba Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 25 Jun 2024 13:34:32 -0700 Subject: [PATCH] Self-documenting makefile --- Makefile | 15 +++++++++------ flake.nix | 7 +------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 5e057f0..931cf53 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,26 @@ .PHONY: * -build: +help: ## display this help + @awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m \033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST) + +build: ## compile src/ into out/ with pagefind ./build.py out/ --draft pagefind --site out/ -clean: +clean: ## delete out/ and src/ test -e out && rm -rf out || true test -e srv && rm -rf srv || true -watch: +watch: ## rebuild on changes while inotifywait -r -e modify -e move -e create -e delete build.py Makefile src/; do make build; done -serve: +serve: ## serve out/ python -m http.server --directory out/ -pubdate: +pubdate: ## Replace "pubdate: now" with the current date sed -i "s/pubdate: now/pubdate: $$(date -Isec)/" src/blog/**/*.md -upload: +upload: ## build to srv/ and upload to www.alogoulogoi.com test -e srv && rm -rf srv || true ./build.py srv/ pagefind --site srv/ diff --git a/flake.nix b/flake.nix index cb4d9d8..6d63afc 100644 --- a/flake.nix +++ b/flake.nix @@ -23,12 +23,7 @@ pkgs.pagefind ]; shellHook = '' - echo "make build - compile src/ into out/ with pagefind" - echo "make clean - delete out/ and srv/" - echo "make watch - rebuild on changes" - echo "make serve - serve out/" - echo "make pubdate - replace 'now' with the current date" - echo "make upload - build to srv/ and upload to alogoulogoi" + make help ''; }; };