From af52a71c9b2d6d66ff00fb39386d8d7a5330b2b0 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 19 May 2022 11:49:53 -0500 Subject: Initial commit I'm doing content + generation in this ... who knows if it's smart, lol. --- Makefile | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5b3cadd --- /dev/null +++ b/Makefile @@ -0,0 +1,88 @@ +## HAT TRICK -*- tab-width: 8; -*- +# (C) 2022 C. Duckworth + +UPLOAD_TARGET = hetzner:/var/www/acdw.casa/ + +SITE_TITLE = acdw.casa + +INPUT = src +BUILD = build +LASTB = .last_build + +HTAWK = ./ht.awk +HTSH = ./ht.sh +HTMK = ht.mk +HT = ${HTAWK} ${HTSH} ${HTMK} + +T = .tmp +TMK = $T/mk +TPG = $T/ps + +PTMPL = tmpl.page.htm +PTMPC = \ + $$(title) \ + $$(body) +PTMPR = \ + $$hb: $$ht ; \ + ${HTAWK} < '$$ht' | \ + env HTTMP='$T' HTENV='$T/\$$<.env' HTOUT='\$$@' \ + ${HTSH} '${PTMPL}' > '\$$@' + +ITMPL = tmpl.index.htm +ITMPC = \ + ${SITE_TITLE} \ + +ITMPR = \ + index.html: ${ITMPL} $$(cat ${TPG}); \ + env HTTMP='$T' HTOUT='\$$@' \ + ${HTSH} "${ITMPL}" < /dev/null > '\$$@' + +TMPL = ${PTMPL} ${ITMPL} +BUILD_INPUTS = ${INPUT}/* ${TMPL} ${HT} + +${BUILD}: ${BUILD_INPUTS} + @touch ${LASTB} + @mkdir -p ${BUILD} + cp -a ${BUILD_INPUTS} $@ + ${MAKE} -C $@ -f ${HTMK} build + +${HTMK}: Makefile ${INPUT}/*.ht $T + @printf '%s' 'Generating "$@"...' + @: > '$@' + @: > '${TPG}' + + @for ht in $$(find ${INPUT} -type f -name '*.ht'); do \ + ht="$$(echo "$$ht" | sed 's#${INPUT}/##')"; \ + hb="$${ht}ml"; \ + printf '%s ' "$$hb" >> "${TPG}"; \ + printf '%s\n' "${PTMPR}"; \ + done >> '$@' + + @printf '%s\n' "${ITMPR}" >> '$@' + @printf "build: $$(cat ${TPG}) index.html" >> '$@' + @printf '%s\n' 'done' + +$T: ; mkdir -p "$@" +${PTMPL}: ; printf '${PTMPC}' > '$@' +${ITMPL}: ; printf '${ITMPC}' > '$@' + +.PHONY: clean clean-build nuke +clean: ; -rm -rf ${BUILD} ${HTMK} $T ${LASTB} +clean-build: + rm -rf '${BUILD}/$T' + for file in ${BUILD}/*; do \ + case "$$file" in \ + *.ht|*.sh|*.htm|*.mk|*.awk) rm -rf "$$file" ;; \ + esac \ + done +nuke: clean ; -rm ${TMPL} + +.PHONY: publish +publish: build clean-build + scp -r ${BUILD}/* '${UPLOAD_TARGET}'; \ + -- cgit 1.4.1-21-gabe81