This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
generated from pddg/latex-template-ja
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
84 lines (68 loc) · 1.6 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
81
82
83
84
MAIN_SRC=main
USE_DOCKER?=yes
DOCKER_IMAGE=pddg/latex:2.0.0
# TeX sources
STY_SRCS=$(wildcard ./*.sty)
BIB_SRCS=$(wildcard ./*.bst) $(wildcard ./*.bib)
TEX_SRCS=$(wildcard ./*.tex) $(wildcard */*.tex)
# Figures
FIG_DIR=figures
FIG_PNG=$(wildcard $(FIG_DIR)/*.png)
FIG_JPG=$(wildcard $(FIG_DIR)/*.jpg) $(wildcard $(FIG_DIR)/*.JPG) $(wildcard $(FIG_DIR)/*.jpeg)
FIG_EPS=$(wildcard $(FIG_DIR)/*.eps)
FIG_PDF=$(wildcard $(FIG_DIR)/*.pdf)
FIGS=$(FIG_PNG) $(FIG_JPG) $(FIG_EPS) $(FIG_PDF)
ifeq "$(OS)" "Windows_NT"
# Windows uses Docker Desktop.
UIDOPT=
else
UNAME=$(shell uname)
ifeq "$(UNAME)" "Linux"
# Exec docker with the UID and GID as same as the login user.
UID=$(shell id -u)
GID=$(shell id -g)
UIDOPT=-u $(UID):$(GID)
else
# This section is for macOS. It uses Docker Desktop, too.
UIDOPT=
endif
endif
DOCKER_CMD=docker run --rm $(UIDOPT) -v $(CURDIR):/workdir $(DOCKER_IMAGE)
ifeq "$(USE_DOCKER)" "yes"
LATEXMK_CMD=$(DOCKER_CMD) latexmk
WATCH_OPTION=-pvc -view=none
else
LATEXMK_CMD=latexmk
WATCH_OPTION=-pvc
endif
.DEFAULT_GOAL := pdf
.PHONY: all
all: clean pdf
.PHONY: pdf
pdf: $(MAIN_SRC).pdf
$(MAIN_SRC).pdf: $(TEX_SRCS) $(STY_SRCS) $(BIB_SRCS) $(FIGS)
$(LATEXMK_CMD)
target=$(MAIN_SRC).tex
.PHONY: watch
watch:
$(LATEXMK_CMD) $(WATCH_OPTION) $(target)
.PHONY: clean
clean:
$(LATEXMK_CMD) -C $(TEX_SRCS)
.latexmkrc:
$(DOCKER_CMD) cp /.latexmkrc ./
.PHONY: latexmkrc
latexmkrc: .latexmkrc
.PHONY: lint
lint:
npm run lint
.PHONY: fix
fix:
npm run fix
branch=wip
.PHONY: draft
draft:
git checkout -b $(branch)
git commit -m "WIP" --allow-empty
git push -u origin $(branch)
hub compare