-
Notifications
You must be signed in to change notification settings - Fork 63
/
Makefile
55 lines (42 loc) · 1.21 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
MAIN = main
NAME = cjc
CLSFILES = $(NAME).cls
BSTFILES = $(NAME).bst
SHELL = bash
LATEXMK = latexmk -xelatex
VERSION = $(shell cat $(NAME).dtx | egrep -o "\[\d\d\d\d/\d\d\/\d\d v.+\]" \
| egrep -o "v\S+")
TEXMF = $(shell kpsewhich --var-value TEXMFHOME)
.PHONY : main cls doc test save clean all install distclean zip FORCE_MAKE
main : $(MAIN).pdf
all : main doc
cls : $(CLSFILES) $(BSTFILES)
doc : $(NAME).pdf
$(MAIN).pdf : $(MAIN).tex $(CLSFILES) $(BSTFILES) FORCE_MAKE
$(LATEXMK) $<
$(NAME).cls : $(NAME).dtx
xetex $<
$(NAME).pdf : $(NAME).dtx FORCE_MAKE
$(LATEXMK) $<
clean :
$(LATEXMK) -c $(MAIN).tex
$(LATEXMK) -c $(NAME).dtx
rm -rf build
distclean :
$(LATEXMK) -C $(MAIN).tex
$(LATEXMK) -C $(NAME).dtx
rm -rf build
install : cls doc
mkdir -p $(TEXMF)/{doc,source,tex}/latex/$(NAME)
mkdir -p $(TEXMF)/bibtex/bst/$(NAME)
cp $(BSTFILES) $(TEXMF)/bibtex/bst/$(NAME)
cp $(NAME).pdf $(TEXMF)/doc/latex/$(NAME)
cp $(NAME).dtx $(TEXMF)/source/latex/$(NAME)
cp $(CLSFILES) $(TEXMF)/tex/latex/$(NAME)
zip : main doc
ln -sf . $(NAME)
zip -r ../$(NAME)-$(VERSION).zip $(NAME)/{README.md,LICENSE,\
$(NAME).dtx,$(NAME).pdf,$(NAME).cls,$(NAME).bst,figures,\
$(MAIN).tex,$(MAIN).pdf,\
latexmkrc,Makefile}
rm $(NAME)