-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (56 loc) · 1.98 KB
/
Makefile
File metadata and controls
73 lines (56 loc) · 1.98 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
# LaTeX Makefile
# Usage: make, make clean, make view
# Main document name (without .tex extension)
MAIN = main
# Output directory
OUTDIR = out
# LaTeX compiler (xelatex for custom fonts)
LATEX = xelatex
# BibTeX compiler
BIBTEX = bibtex
# Viewer (adjust for your system)
VIEWER = open
# Final book name
BOOK = book.pdf
# Default target
all: $(OUTDIR)/$(MAIN).pdf
# Build and copy to root as book.pdf
book: $(OUTDIR)/$(MAIN).pdf
cp $(OUTDIR)/$(MAIN).pdf $(BOOK)
cp $(BOOK) docs/$(BOOK)
# Create output directory
$(OUTDIR):
mkdir -p $(OUTDIR)
# Compile the document
$(OUTDIR)/$(MAIN).pdf: $(MAIN).tex | $(OUTDIR)
$(LATEX) -interaction=nonstopmode -output-directory=$(OUTDIR) $(MAIN).tex || true
$(LATEX) -interaction=nonstopmode -output-directory=$(OUTDIR) $(MAIN).tex || true
$(LATEX) -interaction=nonstopmode -output-directory=$(OUTDIR) $(MAIN).tex || true
# Quick compile (single pass, no bibliography)
quick: $(MAIN).tex | $(OUTDIR)
$(LATEX) -interaction=nonstopmode -output-directory=$(OUTDIR) $(MAIN).tex
# View the PDF
view: $(OUTDIR)/$(MAIN).pdf
$(VIEWER) $(OUTDIR)/$(MAIN).pdf
# Clean and compile in one command
fresh: clean | $(OUTDIR)
$(LATEX) -interaction=nonstopmode -output-directory=$(OUTDIR) $(MAIN).tex || true
$(LATEX) -interaction=nonstopmode -output-directory=$(OUTDIR) $(MAIN).tex || true
$(LATEX) -interaction=nonstopmode -output-directory=$(OUTDIR) $(MAIN).tex || true
# Clean auxiliary files
clean:
rm -rf $(OUTDIR)
# Clean everything including PDF (same as clean for this setup)
distclean: clean
# Help
help:
@echo "Available targets:"
@echo " all - Compile the document (default)"
@echo " book - Build and copy PDF to ./book.pdf"
@echo " quick - Quick compile (single pass)"
@echo " fresh - Clean and compile in one command"
@echo " view - View the PDF"
@echo " clean - Remove auxiliary files"
@echo " distclean- Remove all generated files"
@echo " help - Show this help"
.PHONY: all book quick fresh view clean distclean help