SRCS = $(wildcard source/*) DESTS = $(subst source/,kindle/,$(SRCS)) all: $(DESTS) kindle/%: source/% @echo '$@' eval `identify -format 'WIDTH=%[fx:w] HEIGHT=%[fx:h]' '$<'`; \ OPTS=""; if [ "$$((2*WIDTH>3*HEIGHT))" -eq '1' ] ; then OPTS="-rotate 270"; fi; \ convert '$<' $$OPTS -gravity center -filter Sinc -resize 590x790 -extent 600x800 -colorspace gray '$@' clean: rm -f $(DESTS) download: mkdir -p kindle source for i in `seq $$( last; \ done