1
0
Fork 0

Self-documenting makefile

This commit is contained in:
Tim Van Baak 2024-06-25 13:34:32 -07:00
parent 9355856dc4
commit 8935d6f3a9
2 changed files with 10 additions and 12 deletions

View File

@ -1,23 +1,26 @@
.PHONY: * .PHONY: *
build: help: ## display this help
@awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m <target>\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 ./build.py out/ --draft
pagefind --site out/ pagefind --site out/
clean: clean: ## delete out/ and src/
test -e out && rm -rf out || true test -e out && rm -rf out || true
test -e srv && rm -rf srv || 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 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/ 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 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 test -e srv && rm -rf srv || true
./build.py srv/ ./build.py srv/
pagefind --site srv/ pagefind --site srv/

View File

@ -23,12 +23,7 @@
pkgs.pagefind pkgs.pagefind
]; ];
shellHook = '' shellHook = ''
echo "make build - compile src/ into out/ with pagefind" make help
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"
''; '';
}; };
}; };