1 # GNUmakefile --- GNU Makefile for building my personal site
3 # Copyright (C) 2020-2021 Amin Bandali <bandali@gnu.org>
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.
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.
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/>.
20 SITE_DOMAIN
:= 'https://shemshak.org'
21 SITE_PREFIX
:= '/~bandali'
22 SITE_URL
:= '$(SITE_DOMAIN)$(SITE_PREFIX)'
24 SRC
:= $(filter-out $(wildcard meta_
*), $(wildcard *.m4
))
25 OUTPUTS
:= $(patsubst %.m4
,out
/%.html
, $(SRC
))
26 STATIC
:= $(patsubst static
/%,out
/%, $(filter-out static
/GNUmakefile
, $(wildcard static
/* static
/.
*)))
27 NOTES
:= $(shell .
/get-notes.sh
)
29 all: $(OUTPUTS
) out
/notes.atom out
/notes.rss out
/style.css out
/GNUmakefile
$(STATIC
)
31 out
/%.html
: %.m4 header.html footer.html
33 m4
-D__d
=$(SITE_DOMAIN
) -D__p
=$(SITE_PREFIX
) $< > $@
34 out
/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://|' $@
38 out
/GNUmakefile
: GNUmakefile
; ln
-s
$(PWD
)/$< $@
39 $(STATIC
): ; ln
-s
$(PWD
)/static
/$(@F
) $@
41 # publications bibliography
42 static
/publications-partial.html
: static
/bandali.bib static
/bandali-bib-
*
43 static
/publications-partial.html
: $(filter-out static
/publications-partial.html
, $(wildcard static
/publications-
*))
44 static
/publications-partial.html
:
45 $(MAKE
) -C
$(@D
) $(@F
)
46 out
/publications.html
: static
/publications-partial.html
47 out
/bandali-bib.html
: static
/bandali-bib-partial.html
53 rsync
-avzLP out
/ bandali@shemshak.org
:~
/public_html
/
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