summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/standalone/Makefile
blob: f399ae376d574db9c4ecd8aa4aee1f34fd223d14 (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
TEXMF=${HOME}/texmf
INSTALLDIR=${TEXMF}/tex/latex/standalone
DOCINSTALLDIR=${TEXMF}/doc/latex/standalone
CP=cp
RMDIR=rm -rf
PDFLATEX=pdflatex -interaction=batchmode
LATEXMK=latexmk -pdf -silent

PACKEDFILES=standalone.cls standalone.sty standalone.cfg standalone.tex
DOCFILES=standalone.pdf
SRCFILES=standalone.dtx standalone.ins README Makefile

all: unpack doc

package: unpack
class: unpack

${PACKEDFILES}: standalone.dtx standalone.ins
	yes | pdflatex standalone.ins

unpack: ${PACKEDFILES}

# 'doc' and 'standalone.pdf' call itself until everything is stable
doc: standalone.pdf
	@${MAKE} --no-print-directory standalone.pdf

pdfopt: doc
	@-pdfopt standalone.pdf .temp.pdf && mv .temp.pdf standalone.pdf

standalone.pdf: standalone.dtx standalone.gls standalone.ind
	${LATEXMK} standalone.dtx

standalone.idx standalone.glo: standalone.dtx
	${LATEXMK} standalone.dtx

standalone.ind: standalone.idx
	-makeindex -s gind.ist -o "$@" "$<"

standalone.gls: standalone.glo
	-makeindex -s gglo.ist -o "$@" "$<"

.PHONY: test

test: unpack
	for T in test*.tex; do echo "$$T"; pdflatex -interaction=batchmode $$T && echo "OK" || echo "Failure"; done

clean:
	-latexmk -C standalone.dtx
	${RM} ${PACKEDFILES} *.zip *.log *.aux *.toc *.vrb *.nav *.pdf *.snm *.out *.fdb_latexmk *.glo *.gls *.hd *.sta *.stp
	${RMDIR} tds

install: unpack doc ${INSTALLDIR} ${DOCINSTALLDIR}
	${CP} ${PACKEDFILES} ${INSTALLDIR}
	${CP} ${DOCFILES} ${DOCINSTALLDIR}
	texhash ${TEXMF}

${INSTALLDIR}:
	mkdir -p $@

${DOCINSTALLDIR}:
	mkdir -p $@

ctanify: ${SRCFILES} ${DOCFILES} standalone.tds.zip
	${RM} standalone.zip
	zip standalone.zip $^ 
	unzip -t standalone.zip
	unzip -t standalone.tds.zip

zip: standalone.zip

tdszip: standalone.tds.zip

standalone.zip: ${SRCFILES} ${DOCFILES} | pdfopt
	${RM} $@
	zip $@ $^ 

standalone.tds.zip: ${SRCFILES} ${PACKEDFILES} ${DOCFILES} | pdfopt
	${RMDIR} tds
	mkdir -p tds/tex/latex/standalone
	mkdir -p tds/doc/latex/standalone
	mkdir -p tds/source/latex/standalone
	${CP} ${DOCFILES}    tds/doc/latex/standalone
	${CP} ${PACKEDFILES} tds/tex/latex/standalone
	${CP} ${SRCFILES}    tds/source/latex/standalone
	cd tds; zip -r ../$@ .