don't regenerate the feeds when non-note m4 files change
[~bandali/bndl.org] / GNUmakefile
... / ...
CommitLineData
1# GNUmakefile --- GNU Makefile for building my personal site
2
3# Copyright (C) 2020-2021 Amin Bandali <bandali@gnu.org>
4
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see
17# <https://www.gnu.org/licenses/>.
18
19
20SITE_DOMAIN := 'https://shemshak.org'
21SITE_PREFIX := '/~bandali'
22SITE_URL := '$(SITE_DOMAIN)$(SITE_PREFIX)'
23
24SRC := $(filter-out $(wildcard meta_*), $(wildcard *.m4))
25OUTPUTS := $(patsubst %.m4,out/%.html, $(SRC))
26STATIC := $(patsubst static/%,out/%, $(filter-out static/GNUmakefile, $(wildcard static/* static/.*)))
27NOTES := $(shell ./get-notes.sh)
28
29all: $(OUTPUTS) out/notes.atom out/notes.rss out/style.css out/GNUmakefile $(STATIC)
30
31out/%.html: %.m4 header.html footer.html
32 @mkdir -p $(@D)
33 m4 -D__d=$(SITE_DOMAIN) -D__p=$(SITE_PREFIX) $< > $@
34out/notes.%: meta_feed_%.m4 $(NOTES) header.html footer.html
35 m4 -D__d=$(SITE_DOMAIN) -D__p=$(SITE_PREFIX) $< > $@
36 sed -i 's|href="/\([^/]\)|href="$(SITE_DOMAIN)/\1|' $@
37 sed -i 's|href="//|href="https://|' $@
38out/GNUmakefile: GNUmakefile ; ln -s $(PWD)/$< $@
39$(STATIC): ; ln -s $(PWD)/static/$(@F) $@
40
41# publications bibliography
42static/publications-partial.html: static/bandali.bib static/bandali-bib-*
43static/publications-partial.html: $(filter-out static/publications-partial.html, $(wildcard static/publications-*))
44static/publications-partial.html:
45 $(MAKE) -C $(@D) $(@F)
46out/publications.html: static/publications-partial.html
47out/bandali-bib.html: static/bandali-bib-partial.html
48
49clean:
50 rm -rf out/
51
52deploy:
53 rsync -avzLP out/ bandali@shemshak.org:~/public_html/
54
55watch:
56 while true; do \
57 echo $(SRC) header.html footer.html \
58 static/bandali.bib static/bandali-bib-* static/publications-* \
59 GNUmakefile static/GNUmakefile | \
60 tr " " "\n" | entr -d make; done
61
62.PHONY: deploy watch