-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
80 lines (63 loc) · 1.52 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
# Makefile for njurepo
# Compiling method: xelatex
METHOD = latexmk
LATEXMKOPTS = -xelatex -file-line-error -halt-on-error -interaction=nonstopmode
PROJECT?=examples
PACKAGE=njurepo
NAME?=main
TYPE?=single
SOURCES= $(PACKAGE).ins $(PACKAGE).dtx
CONTENTS= $(NAME).tex parts/$(PROJECT)/*.tex
BIBFILE=ref/*.bib
BSTFILE=*.bst
CLSFILES=dtx-style.sty $(PACKAGE).cls
# make deletion work on Windows
ifdef SystemRoot
RM = del /Q
OPEN = start
else
RM = rm -f
OPEN = open
endif
.PHONY: all generate create main texdoc cls FORCE_MAKE clean distclean cleanred single
all: cls main clean
single: generate all
cls: $(CLSFILES)
texdoc: $(PACKAGE).pdf
$(OPEN) $(PACKAGE).pdf
latexmk -c $(PACKAGE).dtx
main: $(NAME).pdf
create:
python util.py -c $(PROJECT)
ifeq ($(TYPE),single)
generate:
python util.py -g single -n $(PROJECT) -s $(NAME)
else ifeq ($(TYPE),essay)
generate:
python util.py -g essay -n $(PROJECT)
else
$(error Unknown TYPE: $(TYPE))
endif
$(CLSFILES): $(SOURCES)
xelatex $(PACKAGE).ins
ifeq ($(METHOD),latexmk)
$(PACKAGE).pdf: $(SOURCES) $(CLSFILES) FORCE_MAKE
$(METHOD) $(LATEXMKOPTS) $(PACKAGE).dtx
$(NAME).pdf: $(CONTENTS) $(CLSFILES) FORCE_MAKE
$(METHOD) $(LATEXMKOPTS) $(NAME)
else
$(error Unknown METHOD: $(METHOD))
endif
cleanred:
-@$(RM) *~
-@$(RM) .DS_Store
-@$(RM) parts/*/.DS_Store
-@$(RM) *.aux *.fdb_latexmk *.fls *.log *.out
clean: cleanred
latexmk -c $(PACKAGE).dtx $(NAME)
-@$(RM) parts/*.aux
-@$(RM) parts/$(PROJECT)/*.aux
distclean: cleanred
-@$(RM) *.pdf *.tex
-@$(RM) $(CLSFILES)
-@$(RM) -r dist