-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
68 lines (53 loc) · 2.46 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
68
################################################################################
# Entry point for the CV generation process #
################################################################################
# The following Makefile wraps all commands required to generate the CV from #
# the source data and template, as well as helpers and prerequisites. #
# To get started run `make`, or `make [command]` to run a specific command. #
################################################################################
# Full source & links to generated assets is at: https://github.com/lissy93/cv #
# Licensed under the MIT License, ⓒ Alicia Sykes 2024 <aliciasykes.com> #
################################################################################
# Specify that the targets are not files
.PHONY: all install validate generate compile markdown clean clean_tex watch
# Define variables for common paths
PYTHON := $(shell which python3 2>/dev/null || which python)
REQUIREMENTS := lib/requirements.txt
SCHEMA := schema.json
RESUME := resume.yml
TEMPLATE := template.jinja
OUTPUT_TEX := tex/resume.tex
OUTPUT_PDF := out/Alicia-Sykes-CV.pdf
OUTPUT_MD := out/Alicia-Sykes-CV.md
# Default target. Install deps, validate, generate, compile, and clean up
all: install clean validate generate compile markdown
# Install required Python packages
install:
$(PYTHON) -m pip install -r $(REQUIREMENTS)
# Validate the resume JSON against the schema
validate:
$(PYTHON) lib/validate.py --schema $(SCHEMA) --resume $(RESUME) --template $(TEMPLATE)
# Generate the LaTeX file from the template and JSON data
generate:
$(PYTHON) lib/generate.py --resume $(RESUME) --template $(TEMPLATE) --output $(OUTPUT_TEX)
# Compile the LaTeX file into a PDF
compile:
$(PYTHON) ./lib/compile.py --input $(OUTPUT_TEX) --output $(OUTPUT_PDF)
# Convert the resume to markdown
markdown:
$(PYTHON) lib/markdown.py --input $(RESUME) --output $(OUTPUT_MD)
# Clean up auxiliary LaTeX files
clean: clean_tex
rm -f $(OUTPUT_PDF) $(OUTPUT_MD) $(OUTPUT_TEX)
# Clean only the auxiliary files generated by LaTeX
clean_tex:
rm -f tex/*.aux tex/*.log tex/*.out tex/*.toc tex/*.fls tex/*.fdb_latexmk tex/*.synctex.gz
# Helper target to watch for changes and rebuild everything
watch:
ls $(REQUIREMENTS) $(SCHEMA) $(RESUME) $(TEMPLATE) | entr -c make all
web_install:
cd web && yarn
web: web_install
cd web && yarn build && yarn preview
web_dev: web_install
cd web && yarn dev