| 1 | INS = beamercolorthemeowl.ins |
| 2 | PACKAGE_SRC = beamercolorthemeowl.dtx |
| 3 | PACKAGE_STY = beamercolorthemeowl.sty |
| 4 | DOC_SRC = beamercolorthemeowl.dtx |
| 5 | DOC_PDF = beamercolorthemeowl.pdf |
| 6 | |
| 7 | DESTDIR ?= $(shell kpsewhich -var-value=TEXMFHOME) |
| 8 | INSTALL_DIR = $(DESTDIR)/tex/latex/beamercolorthemeowl |
| 9 | DOC_DIR = $(DESTDIR)/doc/latex/beamercolorthemeowl |
| 10 | CACHE_DIR := .latex-cache |
| 11 | |
| 12 | COMPILE_TEX := latexmk -pdf -output-directory=$(CACHE_DIR) |
| 13 | |
| 14 | .PHONY: all sty doc install uninstall clean clean-cache clean-sty |
| 15 | |
| 16 | all: sty doc |
| 17 | |
| 18 | sty: $(PACKAGE_STY) |
| 19 | |
| 20 | doc: $(DOC_PDF) |
| 21 | |
| 22 | demo: $(DEMO_PDF) |
| 23 | |
| 24 | clean: clean-cache clean-sty |
| 25 | |
| 26 | install: $(PACKAGE_STY) $(DOC_PDF) |
| 27 | @mkdir -p $(INSTALL_DIR) |
| 28 | @cp $(PACKAGE_STY) $(INSTALL_DIR) |
| 29 | @mkdir -p $(DOC_DIR) |
| 30 | @cp $(DOC_PDF) $(DOC_DIR) |
| 31 | |
| 32 | uninstall: |
| 33 | @rm -f $(addprefix $(INSTALL_DIR)/, $(PACKAGE_STY)) |
| 34 | @rmdir $(INSTALL_DIR) |
| 35 | @rm -f $(DOC_DIR)/$(notdir $(DOC_PDF)) |
| 36 | @rmdir $(DOC_DIR) |
| 37 | |
| 38 | clean-cache: |
| 39 | @rm -f $(CACHE_DIR)/* |
| 40 | |
| 41 | clean-sty: |
| 42 | @rm -f $(PACKAGE_STY) |
| 43 | |
| 44 | $(CACHE_DIR): |
| 45 | @mkdir -p $(CACHE_DIR) |
| 46 | |
| 47 | $(PACKAGE_STY): $(PACKAGE_SRC) $(INS) | $(CACHE_DIR) clean-cache |
| 48 | @cd $(dir $(INS)) && latex -output-directory=$(CACHE_DIR) $(notdir $(INS)) |
| 49 | @cp $(addprefix $(CACHE_DIR)/,$(PACKAGE_STY)) . |
| 50 | |
| 51 | $(DOC_PDF): %.pdf: %.dtx $(PACKAGE_STY) | $(CACHE_DIR) clean-cache |
| 52 | $(COMPILE_TEX) $< |
| 53 | @cp $(CACHE_DIR)/$(notdir $@) $@ |
| 54 |