-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (29 loc) · 885 Bytes
/
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
BUILD_DIR = ./build
SRC_DIR = ./src
SRCS = $(shell ls $(SRC_DIR)/*.tex)
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.$(subst redpen.,,$@).xml \
$^ > build/[email protected]
@echo "<!-- generated by 'make $@' -->" >> build/[email protected]
.PHONY: clean
clean:
@$(RM) -rf $(BUILD_DIR)/*