summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/hitszthesis/Makefile
blob: ca045485ce5851399f87c54ce3433a048dfaf92d (plain)
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
# Makefile for hitszthesis

PACKAGE = hitszthesis
THESIS  = main
SPINE   = spine

SOURCES = $(PACKAGE).ins $(PACKAGE).dtx
CLSFILE = dtx-style.sty $(PACKAGE).cls

LATEXMK = latexmk

# make deletion work on Windows
ifdef SystemRoot
	RM = del /Q
else
	RM = rm -f
endif

.PHONY: all all-dev wordcount clean distclean dist thesis viewthesis spine viewspine doc viewdoc cls check save savepdf test FORCE_MAKE

thesis: $(THESIS).pdf

all: thesis spine

dev: doc all clean

pub: doc all cleanall

cls: $(CLSFILE)

$(CLSFILE): $(SOURCES)
	xetex $(PACKAGE).ins

doc: $(PACKAGE).pdf

spine: $(SPINE).pdf

$(PACKAGE).pdf: cls FORCE_MAKE
	$(LATEXMK) $(PACKAGE).dtx

$(THESIS).pdf: cls FORCE_MAKE
	$(LATEXMK) $(THESIS)

$(SPINE).pdf: cls FORCE_MAKE
	$(LATEXMK) $(SPINE)

viewdoc: doc
	$(LATEXMK) -pv $(PACKAGE).dtx

viewthesis: thesis
	$(LATEXMK) -pv $(THESIS)

viewspine: spine
	$(LATEXMK) -pv $(SPINE)

save:
	bash testfiles/save.sh

savepdf:
	bash testfiles/save-pdf.sh

test:
	l3build check

wordcount : $(THESIS).tex
	@texcount $< -inc -chinese

clean:
	$(LATEXMK) -c $(PACKAGE).dtx $(THESIS) $(SPINE)

cleanall: clean
	-@$(RM) $(CLSFILE)

distclean: cleanall
	-@$(RM) -r dist

check: FORCE_MAKE
ifeq ($(version),)
	@echo "Error: version missing: \"make [check|dist] version=X.Y\""; exit 1
else
	@[[ $(shell grep -E -c '$(version) A Bachelor Thesis Template for Harbin Institute of Technology, ShenZhen|\\def\\version\{$(version)\}' hitszthesis.dtx) -eq 3 ]] || (echo "update version in hitszthesis.dtx before release"; exit 1)
	@[[ $(shell grep -E -c '"version": "$(version)"' package.json) -eq 1 ]] || (echo "update version in package.json before release"; exit 1)
endif

dist: check all-dev
	npm run build -- --version=$(version)