This repository has been archived by the owner on Sep 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
55 lines (45 loc) · 1.68 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
###########################################################
# Makefile for compiling a conference / journal paper
# Author: Yuki Furuta <[email protected]>
# Date: 2015/11/12
###########################################################
TARGET := main
OS := $(shell uname -s)
VERSION := $(shell lsb_release -rs 2> /dev/null)
LATEXMK := $(shell command -v latexmk 2> /dev/null)
LATEXMK_OPTION := -time -recorder -rules
LATEXMK_EXEC := latexmk $(LATEXMK_OPTION)
.PHONY: all install preview forever publish pub clean wipe
all: install
$(LATEXMK_EXEC) -pvc- $(TARGET)
preview: install
$(LATEXMK_EXEC) -pv $(TARGET)
forever: install
$(LATEXMK_EXEC) -pvc $(TARGET)
%.tex.orig: %.tex
sed -i.orig -e's/、/,/g' -e's/。/./g' $<
publish: $(addsuffix .orig, $(wildcard *.tex src/*.tex)) all
pub: publish
clean: install
$(LATEXMK_EXEC) -c
wipe: install clean
$(LATEXMK_EXEC) -C
git clean -X -f -i -e '.tex' -e '.tex.orig'
install:
ifndef LATEXMK
@echo 'installing components...'
ifeq ($(OS), Linux)
ifeq ($(VERSION), )
$(error lsb-release is not installed)
else ifeq ($(VERSION), 12.04)
sudo apt-get install -y -qq texlive texlive-lang-cjk texlive-science texlive-fonts-recommended texlive-fonts-extra xdvik-ja dvipsk-ja gv latexmk
else ifeq ($(VERSION), 14.04)
sudo apt install -y -qq texlive texlive-lang-cjk texlive-science texlive-fonts-recommended texlive-fonts-extra xdvik-ja dvipsk-ja gv latexmk
else
sudo apt install -y -qq texlive texlive-lang-cjk texlive-lang-japanese texlive-science texlive-fonts-recommended texlive-fonts-extra xdvik-ja gv latexmk
endif
endif
ifeq ($(OS), Darwin)
brew tap caskroom/cask && brew cask install -v mactex && sudo tlmgr update --self --all
endif
endif