-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
75 lines (55 loc) · 1.72 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
69
70
71
72
73
74
75
BUILD_BASE_DIR = build
BUILD_DIRS=$(shell find $(BUILD_BASE_DIR) -mindepth 1 -maxdepth 1 -type d)
BUILD_INDEXES=$(foreach dir,$(BUILD_DIRS),$(dir)/index.tex)
BUILD_PDFS=$(foreach dir,$(BUILD_DIRS),$(dir)/index.pdf)
BUILD_OUTPUTS=$(foreach dir,$(BUILD_DIRS),$(dir)/output-print.pdf)
DEBUG ?= 0
ifeq ($(DEBUG), 1)
RUNCMD = PYTHONBREAKPOINT=ipdb.set_trace poetry run
else
RUNCMD = poetry run
endif
all:
$(RUNCMD) mkdocs build
serve:
$(RUNCMD) mkdocs serve
servefast:
$(RUNCMD) mkdocs serve --dirty
poetry.lock: pyproject.toml
poetry lock
build:
$(RUNCMD) mkdocs build
latex-clean:
$(RM) -rf $(BUILD_DIR)/_minted-index
latexmk -cd $(BUILD_DIR)/index.tex -C
%.pdf: %.tex | FORCE
latexmk -cd -gg \
-time -logfilewarninglist --interaction=nonstopmode --halt-on-error \
$<
latex: $(BUILD_PDFS) | FORCE
%/output-print.pdf: %/index.pdf
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer \
-dNOPAUSE -dQUIET -dBATCH -sOutputFile=$@ \
-dDownsampleColorImages=true -dDownsampleGrayImages=true \
-dDownsampleMonoImages=true -dColorImageResolution=200 \
-dGrayImageResolution=200 -dMonoImageResolution=200 $<
image: Dockerfile
docker build -t latex-ycr .
ci:
docker run -v $(shell pwd):/workspace \
-w /workspace \
-u $(shell id -u):$(shell id -g) \
-v /etc/passwd:/etc/passwd:ro \
latex-ycr \
make latex optimize
update: docs/js/viewer.min.js
poetry update
docs/js/viewer.min.js: FORCE
wget https://raw.githubusercontent.com/jgraph/drawio/dev/src/main/webapp/js/viewer.min.js -O docs/js/viewer.min.js
optimize: $(BUILD_OUTPUTS)
clean:
$(RM) -rf build site __pycache__ _minted-*
mrproper: clean
$(RM) -rf build site home
FORCE:
.PHONY: all serve build clean update optimize latex latex-clean docker-image ci update-viewer