# Latexmk is configured in .latexmkrc BUILD_DIR=build AUX_DIR=$(BUILD_DIR)/aux CLEANED_PDF=$(BUILD_DIR)/slides.pdf MAIN_PDF=$(BUILD_DIR)/main.pdf ALL=$(CLEANED_PDF) REV_FILE=$(BUILD_DIR)/version 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 "$@" @ 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 $(REV_FILE) latexmk $($(notdir $@):.pdf=.tex) .PHONY: assets assets: $(MAKE) -C "$@" .PHONY: $(REV_FILE) # not costly: just always run it. $(REV_FILE): ./bin/version.sh > "$@" clean: latexmk -C fullclean: rm -rf $(BUILD_DIR) upload: $(CLEANED_PDF) scp $(CLEANED_PDF) www.tobast:~/files/phd_defense_slides.pdf