chiark / gitweb /
break out bag pgm processing
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 Oct 2021 19:40:55 +0000 (20:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 Oct 2021 19:40:55 +0000 (20:40 +0100)
Makefile

index 3ee9600450d47ae804511fc0e257c7d142b04c22..5f1102c726aa33edbf200200981d794d4189d594 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,10 @@ all:   pumpkin-books.pdf
 
 # Don't print the ps, printers (eg ours!) don't always have the fonts
 
+use_rsvg=rsvg-convert -f png -o $@.tmp.png $<
+shell_pipe=set -o pipefail; set -e;
+make_pgm = pnmdepth 255 | pnmnoraw >$@.tmp.new; mv -f $@.tmp.new $@
+
 pumpkin-books.ps: pumpkin-books.ps.pl bag.pgm
        ./$< >$@.new && mv -f $@.new $@
 
@@ -15,13 +19,11 @@ pumpkin-books.pdf: pumpkin-books.ps
                -sDEVICE=pdfwrite -sOutputFile=$@ $<
 
 bag.pgm: Sack_-_Sac_-_Zak_brown.svg Makefile
-       rsvg-convert -f png -o $@.tmp.png $<
-       set -o pipefail; set -e;                        \
+       $(use_rsvg)
+       $(shell_pipe)                                   \
        pngtopnm <$@.tmp.png -mix -background 'white'   \
        | ppmtopgm                                      \
-       | pnmdepth 255                                  \
-       | pnmnoraw >$@.tmp.new
-       mv -f $@.tmp.new $@
+       | $(make_pgm)
 
 
 pubssh=c