1# This makefile for Readline library documentation is in -*- text -*- mode.
2# Emacs likes it that way.
3
4# Copyright (C) 1996-2004 Free Software Foundation, Inc.
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
19
20topdir = @top_srcdir@
21srcdir = @srcdir@
22VPATH = .:@srcdir@
23
24prefix = @prefix@
25infodir = @infodir@
26
27mandir = @mandir@
28manpfx = man
29
30man1ext = .1
31man1dir = $(mandir)/$(manpfx)1
32man3ext = .3
33man3dir = $(mandir)/$(manpfx)3
34
35# set this to a value to have the HTML documentation installed
36htmldir =
37
38# Support an alternate destination root directory for package building
39DESTDIR =
40
41SHELL = @MAKE_SHELL@
42RM = rm -f
43
44INSTALL = @INSTALL@
45INSTALL_DATA = @INSTALL_DATA@
46
47BUILD_DIR = @BUILD_DIR@
48TEXINPUTDIR = $(srcdir)
49
50MAKEINFO    = LANGUAGE= makeinfo
51TEXI2DVI    = $(srcdir)/texi2dvi
52TEXI2HTML   = $(srcdir)/texi2html
53QUIETPS     = #set this to -q to shut up dvips
54PAPERSIZE   = letter
55PSDPI       = 600
56DVIPS       = dvips -D ${PSDPI} $(QUIETPS) -t ${PAPERSIZE} -o $@     # tricky
57
58# These tools might not be available; they're not required
59DVIPDF      = dvipdfm -o $@ -p ${PAPERSIZE}
60PSPDF       = gs -sPAPERSIZE=${PAPERSIZE} -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -sOutputFile=$@
61
62RLSRC = $(srcdir)/rlman.texi $(srcdir)/rluser.texi \
63	$(srcdir)/rltech.texi $(srcdir)/version.texi \
64	$(srcdir)/rluserman.texi
65HISTSRC = $(srcdir)/history.texi $(srcdir)/hsuser.texi \
66	  $(srcdir)/hstech.texi $(srcdir)/version.texi
67
68# This should be a program that converts troff to an ascii-readable format
69NROFF       = groff -Tascii
70
71# This should be a program that converts troff to postscript
72GROFF       = groff
73
74DVIOBJ = readline.dvi history.dvi rluserman.dvi
75INFOOBJ = readline.info history.info rluserman.info
76PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps history_3.ps
77HTMLOBJ = readline.html history.html rluserman.html
78TEXTOBJ = readline.0 history.0
79PDFOBJ = readline.pdf history.pdf rluserman.pdf
80
81INTERMEDIATE_OBJ = rlman.dvi
82
83DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ) $(INFOOBJ) $(TEXTOBJ)
84
85.SUFFIXES:      .0 .3 .ps .txt .dvi .html .pdf
86
87.3.0:
88	$(RM) $@
89	-${NROFF} -man $< > $@
90
91.ps.pdf:
92	$(RM) $@
93	-${PSPDF} $<
94
95.dvi.pdf:
96	$(RM) $@
97	-${DVIPDF} $<
98
99all: info dvi html ps text
100nodvi: info html text
101
102info:	$(INFOOBJ)
103dvi:	$(DVIOBJ)
104ps:	$(PSOBJ)
105html:	$(HTMLOBJ)
106text:	$(TEXTOBJ)
107pdf:	$(PDFOBJ)
108
109readline.dvi: $(RLSRC)
110	TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rlman.texi
111	mv rlman.dvi readline.dvi
112
113readline.info: $(RLSRC)
114	$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texi
115
116rluserman.dvi: $(RLSRC)
117	TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rluserman.texi
118
119rluserman.info: $(RLSRC)
120	$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rluserman.texi
121
122history.dvi: ${HISTSRC}
123	TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/history.texi
124
125history.info: ${HISTSRC}
126	$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/history.texi
127
128readline.ps:	readline.dvi
129	$(RM) $@
130	$(DVIPS) readline.dvi
131
132rluserman.ps:	rluserman.dvi
133	$(RM) $@
134	$(DVIPS) rluserman.dvi
135
136history.ps:	history.dvi
137	$(RM) $@
138	$(DVIPS) history.dvi
139
140#
141# This leaves readline.html and rlman.html -- rlman.html is for www.gnu.org
142#
143readline.html:	${RLSRC}
144	$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texi
145	sed -e 's:rlman.html:readline.html:g' rlman.html > readline.html
146	$(RM) rlman.html
147
148rluserman.html:	${RLSRC}
149	$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rluserman.texi
150
151history.html:	${HISTSRC}
152	$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/history.texi
153
154readline.0: readline.3
155
156readline_3.ps: readline.3
157	${RM} $@
158	${GROFF} -man < $(srcdir)/readline.3 > $@ 
159
160history.0: history.3
161
162history_3.ps: history.3
163	${RM} $@
164	${GROFF} -man < $(srcdir)/history.3 > $@ 
165
166readline.pdf:	readline.dvi
167history.pdf:	history.dvi
168rluserman.pdf:	rluserman.dvi
169
170clean:
171	$(RM) *.aux *.bak *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps \
172	      *.pgs *.bt *.bts *.rw *.rws *.fns *.kys *.tps *.vrs *.o \
173	      core *.core
174
175mostlyclean: clean
176
177distclean: clean maybe-clean
178	$(RM) $(INTERMEDIATE_OBJ)
179	$(RM) Makefile
180
181maybe-clean:
182	-if test "X$(topdir)" != "X$(BUILD_DIR)"; then \
183		$(RM) $(DIST_DOCS); \
184	fi
185
186maintainer-clean: clean
187	$(RM) $(DIST_DOCS)
188	$(RM) $(INTERMEDIATE_OBJ)
189	$(RM) $(PDFOBJ)
190	$(RM) Makefile
191
192installdirs:	$(topdir)/support/mkdirs
193	-$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(infodir) $(DESTDIR)$(man3dir)
194	-if test -n "${htmldir}" ; then \
195		$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(htmldir) ; \
196	fi
197
198install:	installdirs
199	if test -f readline.info; then \
200		${INSTALL_DATA} readline.info $(DESTDIR)$(infodir)/readline.info; \
201	else \
202		${INSTALL_DATA} $(srcdir)/readline.info $(DESTDIR)$(infodir)/readline.info; \
203	fi
204	if test -f rluserman.info; then \
205		${INSTALL_DATA} rluserman.info $(DESTDIR)$(infodir)/rluserman.info; \
206	else \
207		${INSTALL_DATA} $(srcdir)/rluserman.info $(DESTDIR)$(infodir)/rluserman.info; \
208	fi
209	if test -f history.info; then \
210		${INSTALL_DATA} history.info $(DESTDIR)$(infodir)/history.info; \
211	else \
212		${INSTALL_DATA} $(srcdir)/history.info $(DESTDIR)$(infodir)/history.info; \
213	fi
214	-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
215		install-info --dir-file=$(DESTDIR)$(infodir)/dir \
216			$(DESTDIR)$(infodir)/readline.info ; \
217		install-info --dir-file=$(DESTDIR)$(infodir)/dir \
218			$(DESTDIR)$(infodir)/history.info ; \
219		install-info --dir-file=$(DESTDIR)$(infodir)/dir \
220			$(DESTDIR)$(infodir)/rluserman.info ; \
221	else true; fi
222	-${INSTALL_DATA} $(srcdir)/readline.3 $(DESTDIR)$(man3dir)/readline$(man3ext)
223	-${INSTALL_DATA} $(srcdir)/history.3 $(DESTDIR)$(man3dir)/history$(man3ext)
224	-if test -n "${htmldir}" ; then \
225		if test -f readline.html; then \
226			${INSTALL_DATA} readline.html $(DESTDIR)$(htmldir)/readline.html; \
227		else \
228			${INSTALL_DATA} $(srcdir)/readline.html $(DESTDIR)$(htmldir)/readline.html; \
229		fi ; \
230		if test -f history.html; then \
231			${INSTALL_DATA} history.html $(DESTDIR)$(htmldir)/history.html; \
232		else \
233			${INSTALL_DATA} $(srcdir)/history.html $(DESTDIR)$(htmldir)/history.html; \
234		fi ; \
235		if test -f rluserman.html; then \
236			${INSTALL_DATA} rluserman.html $(DESTDIR)$(htmldir)/rluserman.html; \
237		else \
238			${INSTALL_DATA} $(srcdir)/rluserman.html $(DESTDIR)$(htmldir)/rluserman.html; \
239		fi ; \
240	fi
241
242uninstall:
243	$(RM) $(DESTDIR)$(infodir)/readline.info
244	$(RM) $(DESTDIR)$(infodir)/rluserman.info
245	$(RM) $(DESTDIR)$(infodir)/history.info
246	$(RM) $(DESTDIR)$(man3dir)/readline$(man3ext)
247	$(RM) $(DESTDIR)$(man3dir)/history$(man3ext)
248	-if test -n "${htmldir}" ; then \
249		$(RM) $(DESTDIR)$(htmldir)/readline.html ; \
250		$(RM) $(DESTDIR)$(htmldir)/rluserman.html ; \
251		$(RM) $(DESTDIR)$(htmldir)/history.html ; \
252	fi
253