# This file is a so called Makefile. Execute it with make -f # This Makefile removes the password (given by command line option) from all pdf files in the working directory PDF_FILES = $(wildcard *.pdf) INPUT_FILES = $(filter-out %_decrypt.pdf,$(PDF_FILES)) DECRYPT_PDF_FILES = $(patsubst %.pdf,%_decrypt.pdf,$(INPUT_FILES)) $(warning $(INPUT_FILES)) ifdef passwd all: $(DECRYPT_PDF_FILES) %_decrypt.pdf: %.pdf qpdf --password=$(passwd) --decrypt $< $@ else all: @echo -e "ERROR: Specify password, with\n\tmake passwd= all" 1>&2 endif clean: rm -f $(DECRYPT_PDF_FILES)