# Latexmk is configured in .latexmkrc BUILD_DIR=build AUX_DIR=$(BUILD_DIR)/aux CLEANED_PDF=$(BUILD_DIR)/these.pdf MAIN_PDF=$(BUILD_DIR)/main.pdf ALL=$(CLEANED_PDF) all: _setup $(ALL) .PHONY: _setup _setup: for dir in $$(find . -name '*.tex' -and -not -path './$(BUILD_DIR)/*'); do \ mkdir -p "$(AUX_DIR)/$$(dirname "$$dir")"; \ done $(CLEANED_PDF): $(MAIN_PDF) qpdf "$<" --linearize "$@" exiftool -all:all= "$@" @ pdffonts "$@" | grep -q ' no' && echo -e "\033[0;1;31mSOME FONTS NOT EMBEDDED\033[0m" || true @ !(pdffonts "$@" | grep -q ' no') .PHONY: $(MAIN_PDF) # hack-ish: latexmk knows better when to run. $(MAIN_PDF): assets latexmk $($(notdir $@):.pdf=.tex) .PHONY: assets assets: $(MAKE) -C "$@" clean: latexmk -C fullclean: rm -rf $(BUILD_DIR) upload: $(CLEANED_PDF) scp $(CLEANED_PDF) www.tobast:~/files/phd_manuscript.pdf