-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (26 loc) · 887 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
SHELL := /bin/bash
ATTACHMENTS := $(shell python scripts/download_attachments.py)
define decrypt
$(shell pdfinfo $(1) | grep "Encrypted: yes" > /dev/null 2>&1 &&
qpdf --decrypt $(1) --replace-input)
endef
clean :
find attachments -type f -not -name .gitkeep -delete
find merged -type f -not -name .gitkeep -delete
upload_% : merged/%.pdf
aws s3 cp $< s3://$$S3_BUCKET_NAME --acl public-read
merged/%.pdf : $(addsuffix .pdf,$(basename $(ATTACHMENTS)))
$(foreach attachment,$^,$(call decrypt,$(attachment)))
pdfunite $^ $@
attachments/%.pdf : attachments/%.xlsx
unoconv -f pdf $<
attachments/%.pdf : attachments/%.doc
unoconv -f pdf $<
attachments/%.pdf : attachments/%.docx
unoconv -f pdf $<
attachments/%.pdf : attachments/%.ppt
unoconv -f pdf $<
attachments/%.pdf : attachments/%.pptx
unoconv -f pdf $<
attachments/%.pdf : attachments/%.rtf
unoconv -f pdf $<