2013-05-15 23:03:52 -04:00
|
|
|
# Builds thoughts (well, not quite like that)
|
|
|
|
#
|
2019-01-08 00:11:20 -05:00
|
|
|
# Copyright (C) 2013, 2018, 2019 Mike Gerwitz
|
2013-05-15 23:03:52 -04:00
|
|
|
#
|
2019-01-08 00:11:20 -05:00
|
|
|
# This program is free software: you can rewww-ribute it and/or modify
|
2013-05-15 23:03:52 -04:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2019-01-08 00:11:20 -05:00
|
|
|
# This program is www-ributed in the hope that it will be useful,
|
2013-05-15 23:03:52 -04:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2019-01-08 00:11:20 -05:00
|
|
|
#
|
|
|
|
# This project is a static site generator. This Makefile was written to
|
|
|
|
# have deep knowledge of every aspect of the site so that it can be
|
|
|
|
# incrementally built, and so that all relevant portions will be properly
|
|
|
|
# rebuilt any time something changes.
|
|
|
|
#
|
|
|
|
# Source files are automatically identified through either wildcards or
|
|
|
|
# Makefile generation with one important exception: things in src/. The
|
|
|
|
# reason is that src/ contains a number of things we don't want published,
|
|
|
|
# and the distinction is too messy to codify. Of course, another option is
|
|
|
|
# to clean that up, but I don't mind being explicit for now.
|
|
|
|
##
|
|
|
|
|
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
|
|
|
|
postsrc := $(wildcard post/*.md)
|
|
|
|
pmeta := $(postsrc:.md=.meta)
|
|
|
|
phtml := $(postsrc:.md=.html)
|
|
|
|
pmk := $(pmeta:.meta=.mk)
|
|
|
|
|
|
|
|
www-root = www-root
|
|
|
|
|
|
|
|
# articles in TeX
|
|
|
|
texticles = $(wildcard papers/*/)
|
|
|
|
www-paper = $(patsubst papers/%/, $(www-root)/papers/%.pdf, $(texticles)) \
|
|
|
|
$(patsubst papers/%/, $(www-root)/papers/%.dvi, $(texticles))
|
|
|
|
|
|
|
|
images = $(wildcard images/*.*) $(wildcard images/tp/*.*)
|
|
|
|
www-images = $(patsubst images/%, $(www-root)/images/%, $(images))
|
|
|
|
|
|
|
|
cssfonts := $(shell build-aux/lsfonts)
|
|
|
|
www-fonts := $(patsubst fonts/%, $(www-root)/fonts/%, $(cssfonts))
|
|
|
|
|
|
|
|
# Manually maintain both for simplicity and to ensure something does not get
|
|
|
|
# unintentionally published.
|
|
|
|
srcpages = src/index.html src/about.html src/papers.html src/posts.html \
|
|
|
|
src/talks.html src/404.html src/about/inside.html \
|
|
|
|
src/about/githubbub.html \
|
|
|
|
src/about/resume.html $(wildcard src/about/resume/*)
|
|
|
|
www-pages = $(patsubst src/%, $(www-root)/%, $(srcpages))
|
|
|
|
|
|
|
|
www-files = $(www-pages) $(www-root)/style.css $(www-root)/rss.xml $(www-paper) \
|
2019-01-09 00:46:17 -05:00
|
|
|
$(www-images) $(www-fonts) $(www-root)/redirect-map.php
|
2019-01-08 00:11:20 -05:00
|
|
|
|
|
|
|
RSS_N=10
|
|
|
|
export WWW_URL
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: default clean webroot
|
2013-05-26 21:01:07 -04:00
|
|
|
|
|
|
|
default: www-root
|
|
|
|
|
2019-01-08 00:11:20 -05:00
|
|
|
%.meta: %.html src/post2meta src/post2html
|
|
|
|
src/post2meta $< > $@
|
|
|
|
src/talks.html: src/talks.rec
|
|
|
|
src/papers.html: src/papers.rec
|
|
|
|
%.html %.xml: %.sh post/list src/mkheader src/header.tpl.htm src/footer.tpl.htm $(phtml)
|
|
|
|
$< > $@
|
|
|
|
%.html: %.md src/post2html src/mkheader src/h12title src/header.tpl.htm src/footer.tpl.htm src/pandoc.tpl
|
|
|
|
src/post2html $< > $@
|
|
|
|
%.html: %.htm src/mkheader src/h12title src/header.tpl.htm src/footer.tpl.htm
|
|
|
|
src/mkheader about @__PAGE_TITLE__@ \
|
|
|
|
| cat - $< src/footer.tpl.htm \
|
|
|
|
| src/h12title @__PAGE_TITLE__@ \
|
|
|
|
> $@
|
|
|
|
|
|
|
|
# special outputs
|
|
|
|
src/rss.xml: src/rss.sh post/list $(phtml)
|
|
|
|
head -n$(RSS_N) post/list | xargs $< > $@
|
|
|
|
|
|
|
|
posts: $(pmeta) $(phtml)
|
|
|
|
post/list: $(pmeta)
|
|
|
|
ls post/*.meta | sort -rn > $@
|
|
|
|
|
|
|
|
# Rules for generating the final webroot from the posts are themselves
|
|
|
|
# generated. This also appends dependencies to www-posts.
|
|
|
|
.PHONY: www-posts
|
|
|
|
post/%.mk: post/%.meta build-aux/mkmk
|
|
|
|
build-aux/mkmk $(www-root) $< > $@
|
|
|
|
|
|
|
|
# Note the conditional include only for webroot. This is needed for two
|
|
|
|
# reasons:
|
|
|
|
# 1. To avoid including them on `clean' (see GNU Make manual, which is
|
|
|
|
# where this snippet originated from); and
|
|
|
|
# 2. Because otherwise including the makefiles causes every pmete to be
|
|
|
|
# built, which is unnecessary for all but `webroot'.
|
|
|
|
#
|
|
|
|
# The alternative (and perhaps more proper means) to #2 would be to run mkmk
|
|
|
|
# as part of the meta target. This was originally done until a solution to
|
|
|
|
# `clean' was needed; this handles both situations well.
|
|
|
|
ifeq ($(MAKECMDGOALS),webroot)
|
|
|
|
include $(pmk)
|
|
|
|
endif
|
|
|
|
|
|
|
|
webroot: www-posts $(www-files)
|
|
|
|
$(www-root)/style.css: style.css
|
|
|
|
install -Dma+r $< $@
|
|
|
|
$(www-root)/%: src/%
|
|
|
|
install -Dma+r $< $@
|
|
|
|
$(www-root)/fonts/%: fonts/%
|
|
|
|
install -Dma+r $< $@
|
|
|
|
$(www-root)/papers/%: papers/%
|
|
|
|
install -Dma+r $< $@
|
|
|
|
$(www-root)/images/%: images/%
|
|
|
|
install -Dma+r $< $@
|
|
|
|
|
|
|
|
|
|
|
|
# TeX papers are expected to have their own Makefiles as well as an abstract.tex
|
|
|
|
papers/%.pdf: papers/%/abstract.tex
|
|
|
|
$(MAKE) -C $(dir $<) pdf
|
|
|
|
cp $(dir $<)/$*.pdf $@
|
|
|
|
papers/%.dvi: papers/%/abstract.tex
|
|
|
|
$(MAKE) -C $(dir $<) dvi
|
|
|
|
cp $(dir $<)/$*.dvi $@
|
2013-06-03 22:28:55 -04:00
|
|
|
|
2013-06-04 22:27:02 -04:00
|
|
|
docs/papers/.list: thoughts articles
|
|
|
|
echo "$(articles) $(texticles)" | tr ' ' '\n' | tools/doclist >$@
|
2013-05-26 21:01:07 -04:00
|
|
|
|
2013-05-15 22:59:51 -04:00
|
|
|
clean:
|
2019-01-08 00:11:20 -05:00
|
|
|
rm -rf $(www-root) $(pmeta) $(phtml) $(pmk)
|