-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (55 loc) · 1.57 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
# WARNING: target end with `!` will modify source code
PACKAGE := useclass
EXT := sty
SOURCE := $(PACKAGE).dtx
TAG ?= $(shell git describe --tags --abbrev=0)
TEX := tex -interaction=nonstopmode -shell-escape
LATEX := pdflatex -interaction=nonstopmode -shell-escape
LATEXMK := latexmk -pdf -quiet -outdir=. -auxdir=.
L3BUILD := l3build
ZIP := zip
GIT := git
ifeq ($(OS), Windows_NT)
RM := cmd //C del //Q //F
RRM := cmd //C rmdir //Q //S
else
RM := rm -f
RRM := rm -r -f
endif
%.ins %.$(EXT): %.dtx
$(TEX) $<
%.pdf: %.dtx %.$(EXT)
$(LATEX) $<
.DEFAULT_GOAL = build
.PHONY: all build install full-install uninstall doc tag! ctan! release! clean cleanall
all: build doc full-install
build: $(PACKAGE).$(EXT)
install:
$(L3BUILD) install
full-install:
$(L3BUILD) install --full
uninstall:
$(L3BUILD) uninstall
doc: $(PACKAGE).pdf
tag!: # `make tag! TAG=1.0.0` [WARN: WILL MODIFY SOURCE CODE]
@if ! $(GIT) diff --quiet $(SOURCE); then \
echo "Error: Unstaged changes in $(SOURCE)"; \
exit 1; \
fi
@if ! $(GIT) diff --staged --quiet $(SOURCE); then \
echo "Error: Uncommitted changes in $(SOURCE)"; \
exit 1; \
fi
$(L3BUILD) tag $(TAG)
ctan: tag! build # CTAN currently requires that the .tds.zip file be excluded
$(L3BUILD) ctan
$(ZIP) -d $(PACKAGE)-ctan.zip $(PACKAGE).tds.zip
$(GIT) restore $(SOURCE)
release!: tag! build ctan # release to GitHub
clean:
$(LATEXMK) -c $(PACKAGE).dtx
$(RM) *.aux *.fdb_latexmk *.fls *.glo *.synctex.gz \
*.hd *.idx *.ind *.log *.out *.pdf *.toc *.xdv
$(RM) *.cls *.ins *.sty *.zip
cleanall: clean uninstall
$(RRM) build/