-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (37 loc) · 1.24 KB
/
Makefile
File metadata and controls
52 lines (37 loc) · 1.24 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
# typst c --help | grep -A 6 -- --timings
# typst c main.typ --timings --jobs 1
# nix --extra-experimental-features "nix-command flakes" run github:typst/typst -- compile \
# --pdf-standard a-1b \ # or use a-3b
# --input date="`date`" \
# Select typst backend: nix, docker, or local
# Override from command line: `make TYPST_BACKEND=docker`
TYPST_BACKEND ?= nix
# Typst version for nix backend
# Override from command line: `make TYPST_VERSION=ec2389e`
TYPST_VERSION ?= ec2389e # typst 0.14.2
# Configure TYPST command based on selected backend
ifeq ($(TYPST_BACKEND),nix)
TYPST_FLAKE := github:typst/typst-flake/$(TYPST_VERSION)
TYPST := nix run $(TYPST_FLAKE) --
else ifeq ($(TYPST_BACKEND),docker)
TYPST := docker run --rm -v "$(PWD)":/work -w /work ghcr.io/typst/typst:latest
else ifeq ($(TYPST_BACKEND),local)
TYPST := typst
else
$(error Invalid TYPST_BACKEND: $(TYPST_BACKEND). Valid options: nix, docker, local)
endif
default: c t
c:
$(TYPST) compile main.typ
report:
$(TYPST) c main.typ --timings --jobs 1
w:
$(TYPST) watch main.typ
o: open
open:
xdg-open ./main.pdf
t: thumbnail
thumbnail:
$(TYPST) compile --root=. -f png --pages 1,2,3,4 --ppi 250 ./main.typ ./thumbnail-page-{0p}.png
clean:
rm -fr ./*.pdf ./*.png