diff options
author | defanor <defanor@uberspace.net> | 2023-09-10 17:09:59 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2023-09-10 17:09:59 +0300 |
commit | 9b7934e51dbc04e6908f05b223e5b775ae0a2de2 (patch) | |
tree | 54ab14a6a8aca7e008469b21c9fe98f0d0d2ae3f | |
parent | 00445262469de2eac7908dfbd5318b67a4345a6e (diff) |
Use make for building
Still generating a dump out of all the files in order to build indexes
afterwards, but this change will help to avoid unnecessary
modification and reupload of notes that were not modified.
-rw-r--r-- | tools/Makefile | 43 | ||||
-rwxr-xr-x | tools/publish.sh | 35 |
2 files changed, 44 insertions, 34 deletions
diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000..0ea8525 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,43 @@ +all: $(patsubst src/%,%,$(wildcard src/notes/*.xhtml src/*.xhtml)) \ + notes/atom.xml + +# Index page +index.xhtml: src/index.xhtml build/notes-by-modification-date.xml + xsltproc -o $@ tools/xml-to-html.xsl $< + +# Note index page +notes/index.xhtml: src/notes/index.xhtml build/notes-by-publication-date.xml + xsltproc -o $@ tools/xml-to-html.xsl $< + +# Notes +notes/%.xhtml: src/notes/%.xhtml + xsltproc -o $@ tools/xml-to-html.xsl $< + +# Other static pages +%.xhtml: src/%.xhtml + xsltproc -o $@ tools/xml-to-html.xsl $< + +# A single-file dump of all notes +build/notes-dump.xml: src/notes/*.xhtml + (echo '<?xml version="1.0" encoding="UTF-8"?>' && \ + echo '<notes>' && \ + find src/notes -name '*.xhtml' | \ + grep -v index.xhtml | \ + sed -e "sS^src/\(.*\)S <note src=\"\\1\" />S" && \ + echo '</notes>') | \ + xsltproc -o $@ tools/xml-notes-dump.xsl - + +# Notes sorted by publication date +build/notes-by-publication-date.xml: build/notes-dump.xml + xsltproc -o $@ tools/xml-notes-sort.xsl build/notes-dump.xml + +# Notes sorted by modification date +build/notes-by-modification-date.xml: build/notes-dump.xml + xsltproc -o $@ --stringparam sortBy modified \ + tools/xml-notes-sort.xsl build/notes-dump.xml + +# An Atom feed +notes/atom.xml: build/notes-by-modification-date.xml + xsltproc --param number 10 tools/xml-notes-limit.xsl \ + build/notes-by-modification-date.xml | \ + xsltproc -o $@ tools/xml-notes-to-atom.xsl - diff --git a/tools/publish.sh b/tools/publish.sh index 90ed8e2..987cf00 100755 --- a/tools/publish.sh +++ b/tools/publish.sh @@ -1,39 +1,6 @@ #!/bin/sh -BASEDIR=~/homepage -TOOLS="${BASEDIR}/tools" -BUILD="${BASEDIR}/build" -ATOM="${BASEDIR}/notes/atom.xml" -SOURCES="${BASEDIR}/src" -NOTES="${SOURCES}/notes" - - -# dump all the notes into a single file -(echo '<?xml version="1.0" encoding="UTF-8"?>' && - echo '<notes>' && - find "${NOTES}" -name '*.xhtml' | - grep -v index.xhtml | - sed -e "sS^${SOURCES}/\(.*\)S <note src=\"\\1\" />S" && - echo '</notes>') | - xsltproc -o "${BUILD}/notes-dump.xml" "${TOOLS}/xml-notes-dump.xsl" - - -# sort by publication and modification dates -xsltproc -o "${BUILD}/notes-by-publication-date.xml" \ - "${TOOLS}/xml-notes-sort.xsl" "${BUILD}/notes-dump.xml" -xsltproc -o "${BUILD}/notes-by-modification-date.xml" \ - --stringparam sortBy modified \ - "${TOOLS}/xml-notes-sort.xsl" "${BUILD}/notes-dump.xml" - -# create an atom feed with the most recently modified 10 entries -xsltproc --param number 10 "${TOOLS}/xml-notes-limit.xsl" \ - "${BUILD}/notes-by-modification-date.xml" | - xsltproc -o "${ATOM}" "${TOOLS}/xml-notes-to-atom.xsl" - - -# convert sources into XHTML -find "${SOURCES}" -name '*.xhtml' | - sed -e "sS^${SOURCES}SS" | - xargs -Ifile xsltproc -o "${BASEDIR}/file" \ - "${TOOLS}/xml-to-html.xsl" "${SOURCES}file" +make -f tools/Makefile # upload rsync --exclude '.*' --exclude '*.org' --exclude 'src/' \ |