forked from akkyie/thesis
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
66 lines (52 loc) · 1.5 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
BUILD_DIR = ./build
SRC_DIR = ./src
SRCS = $(shell ls $(SRC_DIR)/*.tex)
SHELL_DIR = ./shell
MAIN_TEX = $(SRC_DIR)/thesis.tex
MAIN_PDF = $(MAIN_TEX:$(SRC_DIR)/%.tex=$(BUILD_DIR)/%.pdf)
REDPEN := $(if $(REDPEN),$(REDPEN),redpen --conf redpen-conf.xml --result-format xml)
.PHONY: build
build: $(MAIN_PDF)
.PHONY: $(MAIN_PDF)
$(MAIN_PDF): $(BUILD_DIR)/$(SRC_DIR)
latexmk -pdfdvi $(PREVIEW_CONTINUOUSLY) -use-make $(MAIN_TEX)
# build/src ディレクトリがないとビルドに失敗する
$(BUILD_DIR)/$(SRC_DIR):
mkdir -p $@
.PHONY: watch
watch: PREVIEW_CONTINUOUSLY=-pvc
watch: build
.PHONY: redpen
redpen: redpen.ja redpen.en
redpen.%: $(shell echo $(SRC_DIR)/*.%.tex)
$(REDPEN) \
--result-format xml \
--lang ja \
--conf redpen/redpen-conf-$(subst redpen.,,$@).xml \
$^ > build/[email protected]
@echo "<!-- generated by 'make $@' -->" >> build/[email protected]
.PHONY: clean
clean:
@$(RM) -rf $(BUILD_DIR)/*
.PHONY: lint
lint:
npm install -D textlint-rule-no-mix-dearu-desumasu
npm install -D textlint-rule-no-dropping-the-ra
npm install -D textlint-rule-preset-ja-technical-writing
npm install -D textlint-plugin-latex2e
npm install -D textlint-filter-rule-comments
npm run lint
.PHONY: convert-img-pdf
convert-img-pdf:
sh $(SHELL_DIR)/convert-img-pdf.sh
.PHONY: build-with-convert-img
build-with-convert-img:
make convert-img-pdf
make build
.PHONY: word_count
word_count:
detex ./src/thesis.tex | wc -m
detex ./src/thesis.tex | wc -w
# .PHONY: sed-punctuation
# sed-punctuation:
# sh $(SHELL_DIR)/sed-punctuation.sh