blob: 6d40e37f250c1a444291977808a89b293dee0bd6 (
plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
## Makefile for mahjong package
# Directories
BUILD=build
TEXBUILD=$(BUILD)/tex
OUT=out
TEXMF_HOME:= $(shell kpsewhich -var-value TEXMFHOME)
# TDS directories
TDS=$(BUILD)/tds
TDSDOC=$(TDS)/doc/latex/mahjong
TDSSRC=$(TDS)/source/latex/mahjong
TDSTEX=$(TDS)/tex/latex/mahjong
# CTAN directories
CTAN=$(BUILD)/ctan
CTAN_MAHJONG=$(CTAN)/mahjong
# Compilers
LATEX=latex -output-directory $(TEXBUILD)
LATEXMK=latexmk -lualatex -outdir=$(TEXBUILD) -auxdir=$(TEXBUILD) -interaction=nonstopmode -use-make
ZIP=zip -r
dir_guard=@mkdir -p $(@D)
.PHONY: all clean install
all: $(OUT)/mahjong-ctan.zip
clean:
rm -rf $(BUILD)
rm -rf $(OUT)
rm -f mahjong.sty
install: all
unzip $(CTAN)/mahjong.tds.zip -d $(TEXMF_HOME)
# Extract package from DTX source
$(TEXBUILD)/mahjong.sty: mahjong.ins mahjong.dtx
$(dir_guard)
$(LATEX) $<
# Compile documentation
$(TEXBUILD)/%.pdf: %.tex $(TEXBUILD)/mahjong.sty tiles
$(LATEXMK) $<
$(LATEXMK) $<
%.gls: %.glo
makeindex -s gglo.ist -o $@ $<
# Move everything to TDS staging area where it belongs
$(TDSDOC)/%.pdf: $(TEXBUILD)/%.pdf
$(dir_guard)
cp $< $@
$(TDSDOC)/%.tex: %.tex
$(dir_guard)
cp $< $@
$(TDSDOC)/README.md: README.md
$(dir_guard)
cp $< $@
$(TDSDOC)/LICENSE: LICENSE
$(dir_guard)
cp $< $@
$(TDSSRC)/mahjong.dtx: mahjong.dtx
$(dir_guard)
cp $< $@
$(TDSSRC)/mahjong.ins: mahjong.ins
$(dir_guard)
cp $< $@
$(TDSSRC)/Makefile: Makefile
$(dir_guard)
cp $< $@
$(TDSTEX)/%.sty: $(TEXBUILD)/%.sty
$(dir_guard)
cp $< $@
$(TDSTEX)/tiles: tiles
cp -r $< $@
# Create TDS zip and moved it to CTAN staging area
$(CTAN)/mahjong.tds.zip: $(TDSDOC)/mahjong.pdf $(TDSDOC)/mahjong-code.pdf
$(CTAN)/mahjong.tds.zip: $(TDSDOC)/mahjong.tex $(TDSDOC)/mahjong-code.tex
$(CTAN)/mahjong.tds.zip: $(TDSDOC)/README.md $(TDSDOC)/LICENSE
$(CTAN)/mahjong.tds.zip: $(TDSSRC)/mahjong.ins $(TDSSRC)/mahjong.dtx $(TDSSRC)/Makefile
$(CTAN)/mahjong.tds.zip: $(TDSTEX)/mahjong.sty $(TDSTEX)/tiles
$(dir_guard)
cd $(TDS) && $(ZIP) $(@F) *
mv $(TDS)/$(@F) $@
# Move everything to CTAN staging area
$(CTAN_MAHJONG)/%.pdf: $(TDSDOC)/%.pdf
$(dir_guard)
cp $< $@
$(CTAN_MAHJONG)/%.tex: $(TDSDOC)/%.tex
$(dir_guard)
cp $< $@
$(CTAN_MAHJONG)/%: %
$(dir_guard)
cp -r $< $@
# Create final zip archive for upload to CTAN
$(OUT)/mahjong-ctan.zip: $(CTAN_MAHJONG)/mahjong.tex $(CTAN_MAHJONG)/mahjong.pdf
$(OUT)/mahjong-ctan.zip: $(CTAN_MAHJONG)/mahjong-code.tex $(CTAN_MAHJONG)/mahjong-code.pdf
$(OUT)/mahjong-ctan.zip: $(CTAN_MAHJONG)/README.md $(CTAN_MAHJONG)/LICENSE
$(OUT)/mahjong-ctan.zip: $(CTAN_MAHJONG)/mahjong.dtx $(CTAN_MAHJONG)/mahjong.ins
$(OUT)/mahjong-ctan.zip: $(CTAN_MAHJONG)/Makefile
$(OUT)/mahjong-ctan.zip: $(CTAN_MAHJONG)/tiles $(CTAN)/mahjong.tds.zip
$(dir_guard)
cd $(CTAN) && $(ZIP) $(@F) ./*
mv $(CTAN)/$(@F) $@
|