forked from SchnitzlerJ/latex-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (76 loc) · 2.73 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
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
PY = python3
FILES = iswartcl iswstud iswbook iswdctrt
BUILD_DIR = dist
SRC_DIR = src
.PHONY: all
all: build classes images packages macros
# build directory
build:
[ -d "$(BUILD_DIR)/" ] || mkdir $(BUILD_DIR)
# create list of packages
packages: $(SRC_DIR)/*.cls
$(PY) output-packages.py --output packages.md -- $?
# create list of macros
macros: iswmacros
$(PY) output-macros.py --output $(BUILD_DIR)/macros.tex -- $(SRC_DIR)/*.cls
latexmk -norc -quiet -c -cd -r $(BUILD_DIR)/iswbook.latexmkrc $(BUILD_DIR)/iswmacros.tex
latexmk -norc -quiet -cd -r $(BUILD_DIR)/iswbook.latexmkrc $(BUILD_DIR)/iswmacros.tex
latexmk -norc -quiet -c -cd -r $(BUILD_DIR)/iswbook.latexmkrc $(BUILD_DIR)/iswmacros.tex
# Target to only build the classes
.PHONY: classes
classes: $(FILES)
# Building of all necessary classes
# build iswartcl cls, tex, rc, etc
.PHONY: iswartcl
iswartcl: iswartcl-cls iswartcl-tex iswartcl-rc bbl glossaries
# build iswstud cls, tex, rc, etc
.PHONY: iswstud
iswstud: iswstud-cls iswstud-tex iswstud-rc bbl glossaries
# build iswbook cls, tex, rc, etc
.PHONY: iswbook
iswbook: iswbook-cls iswbook-tex iswbook-rc bbl glossaries
# build iswdctrt cls, tex, rc, etc
.PHONY: iswdctrt
iswdctrt: iswdctrt-cls iswdctrt-tex iswdctrt-rc bbl glossaries
# implicit target for making `*.cls` files
%-cls: $(SRC_DIR)/%.cls $(SRC_DIR)/%/* $(SRC_DIR)/common/*
$(PY) build.py --dest=$(BUILD_DIR)/ -- $<
# implicit target for making `*.tex` filesx
%-tex: $(SRC_DIR)/%.tex
$(PY) build.py --dest=$(BUILD_DIR)/ -- $<
# implicit target for making `*.rc` files
%-rc: $(SRC_DIR)/%.latexmkrc
cp $(SRC_DIR)/$*.latexmkrc $(BUILD_DIR)/$*.latexmkrc
# copy all files needed for `iswmacros`
iswmacros: iswbook $(SRC_DIR)/iswmacros.tex
cp $(SRC_DIR)/iswmacros.tex $(BUILD_DIR)/iswmacros.tex
# implicit target for making the images
images: $(SRC_DIR)/images*
rsync -a --exclude="*-converted-to*" $(SRC_DIR)/images $(BUILD_DIR)/
# make all bibliography related things
.PHONY: bbl
bbl: bbx bib
# copy the BBX file to build
bbx: $(SRC_DIR)/iswbib.bbx
cp $(SRC_DIR)/iswbib.bbx $(BUILD_DIR)/iswbib.bbx
# Copy the BIB file to build
bib: $(SRC_DIR)/bibliography.bib
cp $(SRC_DIR)/bibliography.bib $(BUILD_DIR)/bibliography.bib
.PHONY: glossaries
glossaries: glssty
glssty: $(SRC_DIR)/iswgloss.sty
cp $(SRC_DIR)/iswgloss.sty $(BUILD_DIR)/iswgloss.sty
# Semantic Versioning
# patch version bump for the given file(s)
patch: $(SRC_DIR)/*.cls
$(PY) semver.py patch $?
# minor version bump for the given file(s)
minor: $(SRC_DIR)/*.cls
$(PY) semver.py minor $?
# major version bump for the given file(s)
major: $(SRC_DIR)/*.cls
$(PY) semver.py major $?
# cleanup
.PHONY: clean
clean:
[ -d "$(BUILD_DIR)/" ] && rm -rf $(BUILD_DIR)/ && mkdir $(BUILD_DIR)/ || [ ! -d "$(BUILD_DIR)/" ]