add note about my Jami talk at LibrePlanet 2021
[~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/.*)))
27
28all: $(OUTPUTS) out/notes.atom out/notes.rss out/style.css out/GNUmakefile $(STATIC)
29
30out/%.html: %.m4 header.html footer.html
31 @mkdir -p $(@D)
32 m4 -D__d=$(SITE_DOMAIN) -D__p=$(SITE_PREFIX) $< > $@
33out/notes.%: meta_feed_%.m4 $(SRC) header.html footer.html
34 m4 -D__d=$(SITE_DOMAIN) -D__p=$(SITE_PREFIX) $< > $@
35 sed -i 's|href="/\([^/]\)|href="$(SITE_DOMAIN)/\1|' $@
36 sed -i 's|href="//|href="https://|' $@
37out/GNUmakefile: GNUmakefile ; ln -s $(PWD)/$< $@
38$(STATIC): ; ln -s $(PWD)/static/$(@F) $@
39
40# publications bibliography
41static/publications-partial.html: static/bandali.bib static/bandali-bib-*
42static/publications-partial.html: $(filter-out static/publications-partial.html, $(wildcard static/publications-*))
43static/publications-partial.html:
44 $(MAKE) -C $(@D) $(@F)
45out/publications.html: static/publications-partial.html
46out/bandali-bib.html: static/bandali-bib-partial.html
47
48clean:
49 rm -rf out/
50
51deploy:
52 rsync -avzLP out/ bandali@shemshak.org:~/public_html/
53
54watch:
55 while true; do \
56 echo $(SRC) header.html footer.html \
57 static/bandali.bib static/bandali-bib-* static/publications-* \
58 GNUmakefile static/GNUmakefile | \
59 tr " " "\n" | entr -d make; done
60
61.PHONY: deploy watch