forked from tuna/thuthesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (61 loc) · 1.69 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
# Makefile for ThuThesis
PACKAGE = thuthesis
THESIS = thuthesis-example
SPINE = spine
SOURCES = $(PACKAGE).ins $(PACKAGE).dtx
CLSFILE = dtx-style.sty $(PACKAGE).cls
LATEXMK = latexmk
SHELL := /usr/bin/env bash
# make deletion work on Windows
ifdef SystemRoot
RM = del /Q
else
RM = rm -f
endif
.PHONY: all all-dev clean distclean dist thesis viewthesis doc viewdoc cls check save test FORCE_MAKE
thesis: $(THESIS).pdf
all: thesis
all-dev: doc all
cls: $(CLSFILE)
$(CLSFILE): $(SOURCES)
xetex $(PACKAGE).ins
doc: $(PACKAGE).pdf
$(PACKAGE).pdf: cls FORCE_MAKE
$(LATEXMK) $(PACKAGE).dtx
$(THESIS).pdf: cls FORCE_MAKE
$(LATEXMK) $(THESIS)
viewdoc: doc
$(LATEXMK) -pv $(PACKAGE).dtx
viewthesis: thesis
$(LATEXMK) -pv $(THESIS)
save:
ifeq ($(target),)
bash testfiles/save.sh
else
bash testfiles/save.sh $(target)
endif
test:
ifeq ($(target),)
l3build check
else
bash testfiles/test.sh $(target)
endif
clean:
$(LATEXMK) -c $(PACKAGE).dtx $(THESIS)
-@$(RM) -rf *~ main-survey.* main-translation.* _markdown_thuthesis* thuthesis.markdown.*
cleanall: clean
-@$(RM) $(PACKAGE).pdf $(THESIS).pdf
distclean: cleanall
-@$(RM) $(CLSFILE)
-@$(RM) -r dist
check: FORCE_MAKE
ifeq ($(version),)
@echo "Error: version missing: \"make [check|dist] version=X.Y.Z\""; exit 1
else
@[[ $(shell grep -E -c '$(version) Tsinghua University Thesis Template|\\def\\version\{$(version)\}' thuthesis.dtx) -eq 3 ]] || (echo "bump version with \"l3build tag\" before release"; exit 1)
endif
dist: check all-dev
# use l3build for CTAN release (zip with .tds.zip)
l3build ctan --config utils/build-ctan
# use gulp for GitHub release (zip with generated file)
python3 utils/create_release.py --version="v$(version)"