Commit Diff
Commit:
30f047cf5c2409df4fe2336dbeed17b2369a70f3
From:
Omar Polo <op@omarpolo.com>
Date:
Thu Aug 25 09:12:39 2022 UTC
Message:
simplify the makefile move the logic of the export to gotmarc, where it's easier to set up the correct env. While here improve the makefile to generate the images and the copy the style only if needed.
commit - 5778493904358a0a5e251212ad8f954178d5f1df
commit + 30f047cf5c2409df4fe2336dbeed17b2369a70f3
blob - 9e32bdbe3a5343243a7ce7a0574317151adfc551
blob + 47c39ba03650d0909968bfda409d8a74188565a8
--- Makefile
+++ Makefile
@@ -1,38 +1,36 @@
-ENV = MBLAZE=.mblaze OUTDIR='${OUTDIR}'
-MBLAZE_PAGER = cat
MDIR = ${HOME}/Maildir/op/GoT
OUTDIR = www
-.PHONY: all gzip dirs assets clean
+.PHONY: all assets images dirs gzip clean
-all: .mblaze dirs assets
- mlist '${MDIR}' | mthread -r | \
- ${ENV} mscan -f '%R %I %i %16D <%64f> %128S' | \
- ${ENV} ./pe | ${ENV} ./mkindex
+all: assets
+ env MDIR="${MDIR}" OUTDIR="${OUTDIR}" ./gotmarc
-gzip:
- gzip -fkr ${OUTDIR}/
+assets: dirs images ${OUTDIR}/style.css
-dirs:
- mkdir -p ${OUTDIR}/mail/
- mkdir -p ${OUTDIR}/mbox/
- mkdir -p ${OUTDIR}/parts/
- mkdir -p ${OUTDIR}/text/
- mkdir -p ${OUTDIR}/thread/
+images: ${OUTDIR}/got@2x.png ${OUTDIR}/got.png ${OUTDIR}/got-tiny@2x.png \
+ ${OUTDIR}/got-tiny.png
-assets: dirs got.png style.css
+${OUTDIR}/got@2x.png: got.png
cp got.png ${OUTDIR}/got@2x.png
+${OUTDIR}/got.png: got.png
convert got.png -resize 200x200 ${OUTDIR}/got.png
+${OUTDIR}/got-tiny@2x.png: got.png
convert got.png -resize 128x128 ${OUTDIR}/got-tiny@2x.png
+${OUTDIR}/got-tiny.png: got.png
convert got.png -resize 64x64 ${OUTDIR}/got-tiny.png
+${OUTDIR}/style.css: style.css
cp style.css ${OUTDIR}
-${OUTDIR}:
- mkdir -p '${OUTDIR}'
+dirs:
+ mkdir -p ${OUTDIR}/mail/
+ mkdir -p ${OUTDIR}/mbox/
+ mkdir -p ${OUTDIR}/parts/
+ mkdir -p ${OUTDIR}/text/
+ mkdir -p ${OUTDIR}/thread/
-.mblaze:
- mkdir -p .mblaze
- touch .mblaze/seq
+gzip:
+ gzip -fkr ${OUTDIR}/
clean:
rm -rf ${OUTDIR}
blob - /dev/null
blob + 8f82bbacadc5801e59d18cef7be2e127d2f6bbea (mode 755)
--- /dev/null
+++ gotmarc
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# set up the env
+export MAKE_JOBS="${MAKE_JOBS:-1}"
+export MBLAZE=.mblaze
+export MBLAZE_PAGER=cat
+export OUTDIR="${OUTDIR:-www}"
+
+: ${MDIR:?not defined}
+
+fmt='%R %I %i %16D <%64f> %128S'
+mlist "${MDIR}" | mthread -r | mscan -f "$fmt" | ./pe | ./mkindex
Omar Polo