-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (40 loc) · 1.48 KB
/
Makefile
File metadata and controls
47 lines (40 loc) · 1.48 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
# Deep Learning Handbook - Makefile
# Compiler
LATEX = xelatex
BIBTEX = bibtex
# Flags
LATEX_FLAGS = -interaction=nonstopmode
# Target file
TARGET = main
TEX_FILE = $(TARGET).tex
PDF_FILE = $(TARGET).pdf
AUX_FILE = $(TARGET).aux
# Build output
.PHONY: all clean build
all: build
build:
@echo "=================================================="
@echo " Deep Learning Handbook - Build Script"
@echo "=================================================="
@echo "[1/4] Cleaning previous build artifacts..."
@$(MAKE) clean > /dev/null
@echo "[2/4] Running first XeLaTeX pass (scanning structure)..."
@$(LATEX) $(LATEX_FLAGS) $(TEX_FILE) > /dev/null || (echo "[ERROR] XeLaTeX first pass failed." && exit 1)
@echo "[3/4] Running BibTeX pass (generating references)..."
@if [ -f "$(AUX_FILE)" ]; then \
$(BIBTEX) $(TARGET) > /dev/null; \
else \
echo " No $(AUX_FILE) found, skipping BibTeX."; \
fi
@echo "[4/4] Running second XeLaTeX pass (building TOC and Links)..."
@$(LATEX) $(LATEX_FLAGS) $(TEX_FILE) > /dev/null || (echo "[ERROR] XeLaTeX second pass failed." && exit 1)
@echo "[5/5] Final cleanup..."
@$(MAKE) clean > /dev/null
@echo "=================================================="
@echo " BUILD SUCCESS! The file $(PDF_FILE) is ready."
@echo "=================================================="
clean:
@echo "Cleaning auxiliary files..."
@rm -f *.aux *.log *.out *.toc *.bbl *.blg *.fls *.fdb_latexmk *.synctex.gz
@rm -f chapters/*.aux chapters/*.log
@echo "Clean complete."