######################################################################## # LICENSE: CC BY-SA # Copyleft: CodeASAP.pl # # Usage # make - cleanup and rebuild # make index - create index.html # make sitemaps - create xml and json index files # make build - cleanup and rebuild index files # make deploy - rsync everything (over ssh) # #----------------------------------------------------------------------- # Local development mode #------------------------------------------------------------------------ # make watch - observe changes and rebuild # make serve - start basic python webserver here ######################################################################## .NOTPARALLEL: backup index sitemaps TITLE ?= my-project TREE_OPTIONS = -T $(TITLE) -I backups -h -cD DATE = $(shell date +'%Y-%m-%d-%H:%M:%S') DEPLOYMENT_TARGET ?= me@server:~/blog all: clean build index: tree $(TREE_OPTIONS) -H . -t -D --prune . > index.html sitemaps: tree $(TREE_OPTIONS) -X . . > index.xml tree $(TREE_OPTIONS) -J . . > index.json build: clean index sitemaps deploy: backup build rsync -av . $(DEPLOYMENT_TARGET) backup: clean mkdir -p backups zip -x "backups/*" -r backups/$(DATE).zip . find backups/ -name "*.zip" -cmin -60 | xargs rm -rfv clean: find src/ -type d -name __pycache__ | xargs rm -rvf watch: while true; do inotifywait -r -e CREATE,DELETE,MOVE,MODIFY src docs; $(MAKE) build; done serve: python -m http.server 8000 --bind 127.0.0.1