-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
109 lines (94 loc) · 2.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# UID/GID
# UID or GID is the UNIX user ID or group ID of the user who executes
# make. If the UID or GID is not passed as a make variable, an attempt
# is made to determine it.
UID?=$(shell id --user)
GID?=$(shell id --group)
# VERSION
# If no version is specified as a parameter of make, the last git hash
# value is taken.
VERSION?=$(shell git rev-parse --short HEAD)-git
# IMAGE I
# MAGE defines the docker image to compile latex into a pdf file.
IMAGE:=volkerraschek/docker-latex:latest-ubuntu18.04
# Input tex-file and output pdf-file
FILE:=index
PDF_FILE:=${FILE}.pdf
IDX_FILE:=${FILE}.idx
TEX_FILE:=${FILE}.tex
# HARDLINK_VARIABLES
# FSD: Defines the general storage location for study documents.
# HARDLINK_PATH: This should be extended with the value from FSD. For example
# for the subject Mathematics: ${FSD}/Mathematics
# HARDLINK_FILE: Name of the document to be linked under the path HARDLINK_PATH.
FSD?=${HOME}/Dokumente/Studium/Fachschaftsdaten
HARDLINK_PATH:=${FSD}
HARDLINK_FILE:=index.pdf
# latexmk
# compile the pdf file with latexmk
latexmk:
latexmk \
-shell-escape \
-synctex=1 \
-interaction=nonstopmode \
-file-line-error \
-pdf ${TEX_FILE}
# pdflatex
# compile the pdf file with pdflatex
pdflatex: makeglossar makeindex
pdflatex \
-shell-escape \
-synctex=1 \
-interaction=nonstopmode \
-enable-write18 ${TEX_FILE}
# makeglossar
# generate the glossar
makeglossar:
makeglossaries ${FILE}
# makeindex
# generate the index
makeindex:
makeindex ${IDX_FILE}
# docker-latexmk
# compile the pdf file with latexmk inside a docker container
container-latexmk:
docker run \
--rm \
--user=${UID}:${GID} \
--net=none \
--volume=${PWD}:/data ${IMAGE} \
make latexmk VERSION=${VERSION}
# docker-pdflatex
# compile the pdf file with pdflatex inside a docker container
container-pdflatex:
docker run \
--rm \
--user=${UID}:${GID} \
--net=none \
--volume=${PWD}:/data ${IMAGE} \
make pdflatex VERSION=${VERSION}
# clean
# remove all files which are ignored about .gitignore
clean:
git clean -fX
# create-hardlink
# Create a hardlink of the generated pdf file into a different directory.
# It's could use to create a hardlink from the compiled pdf into in your documents
# directory.
create-hardlink: delete-hardlink
if [ ! -d ${HARDLINK_PATH} ]; \
then \
mkdir -p ${HARDLINK_PATH}; \
fi;
if [ ! -f ${PDF_FILE} ]; \
then \
echo "Compile the PDF file first!"; \
fi;
ln ${PDF_FILE} ${HARDLINK_PATH}/${HARDLINK_FILE}
# delete-hardlink
# Delete the hardlink
delete-hardlink:
if [ -f ${HARDLINK_PATH}/${HARDLINK_FILE} ]; \
then \
rm -R ${HARDLINK_PATH}/${HARDLINK_FILE}; \
fi;