-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (52 loc) · 1.85 KB
/
Makefile
File metadata and controls
77 lines (52 loc) · 1.85 KB
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
# =============================================================================
# dls-tutorial Makefile
# - Builds the PDF from LaTeX sources and generated figures
# - Convenience targets for preview/help/clean
# =============================================================================
# Default target
.DEFAULT_GOAL := all
.PHONY: all
all: pdf ## Build all documentation
.PHONY: help
help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "\nAvailable targets:\n\n"} \
/^[a-zA-Z_-]+:.*##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 }' \
$(MAKEFILE_LIST)
.PHONY: pdf
pdf: dls-tutorial.pdf ## Build pdf
dls-tutorial.pdf: main.ps
ps2pdf $< $@
main.ps : main.dvi
dvips $< -o $@
LATEX_CMD ?= latex -halt-on-error -interaction=nonstopmode
main.dvi: genpicts document_version.tex
# Compile three times to resolve longtable layout
$(LATEX_CMD) main.tex
$(LATEX_CMD) main.tex
$(LATEX_CMD) main.tex
.PHONY: genpicts
genpicts:
mkdir -p genpicts
\cp -f picts/*.eps genpicts/
for f in picts/*.png ; do convert $$f genpicts/`basename $$f .png`.eps ; done
# Get date of the last commit
COMMIT_LAST_DATE := $(shell git log --max-count=1 --format=%cd --date=format:'%B %d, %Y' ./ )
.PHONY: document_version.tex
document_version.tex:
echo "% AUTOMATICALLY GENERATED FILE - DO NOT EDIT" > $@
echo '\\newcommand{\\builddate}{'"${COMMIT_LAST_DATE}"'}' >> $@
.PHONY: check-tools
check-tools: ## Verify required build tools are installed
@set -e; \
for tool in latex dvips ps2pdf convert; do \
command -v $$tool >/dev/null 2>&1 || { echo "Missing tool: $$tool"; exit 1; }; \
done; \
echo "All required tools are available."
# cleaning
.PHONY: clean
clean: ## Clean temporary LaTeX files
rm -f *.aux *.log *.out *.olg *.ind *.dvi *.idx *.toc *~
rm -fr genpicts
.PHONY: distclean
distclean: clean ## Remove generated outputs
rm -f *.pdf *.ps