phd-thesis/manuscrit/Makefile

37 lines
777 B
Makefile
Raw Normal View History

2023-09-13 15:42:57 +02:00
# Latexmk is configured in .latexmkrc
BUILD_DIR=build
2023-09-13 16:39:44 +02:00
AUX_DIR=$(BUILD_DIR)/aux
2023-09-13 15:42:57 +02:00
CLEANED_PDF=$(BUILD_DIR)/these.pdf
MAIN_PDF=$(BUILD_DIR)/main.pdf
ALL=$(CLEANED_PDF)
2023-09-13 16:39:44 +02:00
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
2023-09-13 15:42:57 +02:00
$(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
2023-09-13 15:42:57 +02:00
latexmk $($(notdir $@):.pdf=.tex)
.PHONY: assets
assets:
$(MAKE) -C "$@"
2023-09-13 15:42:57 +02:00
clean:
latexmk -C
fullclean:
rm -rf $(BUILD_DIR)