phd-thesis/manuscrit/Makefile

60 lines
1.4 KiB
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
CLEANED_MAIN=$(BUILD_DIR)/these.pdf
CLEANED_PRINTOUT=$(BUILD_DIR)/these-printout.pdf
CLEANED_PDFS=$(CLEANED_MAIN) $(CLEANED_PRINTOUT)
2023-09-13 15:42:57 +02:00
MAIN_PDF=$(BUILD_DIR)/main.pdf
PRINTOUT_PDF=$(BUILD_DIR)/main-printout.pdf
2025-01-01 19:30:38 +01:00
ALL=$(CLEANED_PDFS)
2024-08-14 09:39:52 +02:00
REV_FILE=$(BUILD_DIR)/version
2025-01-10 21:16:05 +01:00
TITLE_EN=$(shell cat meta/title-en.txt)
2023-09-13 15:42:57 +02:00
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_MAIN): $(MAIN_PDF)
$(CLEANED_PRINTOUT): $(PRINTOUT_PDF)
$(CLEANED_PDFS):
2023-09-13 15:42:57 +02:00
qpdf "$<" --linearize "$@"
2024-08-14 09:39:52 +02:00
exiftool -all:all= \
-Version="$(shell bin/version.sh)" \
-Author="Théophile Bastian" \
2025-01-10 21:16:05 +01:00
-Title="$(TITLE_EN)" \
2024-08-14 09:39:52 +02:00
"$@"
2023-09-13 15:42:57 +02:00
@ 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.
2024-08-14 09:39:52 +02:00
$(MAIN_PDF): assets $(REV_FILE)
2023-09-13 15:42:57 +02:00
latexmk $($(notdir $@):.pdf=.tex)
.PHONY: $(PRINTOUT_PDF)
$(PRINTOUT_PDF): assets $(REV_FILE)
latexmk $($(notdir $@):.pdf=.tex)
.PHONY: assets
assets:
$(MAKE) -C "$@"
2024-08-14 09:39:52 +02:00
.PHONY: $(REV_FILE) # not costly: just always run it.
$(REV_FILE):
./bin/version.sh > "$@"
2023-09-13 15:42:57 +02:00
clean:
latexmk -C
fullclean:
rm -rf $(BUILD_DIR)
2024-03-28 22:33:46 +01:00
2025-01-01 19:43:41 +01:00
upload: $(CLEANED_MAIN)
scp $< www.tobast:~/files/phd_manuscript.pdf