Add version information to PDF file

This commit is contained in:
Théophile Bastian 2024-08-14 09:39:52 +02:00
parent 03e3e949e6
commit ea88bf2016
4 changed files with 27 additions and 2 deletions

View file

@ -0,0 +1,7 @@
%\input{../build/version}
\vspace*{\fill}
\begin{center}
Version \texttt{\input{../build/version}}
\end{center}
\vspace*{\fill}
\newpage{}

View file

@ -1,3 +1,5 @@
\input{05_version.tex}
\input{10_abstract.tex} \input{10_abstract.tex}
\setcounter{page}{4} \setcounter{page}{4}

View file

@ -4,6 +4,7 @@ AUX_DIR=$(BUILD_DIR)/aux
CLEANED_PDF=$(BUILD_DIR)/these.pdf CLEANED_PDF=$(BUILD_DIR)/these.pdf
MAIN_PDF=$(BUILD_DIR)/main.pdf MAIN_PDF=$(BUILD_DIR)/main.pdf
ALL=$(CLEANED_PDF) ALL=$(CLEANED_PDF)
REV_FILE=$(BUILD_DIR)/version
all: _setup $(ALL) all: _setup $(ALL)
@ -16,19 +17,27 @@ _setup:
$(CLEANED_PDF): $(MAIN_PDF) $(CLEANED_PDF): $(MAIN_PDF)
qpdf "$<" --linearize "$@" qpdf "$<" --linearize "$@"
exiftool -all:all= "$@" exiftool -all:all= \
-Version="$(shell bin/version.sh)" \
-Author="Théophile Bastian" \
-Title="Performance study: identifying bottlenecks by means of sensitivity analysis" \
"$@"
@ pdffonts "$@" | grep -q ' no' && echo -e "\033[0;1;31mSOME FONTS NOT EMBEDDED\033[0m" || true @ pdffonts "$@" | grep -q ' no' && echo -e "\033[0;1;31mSOME FONTS NOT EMBEDDED\033[0m" || true
@ !(pdffonts "$@" | grep -q ' no') @ !(pdffonts "$@" | grep -q ' no')
.PHONY: $(MAIN_PDF) # hack-ish: latexmk knows better when to run. .PHONY: $(MAIN_PDF) # hack-ish: latexmk knows better when to run.
$(MAIN_PDF): assets $(MAIN_PDF): assets $(REV_FILE)
latexmk $($(notdir $@):.pdf=.tex) latexmk $($(notdir $@):.pdf=.tex)
.PHONY: assets .PHONY: assets
assets: assets:
$(MAKE) -C "$@" $(MAKE) -C "$@"
.PHONY: $(REV_FILE) # not costly: just always run it.
$(REV_FILE):
./bin/version.sh > "$@"
clean: clean:
latexmk -C latexmk -C

7
manuscrit/bin/version.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
echo -n "$(git rev-parse --short HEAD)"
if [ -n "$(git status --porcelain --untracked-files=no)" ] ; then
echo -n "-dirty"
fi
echo ""