summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/comprehensive/source/Makefile
blob: 99c13ae44c97aeeb4f957b8540afd9eb08481697 (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
#############################################
# Build the Comprehensive LaTeX Symbol List #
# By Scott Pakin <scott+clsl@pakin.org>     #
#############################################

# Define TARGETS as a list of all of the files we intend to generate.
# TARGETS is categorized into TARGETS_SOURCE and TARGETS_DIST.
# TARGETS_DIST comprise the prebuilt distribution of the Comprehensive
# LaTeX Symbol List.  TARGETS_SOURCE are needed primarily to build
# TARGETS_DIST, although they are also distributed (in a "source"
# subdirectory).
TARGETS = $(TARGETS_SOURCE) $(TARGETS_DIST)

TARGETS_DIST = symbols-letter.pdf symbols-a4.pdf SYMLIST README

TARGETS_SOURCE = lightbulb.eps lightbulb10.pfb lightbulb.map

# There are a few files that we didn't generate but that need to be
# distributed.
EXTRADIST = symbols.tex lightbulb10.mf lightbulb.mf makefakeMnSymbol \
	    epsdice.eps Makefile

# Define INTERMEDIATES as a list of all of the intermediate files
# generated by both latex and pdflatex while producing TARGETS.
INTERMEDIATES = symbols.aux symbols.idx symbols.ilg \
		symbols.ind symbols.log symbols.toc \
		symbols.pts

# We need FontForge (or the older PfaEdit) to generate lightbulb10.pfb.
FONTFORGE = fontforge

# The following should be overwritten in a recursive call to Make.
SIZE = letter
EXT = pdf

###########################################################################

# Build all specified formats in all specified paper sizes.
all: $(TARGETS)

.PHONY: symbols dist

###########################################################################

# Define generic rules for building pdf/dvi/ps in letter/a4 size.
symbols $(INTERMEDIATES): symbols.tex lightbulb.eps lightbulb10.pfb lightbulb.map fakeMnSymbol.sty
	$(LATEX) '\PassOptionsToClass{$(SIZE)paper}{article}\input symbols'
	$(LATEX) '\PassOptionsToClass{$(SIZE)paper}{article}\input symbols'
	makeindex -s gind.ist symbols
	$(LATEX) '\PassOptionsToClass{$(SIZE)paper}{article}\input symbols'
	totalsymbols=`fgrep -c '\item \verb' symbols.ind` ; \
	  ( fgrep -v prevtotalsymbols symbols.aux > symbols.pts ; \
	    echo "\\gdef\\prevtotalsymbols{$$totalsymbols}" ; \
	    echo "\\gdef\\approxcount{}" ) >> symbols.pts ; \
	  mv symbols.pts symbols.aux
	$(LATEX) '\PassOptionsToClass{$(SIZE)paper}{article}\input symbols'
	mv symbols.$(EXT) symbols-$(SIZE).$(EXT)
	mv symbols.log symbols-$(SIZE)-$(EXT).log

###########################################################################

# Define specific rules for building different formats and sizes.
symbols-a4.pdf symbols-a4-pdf.log: symbols.tex
	$(MAKE) $(MAKEFLAGS) SIZE=a4 LATEX=pdflatex EXT=pdf symbols

symbols-letter.pdf symbols-letter-pdf.log: symbols.tex
	$(MAKE) $(MAKEFLAGS) SIZE=letter LATEX=pdflatex EXT=pdf symbols

symbols-a4.dvi symbols-a4-dvi.log: symbols.tex
	$(MAKE) $(MAKEFLAGS) SIZE=a4 LATEX=latex EXT=dvi symbols

symbols-letter.dvi symbols-letter-dvi.log: symbols.tex
	$(MAKE) $(MAKEFLAGS) SIZE=letter LATEX=latex EXT=dvi symbols

symbols-letter.ps: symbols-letter.dvi
	dvips -t letter -Pamz -Pcmz -j0 -o symbols-letter.ps symbols-letter.dvi

symbols-a4.ps: symbols-a4.dvi
	dvips -t a4 -Pamz -Pcmz -j0 -o symbols-a4.ps symbols-a4.dvi

###########################################################################

# Define rules to produce a lightbulb proof figure.
mfplain.mem:
	mpost -ini '\input mfplain; dump'

lightbulb.eps: lightbulb10.mf lightbulb.mf mfplain.mem
	mpost -mem mfplain '\mode:=proof; prologues:=2; labelfont cmr17; input lightbulb10'
	mv lightbulb10.65 lightbulb.eps

# Generate a FontForge script that makes the LightBulb10 PostScript
# names mixed case.
lightbulb10.pe:
	echo 'Open($$1);' > $@
	echo 'LB = "LightBulb";' >> $@
	echo 'SetFontNames(LB+"10", LB, LB+"10");' >> $@
	echo 'Generate("lightbulb10.pfb");' >> $@

# Define a rule to produce a Type 1 version of the LightBulb10 font.
lightbulb10.pfb: lightbulb10.mf lightbulb10.pe
	mftrace -V -fpfb --simplify lightbulb10
	$(FONTFORGE) -script lightbulb10.pe lightbulb10.pfb

# Define a rule to produce a LightBulb font-mapping file.
lightbulb.map:
	echo "lightbulb10 LightBulb10 <lightbulb10.pfb" > lightbulb.map

###########################################################################

# If we have MnSymbol.sty, generate a faked version which does not
# declare any new math alphabets.
fakeMnSymbol.sty: makefakeMnSymbol
	if [ "`kpsewhich MnSymbol.sty`" ] ; then \
	  makefakeMnSymbol `kpsewhich MnSymbol.sty` > $@ ; \
	else \
	  makefakeMnSymbol /dev/null > $@ ; \
	fi

###########################################################################

# Create a list of all symbols.
SYMLIST: symbols.ind
	cat symbols.ind | perl -ne 's/.*\\verb\+([^+]+)\+.*/$$1/g && print' | sort -u > SYMLIST

# Create a README file.
README: makeREADME symbols-letter-pdf.log symbols.ind
	makeREADME symbols-letter-pdf.log symbols.ind > README

# Create a .tar.gz file.
comprehensive.tar.gz: $(TARGETS) $(EXTRADIST)
	$(RM) -r comprehensive
	mkdir comprehensive
	mkdir comprehensive/source
	install -m 664 $(TARGETS_DIST) comprehensive
	install -m 664 $(TARGETS_SOURCE) $(EXTRADIST) comprehensive/source
	cat symbols.tex | checksum > comprehensive/source/symbols.tex
	chmod 664 comprehensive/source/symbols.tex
	tar -czf comprehensive.tar.gz comprehensive
	$(RM) -r comprehensive

dist: comprehensive.tar.gz

# Clean up our mess.
clean: mostlyclean
	$(RM) comprehensive.tar.gz
	$(RM) $(TARGETS)
	$(RM) fakeMnSymbol.sty
	$(RM) mfplain.{log,mem}
	$(RM) lightbulb10*pk lightbulb10.{tfm,log,pe}

mostlyclean:
	$(RM) -r comprehensive
	$(RM) $(INTERMEDIATES) $(TARGETS_DIST)
	$(RM) symbols-letter.dvi symbols-a4.dvi
	$(RM) symbols-*-*.log