-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (113 loc) Β· 5.99 KB
/
Makefile
File metadata and controls
127 lines (113 loc) Β· 5.99 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Makefile for LaTeX CV compilation and linting
# Color definitions
GREEN := \033[0;32m
YELLOW := \033[0;33m
RED := \033[0;31m
BLUE := \033[0;34m
NC := \033[0m # No Color
# Main targets
.PHONY: all clean lint help cv shortcv pubcv lint-tex lint-bib lint-lacheck check-refs
# Default target
all: lint cv shortcv pubcv
# Compile main CV
cv:
@echo "$(BLUE)π Compiling Vatsal_CV.tex...$(NC)"
@pdflatex -interaction=batchmode Vatsal_CV.tex > Vatsal_CV.build.log 2>&1 || (echo "$(RED)β Compilation failed!$(NC)" && cat Vatsal_CV.build.log && rm -f Vatsal_CV.build.log && exit 1)
@pdflatex -interaction=batchmode Vatsal_CV.tex >> Vatsal_CV.build.log 2>&1 || (echo "$(RED)β Compilation failed!$(NC)" && cat Vatsal_CV.build.log && rm -f Vatsal_CV.build.log && exit 1)
@echo "$(GREEN)β Vatsal_CV.pdf compiled successfully$(NC)"
@rm -f Vatsal_CV.build.log
@$(MAKE) clean
# Compile short CV
shortcv:
@echo "$(BLUE)π Compiling Vatsal_CV-shortCV.tex...$(NC)"
@pdflatex -interaction=batchmode Vatsal_CV-shortCV.tex > Vatsal_CV-shortCV.build.log 2>&1 || (echo "$(RED)β Compilation failed!$(NC)" && cat Vatsal_CV-shortCV.build.log && rm -f Vatsal_CV-shortCV.build.log && exit 1)
@pdflatex -interaction=batchmode Vatsal_CV-shortCV.tex >> Vatsal_CV-shortCV.build.log 2>&1 || (echo "$(RED)β Compilation failed!$(NC)" && cat Vatsal_CV-shortCV.build.log && rm -f Vatsal_CV-shortCV.build.log && exit 1)
@echo "$(GREEN)β Vatsal_CV-shortCV.pdf compiled successfully$(NC)"
@rm -f Vatsal_CV-shortCV.build.log
@$(MAKE) clean
# Compile publications-only CV
pubcv:
@echo "$(BLUE)π Compiling Vatsal_CV-publicationsOnly.tex...$(NC)"
@pdflatex -interaction=batchmode Vatsal_CV-publicationsOnly.tex > Vatsal_CV-publicationsOnly.build.log 2>&1 || (echo "$(RED)β Compilation failed!$(NC)" && cat Vatsal_CV-publicationsOnly.build.log && rm -f Vatsal_CV-publicationsOnly.build.log && exit 1)
@pdflatex -interaction=batchmode Vatsal_CV-publicationsOnly.tex >> Vatsal_CV-publicationsOnly.build.log 2>&1 || (echo "$(RED)β Compilation failed!$(NC)" && cat Vatsal_CV-publicationsOnly.build.log && rm -f Vatsal_CV-publicationsOnly.build.log && exit 1)
@echo "$(GREEN)β Vatsal_CV-publicationsOnly.pdf compiled successfully$(NC)"
@rm -f Vatsal_CV-publicationsOnly.build.log
@$(MAKE) clean
# Lint all LaTeX files
lint:
@echo "$(BLUE)π Running ChkTeX linter...$(NC)"
@chktex Vatsal_CV.tex > lint.log 2>&1 || true
@chktex Vatsal_CV-shortCV.tex >> lint.log 2>&1 || true
@chktex Vatsal_CV-publicationsOnly.tex >> lint.log 2>&1 || true
@if grep -E "Warning|Error" lint.log > /dev/null 2>&1; then \
echo "$(YELLOW)β Linting issues found:$(NC)"; \
grep -E "Warning|Error" lint.log | sed 's/Warning/$(YELLOW)Warning$(NC)/g' | sed 's/Error/$(RED)Error$(NC)/g'; \
echo "$(YELLOW)π Full details saved in lint.log$(NC)"; \
else \
echo "$(GREEN)β No linting issues found$(NC)"; \
rm -f lint.log; \
fi
# Lint with verbose output
lint-verbose:
@echo "Running ChkTeX with verbose output..."
chktex -v0 Vatsal_CV.tex
chktex -v0 Vatsal_CV-shortCV.tex
chktex -v0 Vatsal_CV-publicationsOnly.tex
# Clean auxiliary files
clean:
@rm -f *.aux *.bbl *.blg *.log *.out *.toc *.fdb_latexmk *.fls *.synctex.gz *.build.log
# Lint only TeX files
lint-tex:
@echo "$(BLUE)π Linting .tex files...$(NC)"
@chktex -q Vatsal_CV.tex Vatsal_CV-shortCV.tex Vatsal_CV-publicationsOnly.tex || true
@echo "$(GREEN)β TeX linting completed$(NC)"
# Lint bibliography files
lint-bib:
@echo "$(BLUE)π Checking bibliography files...$(NC)"
@if [ -f mypublications.bib ]; then \
echo "Checking Vatsal_CV bibliography..."; \
bibtex -terse Vatsal_CV 2>&1 | grep -E "Warning|Error" || echo "$(GREEN)β No bibliography issues found in Vatsal_CV$(NC)"; \
echo "Checking Vatsal_CV-shortCV bibliography..."; \
bibtex -terse Vatsal_CV-shortCV 2>&1 | grep -E "Warning|Error" || echo "$(GREEN)β No bibliography issues found in Vatsal_CV-shortCV$(NC)"; \
else \
echo "$(YELLOW)β No bibliography file found$(NC)"; \
fi
# Run lacheck linter
lint-lacheck:
@echo "$(BLUE)π Running lacheck...$(NC)"
@if command -v lacheck >/dev/null 2>&1; then \
lacheck Vatsal_CV.tex || true; \
lacheck Vatsal_CV-shortCV.tex || true; \
lacheck Vatsal_CV-publicationsOnly.tex || true; \
echo "$(GREEN)β lacheck completed$(NC)"; \
else \
echo "$(YELLOW)β lacheck not installed$(NC)"; \
fi
# Check references
check-refs:
@echo "$(BLUE)π Checking references...$(NC)"
@grep -E "\\\\(ref|cite)" Vatsal_CV.tex Vatsal_CV-shortCV.tex Vatsal_CV-publicationsOnly.tex | grep -v "%" | \
if grep -E "\\?\\?" > /dev/null 2>&1; then \
echo "$(RED)β Undefined references found$(NC)"; \
exit 1; \
else \
echo "$(GREEN)β All references defined$(NC)"; \
fi
# Help target
help:
@echo "$(BLUE)βββββββββββββββββββββββββββββββββββββββββββββββββ$(NC)"
@echo "$(BLUE) LaTeX CV Makefile Commands$(NC)"
@echo "$(BLUE)βββββββββββββββββββββββββββββββββββββββββββββββββ$(NC)"
@echo " $(GREEN)all$(NC) - Run linter and compile all CVs"
@echo " $(GREEN)cv$(NC) - Compile main CV"
@echo " $(GREEN)shortcv$(NC) - Compile short CV"
@echo " $(GREEN)pubcv$(NC) - Compile publications-only CV"
@echo " $(GREEN)lint$(NC) - Run ChkTeX linter on all .tex files"
@echo " $(GREEN)lint-tex$(NC) - Lint only .tex files"
@echo " $(GREEN)lint-bib$(NC) - Check bibliography files"
@echo " $(GREEN)lint-lacheck$(NC) - Run lacheck linter"
@echo " $(GREEN)check-refs$(NC) - Check for undefined references"
@echo " $(GREEN)lint-verbose$(NC) - Run ChkTeX with detailed output"
@echo " $(GREEN)clean$(NC) - Remove auxiliary files"
@echo " $(GREEN)help$(NC) - Show this help message"
@echo "$(BLUE)βββββββββββββββββββββββββββββββββββββββββββββββββ$(NC)"