-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
65 lines (45 loc) · 1.76 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
PROJECT = modernposter
SRC = modernposter.cls
DOC_SRC = doc/modernposter.tex
DOC_PDF = $(DOC_SRC:%.tex=%.pdf)
DEMO_SRC = demo.tex
DEMO_PDF = $(DEMO_SRC:%.tex=%.pdf)
README = README.md
ARCHIVE = modernposter.zip
TEMP_DIR = .temp
LATEXMK_FLAGS = -pdf -quiet -output-directory=$(TEMP_DIR)
LATEXMK = latexmk $(LATEXMK_FLAGS)
TEXMF_SRC = ~/texmf/tex/latex/modernposter/
TEXMF_DOC = ~/texmf/doc/latex/modernposter/
CTAN_CONTENT = $(README) $(SRC) $(DOC_SRC) $(DOC_PDF) $(DEMO_SRC) $(DEMO_PDF)
VERSION := $(shell cat version)
BUILD_FILE = build
BUILD := $(shell cat $(BUILD_FILE))
all: archive
ctan: clean ctan-version archive
doc: $(DOC_PDF) $(DEMO_PDF)
install: $(DOC_PDF)
@mkdir -p $(TEXMF_SRC)
@mkdir -p $(TEXMF_DOC)
@cp $(SRC) $(TEXMF_SRC)
@cp $(DOC_PDF) $(TEXMF_DOC)
uninstall:
@rm -rf $(TEXMF_SRC) $(TEXMF_DOC)
clean:
@rm -rf $(TEMP_DIR) $(DOC_PDF) $(DEMO_PDF) $(ARCHIVE) $(PROJECT)
archive: doc
@mkdir $(PROJECT)
@echo $(CTAN_CONTENT) | xargs -n1 -I % cp % $(PROJECT)
@sed -i '' -e 's@and some parts of the Makefile are@is@' $(PROJECT)/$(notdir $(README))
@zip --quiet -r $(ARCHIVE) $(PROJECT)
@rm -rf $(PROJECT)
ctan-version:
@echo $(SRC) $(README) | xargs -n1 -I % sed -i '' -e 's@20[0-9][0-9]/[0-9]*/[0-9]* v[0-9]*.[0-9]*.[0-9]*@$(shell date "+%Y/%m/%d") v$(VERSION).$(BUILD)@' %
@echo $(DOC_SRC) $(DEMO_SRC) $(SRC) | xargs -n1 -I % sed -i '' -e 's@[0-9]*.[0-9]*.[0-9]* 20[0-9][0-9]/[0-9]*/[0-9]*@$(VERSION).$(BUILD) $(shell date "+%Y/%m/%d")@' %
@echo $$(($(BUILD) + 1)) > $(BUILD_FILE)
$(DOC_PDF):
$(LATEXMK) $(DOC_SRC)
@cp $(TEMP_DIR)/$(notdir $(DOC_PDF)) $(dir $(DOC_PDF))
$(DEMO_PDF):
$(LATEXMK) $(DEMO_SRC)
@cp $(TEMP_DIR)/$(notdir $(DEMO_PDF)) $(dir $(DEMO_PDF))