1### @configure_input@
2
3# Copyright (C) 1994, 1996-2021 Free Software Foundation, Inc.
4
5# This file is part of GNU Emacs.
6
7# GNU Emacs is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11
12# GNU Emacs is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
19
20SHELL = @SHELL@
21
22# NB If you add any more configure variables,
23# update the sed rules in the dist target below.
24
25# Where to find the source code.  $(srcdir) will be the doc/emacs subdirectory
26# of the source tree.  This is set by configure's '--srcdir' option.
27srcdir=@srcdir@
28
29top_srcdir = @top_srcdir@
30
31top_builddir = @top_builddir@
32
33version = @version@
34
35## Where the output files go.
36## Note that the setfilename command in the .texi files assumes this.
37## This is a bit funny.  Because the info files are in the
38## distribution tarfiles, they are always made in $scrdir/../../info,
39## even for out-of-tree builds.
40buildinfodir = $(srcdir)/../../info
41# Directory with the (customized) texinfo.tex file.
42texinfodir = $(srcdir)/../misc
43
44prefix = @prefix@
45datarootdir = @datarootdir@
46datadir = @datadir@
47PACKAGE_TARNAME = @PACKAGE_TARNAME@
48docdir = @docdir@
49dvidir = @dvidir@
50htmldir = @htmldir@
51pdfdir = @pdfdir@
52psdir = @psdir@
53
54MKDIR_P = @MKDIR_P@
55
56GZIP_PROG = @GZIP_PROG@
57
58HTML_OPTS = --no-split --html
59
60# Options used only when making info output.
61# --no-split is only needed because of MS-DOS.
62# For a possible alternative, see
63# https://lists.gnu.org/r/emacs-devel/2011-01/msg01182.html
64INFO_OPTS= --no-split
65
66INSTALL = @INSTALL@
67INSTALL_DATA = @INSTALL_DATA@
68
69# The makeinfo program is part of the Texinfo distribution.
70# Use --force so that it generates output even if there are errors.
71MAKEINFO = @MAKEINFO@
72MAKEINFO_OPTS = --force --enable-encoding -I $(srcdir)
73
74TEXI2DVI = texi2dvi
75TEXI2PDF = texi2pdf
76DVIPS = dvips
77
78-include ${top_builddir}/src/verbose.mk
79
80ENVADD = $(AM_V_GEN)TEXINPUTS="$(srcdir):$(texinfodir):$(TEXINPUTS)" \
81         MAKEINFO="$(MAKEINFO) $(MAKEINFO_OPTS)"
82
83DVI_TARGETS = emacs.dvi emacs-xtra.dvi
84HTML_TARGETS = emacs.html
85PDF_TARGETS = emacs.pdf emacs-xtra.pdf
86PS_TARGETS = emacs.ps emacs-xtra.ps
87
88EMACS_XTRA= \
89	${srcdir}/emacs-xtra.texi \
90	$(srcdir)/arevert-xtra.texi \
91	$(srcdir)/cal-xtra.texi \
92	$(srcdir)/dired-xtra.texi \
93	${srcdir}/docstyle.texi \
94	$(srcdir)/picture-xtra.texi \
95	$(srcdir)/emerge-xtra.texi \
96	$(srcdir)/vc-xtra.texi \
97	$(srcdir)/vc1-xtra.texi \
98	$(srcdir)/fortran-xtra.texi \
99	$(srcdir)/msdos-xtra.texi
100
101EMACSSOURCES= \
102	${srcdir}/emacs.texi \
103	${srcdir}/emacsver.texi \
104	${srcdir}/doclicense.texi \
105	${srcdir}/gpl.texi \
106	${srcdir}/screen.texi \
107	${srcdir}/commands.texi \
108	${srcdir}/entering.texi \
109	${srcdir}/basic.texi \
110	${srcdir}/mini.texi \
111	${srcdir}/m-x.texi \
112	${srcdir}/help.texi \
113	${srcdir}/mark.texi \
114	${srcdir}/killing.texi \
115	${srcdir}/regs.texi \
116	${srcdir}/display.texi \
117	${srcdir}/search.texi \
118	${srcdir}/fixit.texi \
119	${srcdir}/files.texi \
120	${srcdir}/buffers.texi \
121	${srcdir}/windows.texi \
122	${srcdir}/frames.texi \
123	${srcdir}/mule.texi \
124	${srcdir}/modes.texi \
125	${srcdir}/indent.texi \
126	${srcdir}/text.texi \
127	${srcdir}/programs.texi \
128	${srcdir}/building.texi \
129	${srcdir}/maintaining.texi \
130	${srcdir}/abbrevs.texi \
131	${srcdir}/sending.texi \
132	${srcdir}/rmail.texi \
133	${srcdir}/dired.texi \
134	${srcdir}/calendar.texi \
135	${srcdir}/misc.texi \
136	${srcdir}/package.texi \
137	${srcdir}/custom.texi \
138	${srcdir}/trouble.texi \
139	${srcdir}/cmdargs.texi \
140	${srcdir}/xresources.texi \
141	${srcdir}/anti.texi \
142	${srcdir}/macos.texi \
143	$(srcdir)/haiku.texi \
144	${srcdir}/msdos.texi \
145	${srcdir}/gnu.texi \
146	${srcdir}/glossary.texi \
147	${srcdir}/ack.texi \
148	${srcdir}/kmacro.texi \
149	$(EMACS_XTRA)
150
151## Disable implicit rules.
152%.texi: ;
153
154.PHONY: info dvi html pdf ps
155
156info: $(buildinfodir)/emacs.info
157dvi: $(DVI_TARGETS)
158html: $(HTML_TARGETS)
159pdf: $(PDF_TARGETS)
160ps: $(PS_TARGETS)
161
162## The info/ directory exists in release tarfiles but not the repository.
163${buildinfodir}:
164	${MKDIR_P} $@
165
166# Note that all the Info targets build the Info files in srcdir.
167# There is no provision for Info files to exist in the build directory.
168# In a distribution of Emacs, the Info files should be up to date.
169$(buildinfodir)/emacs.info: ${EMACSSOURCES} | ${buildinfodir}
170	$(AM_V_GEN)$(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ $<
171
172emacs.dvi: ${EMACSSOURCES}
173	$(ENVADD) $(TEXI2DVI) $<
174
175emacs.pdf: ${EMACSSOURCES}
176	$(ENVADD) $(TEXI2PDF) $<
177
178emacs.html: ${EMACSSOURCES}
179	$(AM_V_GEN)$(MAKEINFO) $(MAKEINFO_OPTS) $(HTML_OPTS) -o $@ $<
180
181emacs-xtra.dvi: $(EMACS_XTRA)
182	$(ENVADD) $(TEXI2DVI) $<
183
184emacs-xtra.pdf: $(EMACS_XTRA)
185	$(ENVADD) $(TEXI2PDF) $<
186
187%.ps: %.dvi
188	$(DVIPS) -o $@ $<
189
190.PHONY: doc-emacsver
191
192# If configure were to just generate emacsver.texi from emacsver.texi.in
193# in the normal way, the timestamp of emacsver.texi would always be
194# newer than that of the info files, which are prebuilt in release tarfiles.
195# So we use this rule, and move-if-change, to avoid that.
196doc-emacsver:
197	sed 's/[@]version@/${version}/' \
198	  ${srcdir}/emacsver.texi.in > emacsver.texi.$$$$ && \
199	  ${top_srcdir}/build-aux/move-if-change emacsver.texi.$$$$ \
200	  ${srcdir}/emacsver.texi
201
202.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean infoclean
203
204## Temp files.
205mostlyclean:
206	rm -f ./*.aux ./*.log ./*.toc ./*.cp ./*.cps ./*.fn ./*.fns ./*.ky ./*.kys \
207	  ./*.op ./*.ops ./*.pg ./*.pgs ./*.tp ./*.tps ./*.vr ./*.vrs
208
209## Products not in the release tarfiles.
210clean: mostlyclean
211	rm -f $(DVI_TARGETS) $(HTML_TARGETS) $(PDF_TARGETS) $(PS_TARGETS)
212
213distclean: clean
214	rm -f Makefile
215
216## In the standalone tarfile, the clean rule runs this.
217infoclean:
218	rm -f \
219	  $(buildinfodir)/emacs.info \
220	  $(buildinfodir)/emacs.info-[1-9] \
221	  $(buildinfodir)/emacs.info-[1-9][0-9]
222
223bootstrap-clean maintainer-clean: distclean infoclean
224	rm -f ${srcdir}/emacsver.texi TAGS
225
226.PHONY: install-dvi install-html install-pdf install-ps install-doc
227
228install-dvi: dvi
229	umask 022; $(MKDIR_P) "$(DESTDIR)$(dvidir)"
230	$(INSTALL_DATA) $(DVI_TARGETS) "$(DESTDIR)$(dvidir)"
231install-html: html
232	umask 022; $(MKDIR_P) "$(DESTDIR)$(htmldir)"
233	$(INSTALL_DATA) $(HTML_TARGETS) "$(DESTDIR)$(htmldir)"
234install-pdf: pdf
235	 umask 022;$(MKDIR_P) "$(DESTDIR)$(pdfdir)"
236	$(INSTALL_DATA) $(PDF_TARGETS) "$(DESTDIR)$(pdfdir)"
237install-ps: ps
238	umask 022; $(MKDIR_P) "$(DESTDIR)$(psdir)"
239	for file in $(PS_TARGETS); do \
240	  $(INSTALL_DATA) $${file} "$(DESTDIR)$(psdir)"; \
241	  [ -n "${GZIP_PROG}" ] || continue; \
242	  rm -f "$(DESTDIR)$(psdir)/$${file}.gz"; \
243	  ${GZIP_PROG} -9n "$(DESTDIR)$(psdir)/$${file}"; \
244	done
245
246## Top-level Makefile installs the Info manuals.
247install-doc: install-dvi install-html install-pdf install-ps
248
249
250.PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps uninstall-doc
251
252uninstall-dvi:
253	for file in $(DVI_TARGETS); do \
254	  rm -f "$(DESTDIR)$(dvidir)/$${file}"; \
255	done
256uninstall-html:
257	for file in $(HTML_TARGETS); do \
258	  rm -f "$(DESTDIR)$(htmldir)/$${file}"; \
259	done
260uninstall-ps:
261	ext= ; [ -n "${GZIP_PROG}" ] && ext=.gz; \
262	for file in $(PS_TARGETS); do \
263	  rm -f "$(DESTDIR)$(psdir)/$${file}$${ext}"; \
264	done
265uninstall-pdf:
266	for file in $(PDF_TARGETS); do \
267	  rm -f "$(DESTDIR)$(pdfdir)/$${file}"; \
268	done
269
270uninstall-doc: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps
271
272
273ETAGS = ../../lib-src/etags${EXEEXT}
274
275${ETAGS}: FORCE
276	$(MAKE) -C $(dir $@) $(notdir $@)
277
278texifiles = $(wildcard ${srcdir}/*.texi)
279
280TAGS: ${ETAGS} $(texifiles)
281	$(AM_V_GEN)${ETAGS} --include=../lispref/TAGS --include=../misc/TAGS $(texifiles)
282
283tags: TAGS
284.PHONY: tags
285
286FORCE:
287.PHONY: FORCE
288
289### Makefile ends here
290