Skip to content

Instantly share code, notes, and snippets.

@DamonOehlman
Created December 7, 2014 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DamonOehlman/4462810d0626ea3f6cf8 to your computer and use it in GitHub Desktop.
Save DamonOehlman/4462810d0626ea3f6cf8 to your computer and use it in GitHub Desktop.
A simple makefile to process a number of input png files into ebook optimised pdf files in a dist directory.
inputfiles = $(patsubst %.png,dist/%.pdf,$(wildcard *.png))
rebuild: clean build
build: prepare $(inputfiles) postbuild
dist/%.pdf:
@convert $(patsubst dist/%.pdf,%.png,$@) tmp/$@
@gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -sOutputFile=$@ tmp/$@
@rm tmp/$@
prepare:
mkdir -p dist
mkdir -p tmp/dist
postbuild:
rm -rf tmp
clean:
rm -rf dist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment