Parallelize clean rules using GNU make features
[bpt/emacs.git] / doc / misc / Makefile.in
CommitLineData
bbece175 1### @configure_input@
4009494e 2
ba318903 3# Copyright (C) 1994, 1996-2014 Free Software Foundation, Inc.
4009494e
GM
4
5# This file is part of GNU Emacs.
6
97c0352c 7# GNU Emacs is free software: you can redistribute it and/or modify
4009494e 8# it under the terms of the GNU General Public License as published by
97c0352c
GM
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
4009494e
GM
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
97c0352c 18# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
4009494e 19
50b13cde 20SHELL = @SHELL@
c21180f3 21
1470c88c
GM
22# Where to find the source code. $(srcdir) will be the doc/misc subdirectory
23# of the source tree. This is set by configure's `--srcdir' option.
4009494e 24srcdir=@srcdir@
4009494e 25
09af5c3e
GM
26version=@version@
27
c21180f3 28## Where the output files go.
1470c88c
GM
29## Note that all the Info targets build the Info files in srcdir.
30## There is no provision for Info files to exist in the build directory.
31## In a tarfile of Emacs, the Info files should be up to date.
ac1a0ce1 32buildinfodir = $(srcdir)/../../info
1470c88c 33
f7a31f11 34## Directory with emacsver.texi.
f7a31f11 35emacsdir = $(srcdir)/../emacs
4009494e 36
8496d8d7
GM
37prefix = @prefix@
38datarootdir = @datarootdir@
39datadir = @datadir@
40PACKAGE_TARNAME = @PACKAGE_TARNAME@
41docdir = @docdir@
42dvidir = @dvidir@
43htmldir = @htmldir@
44pdfdir = @pdfdir@
45psdir = @psdir@
46
3fe7cdc8
GM
47MKDIR_P = @MKDIR_P@
48
8496d8d7
GM
49GZIP_PROG = @GZIP_PROG@
50
51HTML_OPTS = --no-split --html
52
8045b906 53# Options used only when making info output.
1470c88c 54# (Note that idlwave, info used --nosplit even without the .info extension.)
40abffe4 55INFO_OPTS= --no-split
8045b906 56
8496d8d7
GM
57INSTALL = @INSTALL@
58INSTALL_DATA = @INSTALL_DATA@
59
4009494e
GM
60# The makeinfo program is part of the Texinfo distribution.
61# Use --force so that it generates output even if there are errors.
1470c88c 62# (TODO? Why is this appropriate?)
45eb2a5d
WL
63MAKEINFO = @MAKEINFO@
64MAKEINFO_OPTS = --force -I$(emacsdir)
c21180f3 65
1857cd3f 66## On MS Windows, efaq-w32; otherwise blank.
0acfedd3 67DOCMISC_W32 = @DOCMISC_W32@
1857cd3f
GM
68
69## Info files to build and install on all platforms.
70INFO_COMMON = ada-mode auth autotype bovine calc ccmode cl \
7d326a29 71 dbus dired-x ebrowse ede ediff edt eieio \
548a1b28 72 emacs-mime epa erc ert eshell eudc efaq eww \
57cff712 73 flymake forms gnus emacs-gnutls htmlfontify idlwave ido info.info \
ed4bc201 74 mairix-el message mh-e newsticker nxml-mode octave-mode \
7d326a29 75 org pcl-cvs pgg rcirc remember reftex sasl \
016d3f7d 76 sc semantic ses sieve smtpmail speedbar srecode todo-mode tramp \
c31528bf 77 url vhdl-mode vip viper widget wisent woman
c21180f3 78
1857cd3f 79## Info files to install on current platform.
4abee665 80INFO_INSTALL = $(INFO_COMMON) $(DOCMISC_W32)
1857cd3f
GM
81
82## Info files to build on current platform.
83## This is all of them, even though they might not all get installed,
84## because the info files are pre-built in release tarfiles.
85INFO_TARGETS = $(INFO_COMMON) efaq-w32
86
0acfedd3
SM
87# There are some naming differences between the info targets and the other
88# targets, so let's resolve them here.
89TARGETS_1 = $(INFO_INSTALL:ccmode=cc-mode)
90TARGETS = $(TARGETS_1:info.info=info)
c21180f3 91
0acfedd3
SM
92DVI_TARGETS = $(TARGETS:=.dvi)
93HTML_TARGETS = $(TARGETS:=.html)
94PDF_TARGETS = $(TARGETS:=.pdf)
95PS_TARGETS = $(TARGETS:=.ps)
8496d8d7 96
c21180f3 97TEXI2DVI = texi2dvi
698bfef7 98TEXI2PDF = texi2pdf
8496d8d7 99DVIPS = dvips
4009494e 100
45eb2a5d
WL
101ENVADD = TEXINPUTS="$(srcdir):$(emacsdir):$(TEXINPUTS)" \
102 MAKEINFO="$(MAKEINFO) $(MAKEINFO_OPTS)"
4009494e 103
ddc41264
GM
104gfdl = ${srcdir}/doclicense.texi
105
1470c88c 106.PHONY: info dvi html pdf ps echo-info $(INFO_TARGETS)
9583393f
GM
107## Prevent implicit rule triggering for foo.info.
108.SUFFIXES:
9aa071df 109
956cceb9
GM
110# Default.
111info: $(INFO_TARGETS)
112
9aa071df 113## Used by top-level Makefile.
7d326a29 114## Base file names of output info files.
9aa071df 115echo-info:
1857cd3f 116 @echo "$(INFO_INSTALL) " | \
40abffe4 117 sed -e 's|[^ ]*/||g' -e 's/\.info//g' -e "s/ */.info /g"
ea274122 118
4009494e
GM
119dvi: $(DVI_TARGETS)
120
8496d8d7
GM
121html: $(HTML_TARGETS)
122
698bfef7 123pdf: $(PDF_TARGETS)
c21180f3 124
8496d8d7
GM
125ps: $(PS_TARGETS)
126
1470c88c
GM
127${buildinfodir}:
128 ${MKDIR_P} $@
129
130### The general case.
131
132EXTRA_OPTS =
133
134${buildinfodir}/%.info: ${srcdir}/%.texi ${gfdl} | ${buildinfodir}
135 $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) $(EXTRA_OPTS) -o $@ $<
136
137## The short aliases, eg efaq = $(buildinfodir)/efaq.info.
138define info_template
139 $(1): $$(buildinfodir)/$(1).info
140endef
141
142## "info" is already taken.
143info.info: $(buildinfodir)/info.info
144
145$(foreach ifile,$(filter-out info.info,$(INFO_TARGETS)),$(eval $(call info_template,$(ifile))))
146
147
148%.dvi: ${srcdir}/%.texi ${gfdl}
149 $(ENVADD) $(TEXI2DVI) $<
150
151%.pdf: ${srcdir}/%.texi ${gfdl}
152 $(ENVADD) $(TEXI2PDF) $<
153
154%.html: ${srcdir}/%.texi ${gfdl}
155 $(MAKEINFO) $(MAKEINFO_OPTS) $(HTML_OPTS) $(EXTRA_OPTS) -o $@ $<
156
157%.ps: %.dvi
158 $(DVIPS) -o $@ $<
159
160
161### The exceptions.
162
163## Extra dependencies.
164
165need_emacsver = calc cl dired-x efaq efaq-w32 erc ido reftex woman
166need_emacsver_prefix = $(addprefix ${buildinfodir}/,${need_emacsver})
167
168$(need_emacsver_prefix:=.info) $(need_emacsver:=.dvi) $(need_emacsver:=.pdf) $(need_emacsver:=.html) : ${emacsdir}/emacsver.texi
169
170$(buildinfodir)/gnus.info gnus.html: ${srcdir}/gnus-faq.texi
171
172$(buildinfodir)/semantic.info semantic.dvi semantic.pdf semantic.html: ${srcdir}/sem-user.texi
173
174
175## Please can we just rename cc-mode.texi to ccmode.texi...
176${buildinfodir}/ccmode.info: ${srcdir}/cc-mode.texi ${gfdl}
177 $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ $<
178
179## efaq, efaq_w32 do not depend on gfdl.
180## Maybe we can use .SECONDEXPANSION for this.
181${buildinfodir}/efaq%.info: ${srcdir}/efaq%.texi
182 $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ $<
183
184efaq%.dvi: ${srcdir}/efaq%.texi
185 $(ENVADD) $(TEXI2DVI) $<
186
187efaq%.pdf: ${srcdir}/efaq%.texi
188 $(ENVADD) $(TEXI2PDF) $<
189
190efaq%.html: ${srcdir}/efaq%.texi
191 $(MAKEINFO) $(MAKEINFO_OPTS) $(HTML_OPTS) -o $@ $<
192
193${buildinfodir}/emacs-mime.info emacs-mime.html: EXTRA_OPTS = --enable-encoding
194
808190e6 195gnus_deps = ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi ${gfdl}
808190e6 196gnus.dvi: $(gnus_deps)
1470c88c
GM
197 sed -e '/@iflatex/,/@end iflatex/d' $< > gnustmpdvi.texi
198 $(ENVADD) $(TEXI2DVI) gnustmpdvi.texi
199 cp gnustmpdvi.dvi $@
200 rm gnustmpdvi.*
201
808190e6 202gnus.pdf: $(gnus_deps)
1470c88c
GM
203 sed -e '/@iflatex/,/@end iflatex/d' $< > gnustmppdf.texi
204 $(ENVADD) $(TEXI2PDF) gnustmppdf.texi
205 cp gnustmppdf.pdf $@
206 rm gnustmppdf.*
207
208${buildinfodir}/tramp.info tramp.html: EXTRA_OPTS = -D emacs
209${buildinfodir}/tramp.info tramp.html: ${srcdir}/trampver.texi
210
4009494e 211
0e6929ec 212.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
ea274122 213
4009494e 214mostlyclean:
9598ef0b 215 rm -f *.aux *.log *.toc *.c[mp] *.c[mp]s *.fn *.fns \
beb57c77 216 *.ky *.kys *.op *.ops *.p[gj] *.p[gj]s *.sc *.scs *.ss \
9598ef0b 217 *.t[gp] *.t[gp]s *.vr *.vrs
1470c88c 218 rm -f gnustmp*
4009494e
GM
219
220clean: mostlyclean
8496d8d7 221 rm -f $(DVI_TARGETS) $(HTML_TARGETS) $(PDF_TARGETS) $(PS_TARGETS)
1857cd3f 222 rm -f efaq-w32.dvi efaq-w32.html efaq-w32.pdf efaq-w32.ps
09af5c3e 223 rm -f emacs-misc-${version}.tar*
4009494e
GM
224
225distclean: clean
26e4aa7d 226 rm -f Makefile
4009494e 227
2fecccba 228## buildinfodir is relative to srcdir.
09af5c3e 229infoclean:
eb36672f 230 for file in $(INFO_TARGETS); do \
40abffe4 231 file=`echo $${file} | sed 's/\.info$$//'`.info; \
eb36672f
PE
232 rm -f \
233 $(buildinfodir)/$${file} \
234 $(buildinfodir)/$${file}-[1-9] \
235 $(buildinfodir)/$${file}-[1-9][0-9]; \
4c83f6e1 236 done
4009494e 237
0e6929ec 238bootstrap-clean maintainer-clean: distclean infoclean
09af5c3e
GM
239
240dist:
241 rm -rf emacs-misc-${version}
242 mkdir emacs-misc-${version}
243 cp ${srcdir}/*.texi ${srcdir}/texinfo.tex \
244 $(emacsdir)/emacsver.texi ${srcdir}/ChangeLog* \
245 emacs-misc-${version}/
246 sed -e 's/@sr[c]dir@/./' \
247 -e 's/^\(emacsdir *=\).*/\1 ./' \
248 -e 's/^\(buildinfodir *=\).*/\1 ./' \
249 -e 's/^\(clean:.*\)/\1 infoclean/' \
250 -e "s/@ver[s]ion@/${version}/" \
251 -e 's/@MAKE[I]NFO@/makeinfo/' -e 's/@MK[D]IR_P@/mkdir -p/' \
09af5c3e
GM
252 ${srcdir}/Makefile.in > emacs-misc-${version}/Makefile
253 @if grep '@[a-zA-Z_]*@' emacs-misc-${version}/Makefile; then \
254 echo "Unexpanded configure variables in Makefile?" 1>&2; exit 1; \
255 fi
256 tar -cf emacs-misc-${version}.tar emacs-misc-${version}
257 rm -rf emacs-misc-${version}
258
8496d8d7
GM
259
260.PHONY: install-dvi install-html install-pdf install-ps install-doc
261
262install-dvi: dvi
48f73cfb
GM
263 umask 022; $(MKDIR_P) "$(DESTDIR)$(dvidir)"
264 $(INSTALL_DATA) $(DVI_TARGETS) "$(DESTDIR)$(dvidir)"
8496d8d7 265install-html: html
48f73cfb
GM
266 umask 022; $(MKDIR_P) "$(DESTDIR)$(htmldir)"
267 $(INSTALL_DATA) $(HTML_TARGETS) "$(DESTDIR)$(htmldir)"
8496d8d7 268install-pdf: pdf
48f73cfb
GM
269 umask 022;$(MKDIR_P) "$(DESTDIR)$(pdfdir)"
270 $(INSTALL_DATA) $(PDF_TARGETS) "$(DESTDIR)$(pdfdir)"
8496d8d7 271install-ps: ps
48f73cfb 272 umask 022; $(MKDIR_P) "$(DESTDIR)$(psdir)"
8496d8d7 273 for file in $(PS_TARGETS); do \
48f73cfb 274 $(INSTALL_DATA) $${file} "$(DESTDIR)$(psdir)"; \
8496d8d7 275 [ -n "${GZIP_PROG}" ] || continue; \
48f73cfb
GM
276 rm -f "$(DESTDIR)$(psdir)/$${file}.gz"; \
277 ${GZIP_PROG} -9n "$(DESTDIR)$(psdir)/$${file}"; \
8496d8d7
GM
278 done
279
280## Top-level Makefile installs the info pages.
281install-doc: install-dvi install-html install-pdf install-ps
282
283
284
285.PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps uninstall-doc
286
287uninstall-dvi:
288 for file in $(DVI_TARGETS); do \
48f73cfb 289 rm -f "$(DESTDIR)$(dvidir)/$${file}"; \
8496d8d7
GM
290 done
291uninstall-html:
292 for file in $(HTML_TARGETS); do \
48f73cfb 293 rm -f "$(DESTDIR)$(htmldir)/$${file}"; \
8496d8d7
GM
294 done
295uninstall-ps:
296 ext= ; [ -n "${GZIP_PROG}" ] && ext=.gz; \
297 for file in $(PS_TARGETS); do \
48f73cfb 298 rm -f "$(DESTDIR)$(psdir)/$${file}$${ext}"; \
8496d8d7
GM
299 done
300uninstall-pdf:
301 for file in $(PDF_TARGETS); do \
48f73cfb 302 rm -f "$(DESTDIR)$(pdfdir)/$${file}"; \
8496d8d7
GM
303 done
304
305uninstall-doc: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps
306
307
c21180f3 308### Makefile ends here