summaryrefslogtreecommitdiff
path: root/systems/doc/pdftex/manual/Makefile
blob: adbb1c7c95a4230beb178a9ef73363a3b9aba147 (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
# $Id: Makefile 875 2022-03-01 02:08:10Z karl $
# Makefile for pdfTeX documentation.  Public domain.

# Get version we're documenting from the \def in the manual.
pdftexversion=`sed -n 's,^.def.currentpdftex{\(.*\)},\1,p' manual/pdftex-t.tex`

context = texexec --batchmode
# context does not have \setupoutput.
# texmfstart exits immediately.

# what we distribute in TeX Live.
default: pdftex-a.pdf pdftex-syntax.txt

# the other formats (everything that can be built).
all: pdftex-l.pdf pdftex-s.pdf booklet

common_deps = pdftex-t.tex pdftex-w.txt pdftex-syntax.tex # pdftex-help.txt
pdftex-a.pdf a:	$(common_deps)
	$(context) --mode=a4 --result=$@ $<

pdftex-l.pdf l:	$(common_deps)
	$(context) --mode=letter --result=$@ $<

pdftex-s.pdf s:	$(common_deps) pdftex-i.tex
	$(context) --mode=screen --result=$@ $<


# booklet version is not made by default.
booklet:	pdftex-b.pdf pdftex-b-e.pdf pdftex-b-o.pdf

pdftex-b.pdf b:	pdftex-a.pdf
	$(context) --pdfarrange --paper=a5a4 --print=up --addempty=1,2 \
	--result=$@ $<

pdftex-b-e.pdf:	pdftex-a.pdf
	$(context) --pdfarrange --paper=a5a4 --print=up --addempty=1,2 \
	--pages=even --result=$@ $<

pdftex-b-o.pdf:	pdftex-a.pdf
	$(context) --pdfarrange --paper=a5a4 --print=up --addempty=1,2 \
	--pages=odd --result=$@ $<


#  Creating the subsidiary/dependent files.

# TeXable text for the title page.
pdftex-w.txt: pdftex-w.pdf
	cat $< \
	| expand \
	| fmt -s -w36 \
	| grep --text . \
	| expand >$@ || rm -f $@
	wc -l pdftex-w.txt  # set titlepagelines=half of this

# PDF for the title page. This should be updated every year;
# - update version numbers
# - make new binary
# - run this target
# Also check pdftex-help.txt for updates.
pdftex_binary = ../../source/build-pdftex/texk/web2c/pdftex
pdftex-w.pdf: pdftex-w.tex Makefile
	TEXFONTS=/usr/local/texlive/dev/texmf-dist/fonts// \
	$(pdftex_binary) -ini '$<'


# Too annoying to remake help text every time; check by hand when needed.
pdftex-help.txt: force
	$(pdftex_binary) --help >$@ || rm -f $@
force:

# if we don't have a build tree around, just try from the path.
build_binary := ../../source/build-pdftex/texk/web2c/pdftex
ifneq "$(realpath $(build_binary))" ""
pdftex_binary := $(build_binary)
else
pdftex_binary := pdftex
endif

# Primitives and syntax, in TeX for the printed manual, and then in
# plain text for human convenience.
pdftex-syntax.tex: pdftex-t.tex syntaxform.pl
	perl syntaxform.pl pdftex-t.tex >pdftex-syntax.tex || rm -f $@

pdftex-syntax.txt: pdftex-t.tex pdftex-syntax.tex syntaxform.awk
	gawk -f syntaxform.awk pdftex-syntax.tex $< >$@ || rm -f $@


#  Install from this source directory to TL.

# svn co svn://u:pw@tug.org/texlive/trunk/Master/texmf-dist/doc/pdftex
tltree = /v/texlive/karl/Master/texmf-dist
dest = $(tltree)/doc/pdftex/manual

INSTALL_DATA = cp -p

install: default
	$(INSTALL_DATA) ChangeLog Makefile README makefiles.cmd $(dest)
	$(INSTALL_DATA) pdftex-a.pdf pdftex-syntax.txt $(dest)
	$(INSTALL_DATA) pdftex-t.tex pdftex-w.tex pdftex-i.tex $(dest)
	$(INSTALL_DATA) syntaxform.awk syntaxform.pl $(dest)


#  Dist and clean.
# tar/zip including pdftex-a.pdf, pdftex-l.pdf, pdftex-s.pdf,
# although we don't ever make such distributions any more.

distall=$(distnopdf) pdftex-a.pdf pdftex-l.pdf pdftex-s.pdf

mandir=manual
distdate=`date +%y%m%d`
distrev=`awk '/Id:/{print $$4; exit}' $(mandir)/pdftex-t.tex`

distnopdf=pdftex-w.tex pdftex-w.txt pdftex-t.tex \
	pdftex-i.tex syntaxform.awk Makefile makefiles.cmd \
	pdftex-syntax.txt pdftex-help.txt README ChangeLog

alltar:	$(distall)
	cd .. && tar cvjf $(mandir)/pdftex-$(pdftexversion)-userman-$(distrev).tar.bz2 \
	$(patsubst %, $(mandir)/%, $(distall))

allzip:	$(distall)
	cd .. && zip $(mandir)/pdftex-$(pdftexversion)-userman-$(distrev).zip \
	$(patsubst %, $(mandir)/%, $(distall))


# tar/zip without PDF files:

tar:	$(distnopdf)
	cd .. && tar cvjf $(mandir)/pdftex-$(pdftexversion)-userman-$(distrev)-src.tar.bz2 \
	$(patsubst %, $(mandir)/%, $(distnopdf))
	ls -l *.tar.bz2

zip:	$(distnopdf)
	cd .. && zip $(mandir)/pdftex-$(pdftexversion)-userman-$(distrev)-src.zip \
	$(patsubst %, $(mandir)/%, $(distnopdf))


clean:
	rm -f *.log *.tuo *.tui *.top *.tmp *-mpgraph.mp

maintainer-clean: clean
	rm -f pdftex-a.pdf pdftex-l.pdf pdftex-s.pdf
	rm -f pdftex-b.pdf pdftex-b-e.pdf pdftex-b-o.pdf
	rm -f pdftex-help.txt pdftex-syntax.txt pdftex-syntax.tex
	rm -f pdftex-w.pdf pdftex-w.txt

clobber allclean realclean distclean: maintainer-clean

spell:
	myspell pdftex-t.tex