blob: 0ba7eaad18679bfcfce8c22fde592f4c4bf87d30 (
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
# Makefile for contracard.
# Copied almost exactly from the fontspec makefile.
#### MAKEFILE CONFIG ####
SHELL = /bin/sh
.SUFFIXES:
.SILENT:
#### BEGIN ####
help:
@echo 'CONTRACARD makefile targets:'
@echo ' '
@echo ' help - (this message)'
@echo ' unpack - extracts all files'
@echo ' doc - compile documentation'
@echo ' gendoc - compile git-aware documentation'
@echo ' ctan - generate archive for CTAN'
@echo ' all - unpack & doc'
@echo ' world - all & ctan'
@echo ' clean - remove all generated and built files'
@echo ' preview - preview the documentation'
@echo ' '
@echo ' install - install the complete class into your home texmf tree'
@echo ' cls-install - install the class code only'
@echo ' install TEXMFROOT=<texmf> - install the class into the path <texmf>'
NAME = contracard
DOC = $(NAME).pdf
DTX = $(NAME).dtx
# Redefine this to print output if you need:
REDIRECT = > /dev/null
# Files grouped by generation mode
COMPILED = $(DOC)
UNPACKED = $(NAME).cls
SOURCE = $(DTX) Makefile README LICENSE
GENERATED = $(COMPILED) $(UNPACKED)
CTAN_FILES = $(SOURCE) $(COMPILED)
UNPACKED_DOC =
RUNFILES = $(filter-out $(UNPACKED_DOC), $(UNPACKED))
DOCFILES = $(COMPILED) README LICENSE $(UNPACKED_DOC)
SRCFILES = $(DTX) Makefile
ALL_FILES = $(RUNFILES) $(DOCFILES) $(SRCFILES)
# Installation locations
FORMAT = latex
RUNDIR = $(TEXMFROOT)/tex/$(FORMAT)/$(NAME)
DOCDIR = $(TEXMFROOT)/doc/$(FORMAT)/$(NAME)
SRCDIR = $(TEXMFROOT)/source/$(FORMAT)/$(NAME)
TEXMFROOT = $(shell kpsewhich --var-value TEXMFHOME)
CTAN_ZIP = $(NAME).zip
TDS_ZIP = $(NAME).tds.zip
ZIPS = $(CTAN_ZIP) $(TDS_ZIP)
DO_LATEX = pdflatex --interaction=nonstopmode $< $(REDIRECT)
DO_LATEX_WRITE18 = pdflatex --shell-escape --interaction=nonstopmode $< $(REDIRECT)
DO_TEX = tex --interaction=nonstopmode $< $(REDIRECT)
DO_MAKEINDEX = makeindex -s gind.ist $(subst .dtx,,$<) $(REDIRECT) 2>&1
DO_MAKECHANGES = makeindex -s gglo.ist -o $(NAME).gls $(NAME).glo $< $(REDIRECT) 2>&1
all: $(GENERATED)
doc: $(COMPILED)
unpack: $(UNPACKED)
ctan: $(CTAN_ZIP)
tds: $(TDS_ZIP)
world: all ctan
resources: by.png by-nc.png
by.png:
wget http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by.png
by-nc.png:
wget http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by-nc.png
gendoc: $(DTX) resources
@echo "Compiling documentation"
$(DO_LATEX_WRITE18)
$(DO_MAKEINDEX)
$(DO_MAKECHANGES)
while ($(DO_LATEX_WRITE18) ; \
grep -q "Rerun to get" $(NAME).log ) do true; \
done
COMMAND = command -v $(1) >/dev/null 2>&1
preview: $(DOC)
($(COMMAND) evince && evince $(NAME).pdf) || ($(COMMAND) open && open $(NAME).pdf)
$(DOC): $(DTX)
@echo "Compiling documentation"
$(DO_LATEX_WRITE18)
$(DO_MAKEINDEX)
$(DO_MAKECHANGES)
while ($(DO_LATEX_WRITE18) ; \
grep -q "Rerun to get" $(NAME).log ) do true; \
done
$(UNPACKED): $(DTX)
@$(DO_TEX)
$(CTAN_ZIP): $(CTAN_FILES)
@echo "Making $@ for CTAN upload."
@$(RM) -- $@
@mkdir -p $(NAME)/
@cp $^ $(NAME)/
@zip -9 $@ $(NAME)/* >/dev/null
@rm -rf $(NAME)/
define run-install
@mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR)
@mkdir -p $(DOCDIR) && cp $(DOCFILES) $(DOCDIR)
@mkdir -p $(SRCDIR) && cp $(SRCFILES) $(SRCDIR)
endef
define run-cls-install
@mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR)
endef
$(TDS_ZIP): TEXMFROOT=./tmp-texmf
$(TDS_ZIP): $(ALL_FILES)
@echo "Making TDS-ready archive $@."
@$(RM) -- $@
$(run-install)
@cd $(TEXMFROOT) && zip -9 ../$@ -r . >/dev/null
@$(RM) -r -- $(TEXMFROOT)
# Rename the README for CTAN
README: README.md
cp $< $@
# Rename the LICENSE for CTAN
LICENSE: LICENSE.md
cp $< $@
.PHONY: install manifest clean mrproper
install: $(ALL_FILES)
@if test ! -n "$(TEXMFROOT)" ; then \
echo "Cannot locate your home texmf tree. Specify manually with\n\n make install TEXMFROOT=/path/to/texmf\n" ; \
false ; \
fi ;
@echo "Installing in '$(TEXMFROOT)'."
$(run-install)
cls-install: $(RUNFILES)
@if test ! -n "$(TEXMFROOT)" ; then \
echo "Cannot locate your home texmf tree. Specify manually with\n\n make install TEXMFROOT=/path/to/texmf\n" ; \
false ; \
fi ;
@echo "Installing in '$(TEXMFROOT)'."
$(run-install)
manifest:
@echo "Source files:"
@for f in $(SOURCE); do echo $$f; done
@echo ""
@echo "Derived files:"
@for f in $(GENERATED); do echo $$f; done
clean:
@$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg *.glo *.gls *.example *.out *.synctex* *.tmp *.cls *.sty *.ins *.pdf *.dvi README LICENSE *.lot *.png
@$(RM) -- $(GENERATED) $(ZIPS)
@$(RM) -- $(builddir)/*
#############
# TESTSUITE #
#############
#### Needed to compile and make stuff ####
builddir=build
lprefix=L
xprefix=X
both=F
COPY = cp -a
MOVE = mv -f
COMPARE_OPTS = -density 300x300 -metric ae -fuzz 35%
LTXSOURCE = $(NAME).cls
|