Skip to content

Instantly share code, notes, and snippets.

@aflp91
Created April 30, 2018 07:49
Show Gist options
  • Save aflp91/dfe22eab0b992f00145b9e25b7ef2122 to your computer and use it in GitHub Desktop.
Save aflp91/dfe22eab0b992f00145b9e25b7ef2122 to your computer and use it in GitHub Desktop.
A Makefile to convert jpg to pdf and then concatenate (on MacOSX)
JPG = $(wildcard Orig/*.JPG)
PDF = $(patsubst Orig/%.JPG,%.pdf,$(JPG))
CONCAT = "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
.PHONY: help clean all convert concat
.DEFAULT :
@$(MAKE) help
help:
@echo " convert convertit les .JPG en PDF"
@echo " concat rassemble les .PDF en un document"
@echo " all convertit puis génère le PDF final"
@echo " clean supprime les PDF générés, sauf le document final"
all: convert concat
convert : $(PDF)
%.pdf: Orig/%.JPG
sips -s format pdf $< --out $@ 1>/dev/null 2>&1
concat:
$(CONCAT) -o combined.pdf *.pdf
clean:
rm $(PDF)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment