-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
39 lines (29 loc) · 1.07 KB
/
makefile
File metadata and controls
39 lines (29 loc) · 1.07 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
SHELL=/usr/bin/env bash
# ---------------------------------------------------------------------------- #
### Layout Configuration ###
PDF_DOC_DIR = documents
SOURCE_DIR = source
ASSET_DIR = assets
FONTS_DIR = $(ASSET_DIR)/fonts
### Compiler Configuration ###
TYP_COMPILER = typst
override TYP_FLAGS += --root . --ignore-system-fonts --font-path=$(FONTS_DIR)
# ---------------------------------------------------------------------------- #
#### Derived Variables ###
VOLUME_SRC_DIRS = $(shell find $(SOURCE_DIR) -mindepth 1 -maxdepth 1 -type d)
VOLUME_NAMES = $(foreach x,$(VOLUME_SRC_DIRS),$(shell basename $x))
### User Rules ###
.PHONY: all $(VOLUME_NAMES)
all: $(VOLUME_NAMES)
$(VOLUME_NAMES): %: $(PDF_DOC_DIR)/%.pdf
### Typst Source Build Rule...? ###
define DYN_RULE
$(PDF_DOC_DIR)/$1.pdf: \
$$(wildcard $(SOURCE_DIR)/*.typ) \
$$(wildcard $(SOURCE_DIR)/$1/*.typ)
$(TYP_COMPILER) compile $(TYP_FLAGS) \
$(SOURCE_DIR)/$1/root.typ $$@
endef
$(foreach v,$(VOLUME_NAMES), \
$(eval $(call DYN_RULE,$v)))
# ---------------------------------------------------------------------------- #