| 1 |
MAKEFLAGS := -j 1 |
| 2 |
|
| 3 |
INS = source/beamerthemetrigon.ins |
| 4 |
PACKAGE_SRC = $(wildcard source/*.dtx) |
| 5 |
PACKAGE_STY = $(notdir $(PACKAGE_SRC:%.dtx=%.sty)) |
| 6 |
|
| 7 |
DEMO_SRC = demo/trigon_demo.tex |
| 8 |
DEMO_PDF = demo/trigon_demo.pdf |
| 9 |
DEMO_ALT_SRC= demo/trigon_demo_alt.tex |
| 10 |
DEMO_ALT_PDF= demo/trigon_demo_alt.pdf |
| 11 |
DEMO_SRC_OTHER = demo/frames.tex \ |
| 12 |
demo/library.jpg \ |
| 13 |
demo/trigon_full.pdf \ |
| 14 |
demo/trigon_small.pdf |
| 15 |
|
| 16 |
DOC_SRC = docs/trigontheme.dtx |
| 17 |
DOC_PDF = docs/trigontheme.pdf |
| 18 |
|
| 19 |
LAYOUTS_SRC = screenshots/trigon_layouts.tex |
| 20 |
LAYOUTS_PDF = screenshots/trigon_layouts.pdf |
| 21 |
LAYOUTS_IMG := screenshots/layout_example-01.jpg \ |
| 22 |
screenshots/layout_example-02.jpg \ |
| 23 |
screenshots/layout_example-03.jpg |
| 24 |
|
| 25 |
TESTS_DIR = tests/ |
| 26 |
TESTS_SRC = $(wildcard tests/test-*.tex) |
| 27 |
TESTS_PDF = $(notdir $(TESTS_SRC:%.tex=%.pdf)) |
| 28 |
|
| 29 |
CTAN_CONTENT = README.md Makefile $(INS) $(PACKAGE_SRC) $(DOC_SRC) $(DOC_PDF) $(DEMO_SRC) $(DEMO_SRC_OTHER) $(DEMO_PDF) |
| 30 |
|
| 31 |
DESTDIR ?= $(shell kpsewhich -var-value=TEXMFHOME) |
| 32 |
INSTALL_DIR = $(DESTDIR)/tex/latex/beamertheme-trigon |
| 33 |
DOC_DIR = $(DESTDIR)/doc/latex/beamertheme-trigon |
| 34 |
LATEXMK_CONF = $(shell pwd)/latexmkrc |
| 35 |
CACHE_DIR := $(shell pwd)/.latex-cache |
| 36 |
|
| 37 |
COMPILE_TEX := latexmk -xelatex -cd |
| 38 |
CLEAN_TEX := latexmk -c -cd |
| 39 |
CLEAN_PDF := latexmk -C -cd |
| 40 |
|
| 41 |
export TEXINPUTS:=$(shell pwd):$(shell pwd)//:${TEXINPUTS} |
| 42 |
|
| 43 |
.PHONY: all sty doc demo layouts screenshots tests clean install uninstall ctan clean-cache clean-sty Clean pkg-version |
| 44 |
|
| 45 |
all: sty layouts doc demo |
| 46 |
|
| 47 |
sty: $(PACKAGE_STY) |
| 48 |
|
| 49 |
doc: $(DOC_PDF) |
| 50 |
|
| 51 |
demo: $(DEMO_PDF) $(DEMO_ALT_PDF) |
| 52 |
|
| 53 |
layouts: $(LAYOUTS_IMG) |
| 54 |
|
| 55 |
screenshots: $(LAYOUTS_SRC) $(DEMO_PDF) $(DEMO_ALT_PDF) |
| 56 |
@cd $(dir $(DEMO_PDF)) && pdftoppm $(notdir $(DEMO_PDF)) trigon_demo -jpeg |
| 57 |
@cd $(dir $(DEMO_ALT_PDF)) && pdftoppm $(notdir $(DEMO_ALT_PDF)) trigon_demo_alt -jpeg |
| 58 |
@mv $(dir $(DEMO_PDF))trigon_demo*-{01,03,04,07,09,13}.jpg $(dir $(LAYOUTS_SRC))/. |
| 59 |
@rm $(dir $(DEMO_PDF))trigon_demo*.jpg |
| 60 |
|
| 61 |
tests: $(TESTS_PDF) |
| 62 |
|
| 63 |
clean: clean-cache clean-sty |
| 64 |
|
| 65 |
Clean: clean clean-pdf clean-img |
| 66 |
|
| 67 |
install: $(PACKAGE_STY) $(DOC_PDF) |
| 68 |
@mkdir -p $(INSTALL_DIR) |
| 69 |
@cp $(PACKAGE_STY) $(INSTALL_DIR) |
| 70 |
@mkdir -p $(DOC_DIR) |
| 71 |
@cp $(DOC_PDF) $(DOC_DIR) |
| 72 |
|
| 73 |
uninstall: |
| 74 |
@rm -f "$(addprefix $(INSTALL_DIR)/, $(PACKAGE_STY))" |
| 75 |
@rmdir "$(INSTALL_DIR)" |
| 76 |
@rm -f "$(DOC_DIR)/$(notdir $(DOC_PDF))" |
| 77 |
@rmdir "$(DOC_DIR)" |
| 78 |
|
| 79 |
clean-cache: |
| 80 |
@rm -rf "$(CACHE_DIR)" |
| 81 |
$(CLEAN_TEX) $(PACKAGE_SRC) $(DEMO_SRC) $(DEMO_ALT_SRC) $(DOC_SRC) $(LAYOUTS_SRC) $(TESTS_SRC) |
| 82 |
|
| 83 |
clean-pdf: |
| 84 |
$(CLEAN_PDF) $(PACKAGE_SRC) $(DEMO_SRC) $(DEMO_ALT_SRC) $(DOC_SRC) $(LAYOUTS_SRC) $(TESTS_SRC) |
| 85 |
|
| 86 |
clean-sty: |
| 87 |
@rm -f $(PACKAGE_STY) |
| 88 |
|
| 89 |
clean-img: |
| 90 |
@rm -f $(dir $(LAYOUTS_SRC))/*.jpg |
| 91 |
|
| 92 |
|
| 93 |
ctan: $(CTAN_CONTENT) pkg-version |
| 94 |
@tar --transform "s@\(.*\)@trigon/\1@" -cf trigon-$(shell date "+%Y-%m-%d").tar.gz $(CTAN_CONTENT) |
| 95 |
|
| 96 |
pkg-version: |
| 97 |
@sed -i 's@v\([0-9]\{1,\}\.\)\{1,\}[0-9]\{1,\}@$(shell git describe --abbrev=0 --tags)@g' $(PACKAGE_SRC) |
| 98 |
@sed -i 's@\[20[0-9][0-9]/[0-9]*/[0-9]*@\[$(shell date "+%Y/%m/%d")@g' $(PACKAGE_SRC) |
| 99 |
|
| 100 |
$(CACHE_DIR): |
| 101 |
@mkdir -p $(CACHE_DIR) |
| 102 |
|
| 103 |
$(PACKAGE_STY): $(PACKAGE_SRC) $(INS) | clean-cache $(CACHE_DIR) |
| 104 |
@cd $(dir $(INS)) && latex -output-directory=$(CACHE_DIR) $(notdir $(INS)) |
| 105 |
@cp $(addprefix $(CACHE_DIR)/,$(PACKAGE_STY)) . |
| 106 |
|
| 107 |
$(DOC_PDF): $(DOC_SRC) $(PACKAGE_STY) $(LAYOUTS_IMG) |
| 108 |
$(CLEAN_TEX) $(DOC_SRC) |
| 109 |
$(COMPILE_TEX) $(DOC_SRC) |
| 110 |
|
| 111 |
$(DEMO_PDF): $(LAYOUTS_IMG) $(DEMO_SRC) $(PACKAGE_STY) |
| 112 |
$(CLEAN_TEX) $(DEMO_SRC) |
| 113 |
$(COMPILE_TEX) $(DEMO_SRC) |
| 114 |
|
| 115 |
$(DEMO_ALT_PDF): $(LAYOUTS_IMG) $(DEMO_ALT_SRC) $(PACKAGE_STY) |
| 116 |
$(CLEAN_TEX) $(DEMO_ALT_SRC) |
| 117 |
$(COMPILE_TEX) $(DEMO_ALT_SRC) |
| 118 |
|
| 119 |
$(LAYOUTS_PDF): $(LAYOUTS_SRC) $(PACKAGE_STY) |
| 120 |
$(CLEAN_TEX) $(LAYOUTS_SRC) |
| 121 |
$(COMPILE_TEX) $(LAYOUTS_SRC) |
| 122 |
|
| 123 |
$(LAYOUTS_IMG): $(LAYOUTS_PDF) |
| 124 |
@cd $(dir $(LAYOUTS_PDF)) && pdftoppm $(notdir $(LAYOUTS_PDF)) layout_example -jpeg |
| 125 |
|
| 126 |
$(TESTS_PDF): $(TESTS_SRC) $(PACKAGE_STY) |
| 127 |
$(COMPILE_TEX) -quiet $(TESTS_SRC) |