mkfile (682B)
1 MKSHELL=rc 2 3 TARG = wmii.pdf 4 SRC = ${TARG:%.pdf=%.tex} 5 TEX = xelatex 6 7 default:V: all 8 all:V: $TARG 9 10 # mk doesn't recognize nested `{} 11 deps = `{ ash -c 'dep() { echo $1; for f in $(9 sed -n "s/.*\\include{([^}]+)}.*/\1.tex/p; s/.*\\input (.*)/\1.tex/p" $1); do dep $f; done; }; dep $SRC' } 12 # ` 13 $TARG: $deps 14 15 junk = aux idx ilg ind log toc out 16 CLEAN = ${TARG:%.pdf=%} 17 CLEAN = ${junk:%=$CLEAN.%} ${deps:%.tex=%.aux} 18 clean:V: 19 rm -f $CLEAN 20 21 %.pdf: %.tex mkfile 22 flag x + 23 if (~ $MAINFONT '') 24 fn tex { builtin $TEX $stem.tex } 25 if not 26 fn tex { builtin $TEX '\def\mainfont{'$"MAINFONT'}\input{'$stem.tex'}' } 27 28 tex 29 makeindex $stem 30 tex 31 rm -f $stem.out 2>/dev/null 32 33 # vim:se ft=make: