-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (51 loc) · 1.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
TEX_SOURCES = report.tex
PACKAGE_NAME = WUST-ECE-Metrology-Report
BUILT_SOURCES = $(PACKAGE_NAME).sty
DOCKER_IMAGE = latex-builder
BUILDDIR = build
OPTIONS = -pdf -xelatex -f -interaction=nonstopmode
PDFTARGETS = $(TEX_SOURCES:.tex=.pdf)
PDFBUILDS = $(addprefix $(BUILDDIR)/, $(TEX_SOURCES:.tex=.pdf))
default: docker
.PHONY: all
all: $(PDFTARGETS) docs
.PHONY: clean
clean:
-rm -r $(PDFTARGETS) $(BUILDDIR) $(BUILT_SOURCES) 2>/dev/null
$(PACKAGE_NAME).sty: $(PACKAGE_NAME).dtx $(PACKAGE_NAME).ins
mkdir -p $(BUILDDIR)
yes | latex -output-directory=$(BUILDDIR) $(PACKAGE_NAME).ins
yes | latex -output-directory=$(BUILDDIR) $(PACKAGE_NAME).ins
cp $(BUILDDIR)/$@ $@
.PHONY: docs
.ONESHELL:
docs $(PACKAGE_NAME).pdf: $(PACKAGE_NAME).sty $(PACKAGE_NAME).dtx
mkdir -p $(BUILDDIR)
cp $(PACKAGE_NAME).dtx $(BUILDDIR)/$(PACKAGE_NAME).dtx
cd $(BUILDDIR)
latex $(PACKAGE_NAME).dtx
makeindex -s gglo.ist -o $(PACKAGE_NAME).gls $(PACKAGE_NAME).glo
makeindex -s gind.ist -o $(PACKAGE_NAME).ind $(PACKAGE_NAME).idx
xelatex $(PACKAGE_NAME).dtx
cp $(PACKAGE_NAME).pdf ../$(PACKAGE_NAME).pdf
$(PDFBUILDS): $(BUILDDIR)/%.pdf: %.tex
mkdir -p $(BUILDDIR)
echo $(PDFTARGETS)
(latexmk $(OPTIONS) -jobname=$* -output-directory=$(BUILDDIR) $*.tex)
$(PDFTARGETS): $(BUILT_SOURCES) $(PDFBUILDS)
cp $(BUILDDIR)/*.pdf .
.PHONY: hadolint
hadolint: Dockerfile
docker run --rm -i hadolint/hadolint < Dockerfile
.PHONY: docker_image
docker_image: Dockerfile hadolint
docker build \
--tag $(DOCKER_IMAGE) \
.
.PHONY: docker
docker: docker_image
docker run \
--rm \
--volume `pwd`:/app \
$(DOCKER_IMAGE) \
sh -c "make -B --directory /app all"