Skip to content

Commit

Permalink
Organize files into directories
Browse files Browse the repository at this point in the history
  • Loading branch information
rchurchley committed Sep 21, 2015
1 parent e73a6dc commit 0ffc294
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 37 deletions.
80 changes: 43 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,64 +1,70 @@
TEXMFHOME = $(shell kpsewhich -var-value=TEXMFHOME)
INSTALL_DIR = $(TEXMFHOME)/tex/latex/mtheme
DOC_DIR = $(TEXMFHOME)/doc/latex/mtheme
TEMP_DIR = .temptex

INS = mtheme.ins
DEMO_SRC = demo.tex
DEMO_PDF = demo.pdf
DOC_SRC = mtheme.dtx
DOC_PDF = mtheme.pdf
DTX = $(wildcard *.dtx)
STY = $(patsubst %.dtx,%.sty,$(wildcard beamer*.dtx pgfplotsthemetol.dtx))
INS = source/beamerthemem.ins
PACKAGE_SRC = $(wildcard source/*.dtx)
PACKAGE_STY = $(notdir $(PACKAGE_SRC:%.dtx=%.sty))
DEMO_SRC = demo/demo.tex demo/demo.bib
DEMO_PDF = demo/demo.pdf
DOC_SRC = doc/metropolistheme.dtx
DOC_PDF = doc/metropolistheme.pdf

CTAN_CONTENT = $(INS) $(DTX) $(DOC_PDF)

TEXC := latexmk -xelatex -output-directory=$(TEMP_DIR)
TEXMFHOME = $(shell kpsewhich -var-value=TEXMFHOME)
INSTALL_DIR = $(TEXMFHOME)/tex/latex/mtheme
DOC_DIR = $(TEXMFHOME)/doc/latex/mtheme
TEMP_DIR = $(shell pwd)/.latex-cache

DOCKER_IMAGE = latex-image
DOCKER_CONTAINER = latex-container

COMPILE_TEX := TEXINPUTS=".//:$$TEXINPUTS" latexmk -xelatex -output-directory=$(TEMP_DIR)

.PHONY: sty doc demo ctan clean install uninstall docker-run docker-build docker-rm

all: sty doc demo
.PHONY: all clean sty doc demo install uninstall ctan docker-run docker-build docker-rm

$(STY): $(DTX) $(INS)
@latex $(INS)
all: sty doc

$(DEMO_PDF): $(STY) $(DEMO_SRC)
$(TEXC) $(DEMO_SRC)
@cp $(TEMP_DIR)/$(DEMO_PDF) .

$(DOC_PDF): $(DOC_SRC) $(DTX)
@$(TEXC) $(DOC_SRC)
@cp $(TEMP_DIR)/$(DOC_PDF) .
clean:
@rm -f $(TEMP_DIR)/*
@rm -f $(PACKAGE_STY)

sty: $(STY)
sty: $(PACKAGE_STY)

doc: $(DOC_PDF)

demo: $(DEMO_PDF)

install: $(PACKAGE_STY) $(DOC_PDF)
@mkdir -p $(INSTALL_DIR)
@cp $(PACKAGE_STY) $(INSTALL_DIR)
@mkdir -p $(DOC_DIR)
@cp $(DOC_PDF) $(DOC_DIR)

uninstall:
@rm -f $(addprefix $(INSTALL_DIR)/, $(PACKAGE_STY))
@rmdir $(INSTALL_DIR)
@rm -f $(DOC_DIR)/$(DOC_PDF)
@rmdir $(DOC_DIR)

ctan: $(CTAN_CONTENT)
@mkdir -p mtheme
@cp $(CTAN_CONTENT) mtheme/
@zip -q mtheme-$(shell grep -A1 ProvidesPackage < beamerthemem.dtx | grep -P -o '\d\.\d\.\d').zip mtheme/*
@rm -rf mtheme

clean:
@git clean -xfd
$(TEMP_DIR):
@mkdir -p $(TEMP_DIR)

install: $(STY) $(DOC_PDF)
@mkdir -p $(INSTALL_DIR)
@cp $(STY) $(INSTALL_DIR)
@mkdir -p $(DOC_DIR)
@cp $(DOC_PDF) $(DOC_DIR)
$(PACKAGE_STY): $(PACKAGE_SRC) $(INS) | $(TEMP_DIR)
@cd $(dir $(INS)) && latex -output-directory=$(TEMP_DIR) $(notdir $(INS))
@cp $(addprefix $(TEMP_DIR)/,$(PACKAGE_STY)) .

uninstall:
@rm -f $(addprefix $(INSTALL_DIR)/, $(STY))
@rm -f $(DOC_DIR)/$(DOC_PDF)
@rmdir $(INSTALL_DIR)
@rmdir $(DOC_DIR)
$(DOC_PDF): $(DOC_SRC) $(PACKAGE_STY) | $(TEMP_DIR)
@$(COMPILE_TEX) $(DOC_SRC)
@cp $(TEMP_DIR)/$(notdir $(DOC_PDF)) $(DOC_PDF)

$(DEMO_PDF): $(DEMO_SRC) $(PACKAGE_STY) | $(TEMP_DIR)
$(COMPILE_TEX) $(DEMO_SRC)
@cp $(TEMP_DIR)/$(notdir $(DEMO_PDF)) $(DEMO_PDF)

docker-run: docker-build
docker run --rm=true --name $(DOCKER_CONTAINER) -i -t -v `pwd`:/data $(DOCKER_IMAGE) make
Expand Down
Binary file removed demo.pdf
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed mtheme.pdf
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0ffc294

Please sign in to comment.