-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
193 lines (160 loc) · 6.52 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
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
CONTRIBUTION = newverbs
NAME = Martin Scharrer
EMAIL = martin.scharrer@web.de
DIRECTORY = /macros/latex/contrib/${CONTRIBUTION}
LICENSE = free
FREEVERSION = lppl
CTAN_FILE = ${CONTRIBUTION}.zip
export CONTRIBUTION VERSION NAME EMAIL SUMMARY DIRECTORY DONOTANNOUNCE ANNOUNCE NOTES LICENSE FREEVERSION CTAN_FILE
README = README.txt
MAINDTXS = ${CONTRIBUTION}.dtx
DTXFILES = ${MAINDTXS}
INSFILES = ${CONTRIBUTION}.ins
LTXFILES = ${CONTRIBUTION}.sty
MAINPDFS = ${CONTRIBUTION}.pdf
LTXDOCFILES = ${MAINPDFS} ${README}
LTXSRCFILES = ${DTXFILES} ${INSFILES}
PLAINFILES = #${CONTRIBUTION}.tex
PLAINDOCFILES = #${CONTRIBUTION}.?
PLAINSRCFILES = #${CONTRIBUTION}.?
GENERICFILES = #${CONTRIBUTION}.tex
GENDOCFILES = #${CONTRIBUTION}.?
GENSRCFILES = #${CONTRIBUTION}.?
SCRIPTFILES = #${CONTRIBUTION}.pl
SCRDOCFILES = #${CONTRIBUTION}.?
ALLFILES = ${DTXFILES} ${INSFILES} ${LTXFILES} ${LTXDOCFILES} ${LTXSRCFILES} \
${PLAINFILES} ${PLAINDOCFILES} ${PLAINSRCFILES} \
${GENERICFILES} ${GENDOCFILES} ${GENSRCFILES} \
${SCRIPTFILES} ${SCRDOCFILES}
MAINFILES = ${DTXFILES} ${INSFILES} ${LTXFILES}
CTANFILES = ${DTXFILES} ${INSFILES} ${LTXDOCFILES} ${PLAINDOCFILES} ${GENDOCFILES} ${SCRDOCFILES} DEPENDS.txt
TDSZIP = ${CONTRIBUTION}.tds.zip
TEXMF = ${HOME}/texmf
LTXDIR = ${TEXMF}/tex/latex/${CONTRIBUTION}/
LTXDOCDIR = ${TEXMF}/doc/latex/${CONTRIBUTION}/
LTXSRCDIR = ${TEXMF}/source/latex/${CONTRIBUTION}/
GENERICDIR = ${TEXMF}/tex/generic/${CONTRIBUTION}/
GENDOCDIR = ${TEXMF}/doc/generic/${CONTRIBUTION}/
GENSRCDIR = ${TEXMF}/source/generic/${CONTRIBUTION}/
PLAINDIR = ${TEXMF}/tex/plain/${CONTRIBUTION}/
PLAINDOCDIR = ${TEXMF}/doc/plain/${CONTRIBUTION}/
PLAINSRCDIR = ${TEXMF}/source/plain/${CONTRIBUTION}/
SCRIPTDIR = ${TEXMF}/scripts/${CONTRIBUTION}/
SCRDOCDIR = ${TEXMF}/doc/support/${CONTRIBUTION}/
TDSDIR = tds
TDSFILES = ${LTXFILES} ${LTXDOCFILES} ${LTXSRCFILES} \
${PLAINFILES} ${PLAINDOCFILES} ${PLAINSRCFILES} \
${GENERICFILES} ${GENDOCFILES} ${GENSRCFILES} \
${SCRIPTFILES} ${SCRDOCFILES}
BUILDDIR = build
LATEXMK = latexmk -pdf -quiet
ZIP = zip -r
WEBBROWSER = firefox
GETVERSION = $(strip $(shell grep '=\*VERSION' -A1 $(firstword ${MAINDTXS}) | tail -n1))
AUXEXTS = .aux .bbl .blg .cod .exa .fdb_latexmk .glo .gls .lof .log .lot .out .pdf .que .run.xml .sta .stp .svn .svt .toc
CLEANFILES = $(addprefix ${CONTRIBUTION}, ${AUXEXTS})
.PHONY: all doc clean distclean
all: doc
doc: ${MAINPDFS}
${MAINPDFS}: ${DTXFILES} ${README} ${INSFILES} ${LTXFILES}
${MAKE} --no-print-directory build
cp "${BUILDDIR}/$@" "$@"
ifneq (${BUILDDIR},build)
build: ${BUILDDIR}
endif
${BUILDDIR}: ${MAINFILES} ${README}
-mkdir ${BUILDDIR} 2>/dev/null || true
cp ${INSFILES} ${README} DEPENDS.txt ${BUILDDIR}/
$(foreach DTX,${MAINDTXS}, tex '\input ydocincl\relax\includefiles{${DTX}}{${BUILDDIR}/${DTX}}' && rm -f ydocincl.log;)
cd ${BUILDDIR}; $(foreach INS, ${INSFILES}, tex ${INS};)
cd ${BUILDDIR}; $(foreach DTX, ${MAINDTXS}, ${LATEXMK} ${DTX};)
touch ${BUILDDIR}
$(addprefix ${BUILDDIR}/,$(sort ${TDSFILES} ${CTANFILES})): ${MAINFILES}
${MAKE} --no-print-directory build
clean:
latexmk -C ${CONTRIBUTION}.dtx
${RM} ${CLEANFILES}
${RM} -r ${BUILDDIR} ${TDSDIR} ${TDSZIP} ${CTAN_FILE} ${CONTRIBUTION}/
distclean:
latexmk -c ${CONTRIBUTION}.dtx
${RM} ${CLEANFILES}
${RM} -r ${BUILDDIR} ${TDSDIR}
CPORLN=cp
install: uninstall $(addprefix ${BUILDDIR}/,${TDSFILES})
ifneq ($(strip $(LTXFILES)),)
test -d "${LTXDIR}" || mkdir -p "${LTXDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/,${LTXFILES}) "$(abspath ${LTXDIR})"
endif
ifneq ($(strip $(LTXSRCFILES)),)
test -d "${LTXSRCDIR}" || mkdir -p "${LTXSRCDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${LTXSRCFILES}) "$(abspath ${LTXSRCDIR})"
endif
ifneq ($(strip $(LTXDOCFILES)),)
test -d "${LTXDOCDIR}" || mkdir -p "${LTXDOCDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${LTXDOCFILES}) "$(abspath ${LTXDOCDIR})"
endif
ifneq ($(strip $(GENERICFILES)),)
test -d "${GENERICDIR}" || mkdir -p "${GENERICDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${GENERICFILES}) "$(abspath ${GENERICDIR})"
endif
ifneq ($(strip $(GENSRCFILES)),)
test -d "${GENSRCDIR}" || mkdir -p "${GENSRCDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${GENSRCFILES}) "$(abspath ${GENSRCDIR})"
endif
ifneq ($(strip $(GENDOCFILES)),)
test -d "${GENDOCDIR}" || mkdir -p "${GENDOCDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${GENDOCFILES}) "$(abspath ${GENDOCDIR})"
endif
ifneq ($(strip $(PLAINFILES)),)
test -d "${PLAINDIR}" || mkdir -p "${PLAINDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${PLAINFILES}) "$(abspath ${PLAINDIR})"
endif
ifneq ($(strip $(PLAINSRCFILES)),)
test -d "${PLAINSRCDIR}" || mkdir -p "${PLAINSRCDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${PLAINSRCFILES}) "$(abspath ${PLAINSRCDIR})"
endif
ifneq ($(strip $(PLAINDOCFILES)),)
test -d "${PLAINDOCDIR}" || mkdir -p "${PLAINDOCDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${PLAINDOCFILES}) "$(abspath ${PLAINDOCDIR})"
endif
ifneq ($(strip $(SCRIPTFILES)),)
test -d "${SCRIPTDIR}" || mkdir -p "${SCRIPTDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${SCRIPTFILES}) "$(abspath ${SCRIPTDIR})"
endif
ifneq ($(strip $(SCRDOCFILES)),)
test -d "${SCRDOCDIR}" || mkdir -p "${SCRDOCDIR}"
${CPORLN} $(addprefix ${BUILDDIR}/, ${SCRDOCFILES}) "$(abspath ${SCRDOCDIR})"
endif
touch ${TEXMF}
-test -f ${TEXMF}/ls-R && texhash ${TEXMF} || true
installsymlinks: CPORLN=ln -sf
installsymlinks: BUILDDIR=${PWD}
installsymlinks: install
uninstall:
${RM} -rf ${LTXDIR} ${LTXDOCDIR} ${LTXSRCDIR} \
${GENERICDIR} ${GENDOCDIR} ${GENSRCDIR} \
${PLAINDIR} ${PLAINDOCDIR} ${PLAINSRCDIR} \
${SCRIPTDIR} ${SCRDOCDIR}
-test -f ${TEXMF}/ls-R && texhash ${TEXMF} || true
ifneq (${TDSDIR},tdsdir)
tdsdir: ${TDSDIR}
endif
${TDSDIR}: $(addprefix ${BUILDDIR}/,${TDSFILES})
${MAKE} --no-print-directory install TEXMF=${TDSDIR}
tdszip: ${TDSZIP}
${TDSZIP}: ${TDSDIR}
-${RM} $@
cd ${TDSDIR} && ${ZIP} $(abspath $@) *
zip: ${CTAN_FILE}
${CTAN_FILE}: $(addprefix ${BUILDDIR}/,${CTANFILES})
-rm -rf ${CONTRIBUTION}/
mkdir ${CONTRIBUTION}/
cp $(addprefix ${BUILDDIR}/,${CTANFILES}) ${CONTRIBUTION}/
-${RM} $@
${ZIP} $@ ${CONTRIBUTION}
upload: VERSION = ${GETVERSION}
upload: ${CTAN_FILE}
ctanupload -p
webupload: VERSION = ${GETVERSION}
webupload: ${CTAN_FILE}
${WEBBROWSER} 'http://dante.ctan.org/upload.html?contribution=${CONTRIBUTION}&version=${VERSION}&name=${NAME}&email=${EMAIL}&summary=${SUMMARY}&directory=${DIRECTORY}&DoNotAnnounce=${DONOTANNOUNCE}&announce=${ANNOUNCEMENT}¬es=${NOTES}&license=${LICENSE}&freeversion=${FREEVERSION}' &