77 lines
2.5 KiB
Plaintext
77 lines
2.5 KiB
Plaintext
# TeX compilation takes a lot of resources and can hang a system, only do about
|
|
# 4 at a time
|
|
pool tex_pool
|
|
depth = 4
|
|
|
|
# uncomment restats when ninja stops segfaulting when you do so -.- (ninja; touch legs.yaml; ninja)
|
|
|
|
# TODO: clean up the output directory by messing with this and configure.jq
|
|
# hide all json/tex/etc in hidden files?
|
|
|
|
rule template2tex
|
|
description = convert $in to $out using $template as a template
|
|
command = gomplate --left-delim '«' --right-delim '»' -c .=$in < $template > $out
|
|
|
|
rule cuegen
|
|
description = run cue on $in to produce $out
|
|
command = cue export $in | bash update.sh $out
|
|
# restat = 1
|
|
|
|
rule extract
|
|
description = extract $out from $in via jq filter $filter
|
|
command = jq -c $filter < $in | bash update.sh $out
|
|
# restat = 1
|
|
|
|
rule tex2pdf
|
|
description = render tex from $in to $out
|
|
command = $
|
|
xelatex $
|
|
-interaction=batchmode $
|
|
-halt-on-error $
|
|
--shell-escape $
|
|
--output-directory=$$(dirname $out) $in >/dev/null $
|
|
&& [ $$(basename -s .tex $in) = $$(basename -s .pdf $out) ] $
|
|
|| mv $$(dirname $out)/$$(basename -s .tex $in).pdf $out
|
|
pool = tex_pool
|
|
|
|
rule tex2pdf2x
|
|
description = render tex from $in to $out twice (for toc)
|
|
command = $
|
|
xelatex $
|
|
-interaction=batchmode $
|
|
-halt-on-error $
|
|
--shell-escape $
|
|
--output-directory=$$(dirname $out) $in >/dev/null $
|
|
&& xelatex $
|
|
-interaction=batchmode $
|
|
-halt-on-error $
|
|
--shell-escape $
|
|
--output-directory=$$(dirname $out) $in >/dev/null $
|
|
&& { [ $$(basename -s .tex $in) = $$(basename -s .pdf $out) ] $
|
|
|| mv $$(dirname $out)/$$(basename -s .tex $in).pdf $out; }
|
|
pool = tex_pool
|
|
|
|
rule scantex
|
|
description = scan tex $in for dependencies
|
|
command = bash scantex.sh $in $target > $out
|
|
|
|
rule pdf2png
|
|
description = convert pdf $in to png $out with size $w by $h
|
|
command = pdftoppm -scale-to-x $w -scale-to-y $h -png $in > $out
|
|
|
|
rule convert
|
|
description = run ImageMagick convert on $in with args $args to $out
|
|
command = magick $in $args $out
|
|
|
|
rule copy
|
|
description = copy $in to $out
|
|
command = cp $in $out
|
|
|
|
rule pdfunite
|
|
description = unite pdfs to create $out
|
|
command = $
|
|
pdfunite $in $out $
|
|
&& pdfjam --nup 3x3 $out $
|
|
--no-landscape --delta '0.5cm 0.5cm' --scale 0.9 $
|
|
-o $$(dirname $out)/$$(basename -s .pdf $out)-mini.pdf >/dev/null 2>&1
|