| 1 | SITE_DOMAIN := 'https://shemshak.org' |
| 2 | SITE_PREFIX := '/~bandali' |
| 3 | SITE_URL := '$(SITE_DOMAIN)$(SITE_PREFIX)' |
| 4 | |
| 5 | SRC := $(filter-out $(wildcard meta_*), $(wildcard *.m4)) |
| 6 | OUTPUTS := $(patsubst %.m4,out/%.html, $(SRC)) |
| 7 | STATIC := $(patsubst static/%,out/%, $(filter-out static/GNUmakefile, $(wildcard static/* static/.*))) |
| 8 | |
| 9 | all: $(OUTPUTS) out/notes.atom out/notes.rss out/style.css out/GNUmakefile $(STATIC) |
| 10 | |
| 11 | out/%.html: %.m4 header.html footer.html |
| 12 | @mkdir -p $(@D) |
| 13 | m4 -D__d=$(SITE_DOMAIN) -D__p=$(SITE_PREFIX) $< > $@ |
| 14 | out/notes.%: meta_feed_%.m4 $(SRC) header.html footer.html |
| 15 | m4 -D__d=$(SITE_DOMAIN) -D__p=$(SITE_PREFIX) $< > $@ |
| 16 | sed -i 's|href="/\([^/]\)|href="$(SITE_DOMAIN)/\1|' $@ |
| 17 | out/GNUmakefile: GNUmakefile ; ln -s $(PWD)/$< $@ |
| 18 | $(STATIC): ; ln -s $(PWD)/static/$(@F) $@ |
| 19 | |
| 20 | # publications bibliography |
| 21 | static/publications-partial.html: static/bandali.bib static/bandali-bib-* |
| 22 | static/publications-partial.html: $(filter-out static/publications-partial.html, $(wildcard static/publications-*)) |
| 23 | static/publications-partial.html: |
| 24 | $(MAKE) -C $(@D) $(@F) |
| 25 | out/publications.html: static/publications-partial.html |
| 26 | out/bandali-bib.html: static/bandali-bib-partial.html |
| 27 | |
| 28 | clean: |
| 29 | rm -rf out/ |
| 30 | |
| 31 | deploy: |
| 32 | rsync -avzLP out/ bandali@shemshak.org:~/public_html/ |
| 33 | |
| 34 | watch: |
| 35 | while true; do \ |
| 36 | echo $(SRC) header.html footer.html \ |
| 37 | static/bandali.bib static/bandali-bib-* static/publications-* \ |
| 38 | GNUmakefile static/GNUmakefile | \ |
| 39 | tr " " "\n" | entr -d make; done |
| 40 | |
| 41 | .PHONY: deploy watch |