-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
70 lines (60 loc) · 2.2 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
.PHONY: example package clean \
install-texlive \
uninstall-texlive
SHELL = bash
BUILD-DIR = _build
PDFLATEX = pdflatex -output-directory=$(BUILD-DIR)
example.pdf:
$(eval TEXFILE := $(BUILD-DIR)/example.tex)
$(eval PDFFILE := $(BUILD-DIR)/example.pdf)
mkdir -p $(BUILD-DIR)
cp example.tex $(TEXFILE)
$(PDFLATEX) $(TEXFILE)
$(PDFLATEX) $(TEXFILE)
$(PDFLATEX) $(TEXFILE)
mv $(PDFFILE) .
example-aspect%.pdf:
$(eval TEXFILE := $(BUILD-DIR)/example-aspect$*.tex)
$(eval PDFFILE := $(BUILD-DIR)/example-aspect$*.pdf)
mkdir -p $(BUILD-DIR)
tail --lines=+2 example.tex | cat <(echo "\documentclass[aspectratio=$*]{beamer}") - > $(TEXFILE)
$(PDFLATEX) $(TEXFILE)
$(PDFLATEX) $(TEXFILE)
$(PDFLATEX) $(TEXFILE)
mv $(PDFFILE) .
example: example.pdf $(foreach ar, 32 43 54 149 169 1610, example-aspect$(ar).pdf)
# Builds a .zip package according to CTAN guidelines:
# https://ctan.org/help/upload-pkg
package:
$(eval PKG-DIR := $(BUILD-DIR)/_package)
rm -rf $(PKG-DIR)
mkdir -p $(PKG-DIR)
mkdir $(PKG-DIR)/kth-beamer
cp *kth.sty README.md $(PKG-DIR)/kth-beamer
cp -r img $(PKG-DIR)/kth-beamer/img
cd $(PKG-DIR) && zip -r kth-beamer.zip kth-beamer
mv $(PKG-DIR)/kth-beamer.zip .
# Locally install for texlive on Linux
install-texlive:
$(eval PWD := $(shell pwd -P))
$(eval TEXMFHOME := $(shell kpsewhich --var-value TEXMFHOME))
$(eval TEXMFLOCAL := $(shell kpsewhich --var-value TEXMFLOCAL))
$(eval TEXMFDIST := $(shell kpsewhich --var-value TEXMFDIST))
@echo "Locally installing kth-beamer for texlive."
@echo -e "(\033[1;31mEXPERIMENTAL FEATURE.\033[0m For testing purposes only. Use CTAN package otherwise.)"
@read -p "Are you sure you want to proceed? [y/N] " choice && if [[ "$${choice,,}" != "y" ]]; then exit 1; fi
@echo "TEXMFHOME = $(TEXMFHOME)"
@echo "TEXMFLOCAL = $(TEXMFLOCAL)"
@echo "TEXMFDIST = $(TEXMFDIST)"
$(eval INSTALL_ROOT := /usr/local/share/texmf/tex/latex)
@echo "Installing package at $(INSTALL_ROOT)"
mkdir -p $(INSTALL_ROOT)
cd $(INSTALL_ROOT) && unzip $(PWD)/kth-beamer.zip
mktexlsr
uninstall-texlive:
$(eval INSTALL_PATH := /usr/local/share/texmf/tex/latex/kth-beamer)
@echo "Uninstalling package at $(INSTALL_PATH)"
rm -r $(INSTALL_PATH)
mktexlsr
clean:
git clean -Xdf