Parallelize clean rules using GNU make features
[emacs.git] / doc / misc / Makefile.in
blobd191534c2de603f8d04ea98e391e97da97b55343
1 ### @configure_input@
3 # Copyright (C) 1994, 1996-2014 Free Software Foundation, Inc.
5 # This file is part of GNU Emacs.
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.
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.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20 SHELL = @SHELL@
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.
24 srcdir=@srcdir@
26 version=@version@
28 ## Where the output files go.
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.
32 buildinfodir = $(srcdir)/../../info
34 ## Directory with emacsver.texi.
35 emacsdir = $(srcdir)/../emacs
37 prefix = @prefix@
38 datarootdir = @datarootdir@
39 datadir = @datadir@
40 PACKAGE_TARNAME = @PACKAGE_TARNAME@
41 docdir = @docdir@
42 dvidir = @dvidir@
43 htmldir = @htmldir@
44 pdfdir = @pdfdir@
45 psdir = @psdir@
47 MKDIR_P = @MKDIR_P@
49 GZIP_PROG = @GZIP_PROG@
51 HTML_OPTS = --no-split --html
53 # Options used only when making info output.
54 # (Note that idlwave, info used --nosplit even without the .info extension.)
55 INFO_OPTS= --no-split
57 INSTALL = @INSTALL@
58 INSTALL_DATA = @INSTALL_DATA@
60 # The makeinfo program is part of the Texinfo distribution.
61 # Use --force so that it generates output even if there are errors.
62 # (TODO? Why is this appropriate?)
63 MAKEINFO = @MAKEINFO@
64 MAKEINFO_OPTS = --force -I$(emacsdir)
66 ## On MS Windows, efaq-w32; otherwise blank.
67 DOCMISC_W32 = @DOCMISC_W32@
69 ## Info files to build and install on all platforms.
70 INFO_COMMON = ada-mode auth autotype bovine calc ccmode cl \
71 dbus dired-x ebrowse ede ediff edt eieio \
72 emacs-mime epa erc ert eshell eudc efaq eww \
73 flymake forms gnus emacs-gnutls htmlfontify idlwave ido info.info \
74 mairix-el message mh-e newsticker nxml-mode octave-mode \
75 org pcl-cvs pgg rcirc remember reftex sasl \
76 sc semantic ses sieve smtpmail speedbar srecode todo-mode tramp \
77 url vhdl-mode vip viper widget wisent woman
79 ## Info files to install on current platform.
80 INFO_INSTALL = $(INFO_COMMON) $(DOCMISC_W32)
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.
85 INFO_TARGETS = $(INFO_COMMON) efaq-w32
87 # There are some naming differences between the info targets and the other
88 # targets, so let's resolve them here.
89 TARGETS_1 = $(INFO_INSTALL:ccmode=cc-mode)
90 TARGETS = $(TARGETS_1:info.info=info)
92 DVI_TARGETS = $(TARGETS:=.dvi)
93 HTML_TARGETS = $(TARGETS:=.html)
94 PDF_TARGETS = $(TARGETS:=.pdf)
95 PS_TARGETS = $(TARGETS:=.ps)
97 TEXI2DVI = texi2dvi
98 TEXI2PDF = texi2pdf
99 DVIPS = dvips
101 ENVADD = TEXINPUTS="$(srcdir):$(emacsdir):$(TEXINPUTS)" \
102 MAKEINFO="$(MAKEINFO) $(MAKEINFO_OPTS)"
104 gfdl = ${srcdir}/doclicense.texi
106 .PHONY: info dvi html pdf ps echo-info $(INFO_TARGETS)
107 ## Prevent implicit rule triggering for foo.info.
108 .SUFFIXES:
110 # Default.
111 info: $(INFO_TARGETS)
113 ## Used by top-level Makefile.
114 ## Base file names of output info files.
115 echo-info:
116 @echo "$(INFO_INSTALL) " | \
117 sed -e 's|[^ ]*/||g' -e 's/\.info//g' -e "s/ */.info /g"
119 dvi: $(DVI_TARGETS)
121 html: $(HTML_TARGETS)
123 pdf: $(PDF_TARGETS)
125 ps: $(PS_TARGETS)
127 ${buildinfodir}:
128 ${MKDIR_P} $@
130 ### The general case.
132 EXTRA_OPTS =
134 ${buildinfodir}/%.info: ${srcdir}/%.texi ${gfdl} | ${buildinfodir}
135 $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) $(EXTRA_OPTS) -o $@ $<
137 ## The short aliases, eg efaq = $(buildinfodir)/efaq.info.
138 define info_template
139 $(1): $$(buildinfodir)/$(1).info
140 endef
142 ## "info" is already taken.
143 info.info: $(buildinfodir)/info.info
145 $(foreach ifile,$(filter-out info.info,$(INFO_TARGETS)),$(eval $(call info_template,$(ifile))))
148 %.dvi: ${srcdir}/%.texi ${gfdl}
149 $(ENVADD) $(TEXI2DVI) $<
151 %.pdf: ${srcdir}/%.texi ${gfdl}
152 $(ENVADD) $(TEXI2PDF) $<
154 %.html: ${srcdir}/%.texi ${gfdl}
155 $(MAKEINFO) $(MAKEINFO_OPTS) $(HTML_OPTS) $(EXTRA_OPTS) -o $@ $<
157 %.ps: %.dvi
158 $(DVIPS) -o $@ $<
161 ### The exceptions.
163 ## Extra dependencies.
165 need_emacsver = calc cl dired-x efaq efaq-w32 erc ido reftex woman
166 need_emacsver_prefix = $(addprefix ${buildinfodir}/,${need_emacsver})
168 $(need_emacsver_prefix:=.info) $(need_emacsver:=.dvi) $(need_emacsver:=.pdf) $(need_emacsver:=.html) : ${emacsdir}/emacsver.texi
170 $(buildinfodir)/gnus.info gnus.html: ${srcdir}/gnus-faq.texi
172 $(buildinfodir)/semantic.info semantic.dvi semantic.pdf semantic.html: ${srcdir}/sem-user.texi
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 $@ $<
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 $@ $<
184 efaq%.dvi: ${srcdir}/efaq%.texi
185 $(ENVADD) $(TEXI2DVI) $<
187 efaq%.pdf: ${srcdir}/efaq%.texi
188 $(ENVADD) $(TEXI2PDF) $<
190 efaq%.html: ${srcdir}/efaq%.texi
191 $(MAKEINFO) $(MAKEINFO_OPTS) $(HTML_OPTS) -o $@ $<
193 ${buildinfodir}/emacs-mime.info emacs-mime.html: EXTRA_OPTS = --enable-encoding
195 gnus_deps = ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi ${gfdl}
196 gnus.dvi: $(gnus_deps)
197 sed -e '/@iflatex/,/@end iflatex/d' $< > gnustmpdvi.texi
198 $(ENVADD) $(TEXI2DVI) gnustmpdvi.texi
199 cp gnustmpdvi.dvi $@
200 rm gnustmpdvi.*
202 gnus.pdf: $(gnus_deps)
203 sed -e '/@iflatex/,/@end iflatex/d' $< > gnustmppdf.texi
204 $(ENVADD) $(TEXI2PDF) gnustmppdf.texi
205 cp gnustmppdf.pdf $@
206 rm gnustmppdf.*
208 ${buildinfodir}/tramp.info tramp.html: EXTRA_OPTS = -D emacs
209 ${buildinfodir}/tramp.info tramp.html: ${srcdir}/trampver.texi
212 .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
214 mostlyclean:
215 rm -f *.aux *.log *.toc *.c[mp] *.c[mp]s *.fn *.fns \
216 *.ky *.kys *.op *.ops *.p[gj] *.p[gj]s *.sc *.scs *.ss \
217 *.t[gp] *.t[gp]s *.vr *.vrs
218 rm -f gnustmp*
220 clean: mostlyclean
221 rm -f $(DVI_TARGETS) $(HTML_TARGETS) $(PDF_TARGETS) $(PS_TARGETS)
222 rm -f efaq-w32.dvi efaq-w32.html efaq-w32.pdf efaq-w32.ps
223 rm -f emacs-misc-${version}.tar*
225 distclean: clean
226 rm -f Makefile
228 ## buildinfodir is relative to srcdir.
229 infoclean:
230 for file in $(INFO_TARGETS); do \
231 file=`echo $${file} | sed 's/\.info$$//'`.info; \
232 rm -f \
233 $(buildinfodir)/$${file} \
234 $(buildinfodir)/$${file}-[1-9] \
235 $(buildinfodir)/$${file}-[1-9][0-9]; \
236 done
238 bootstrap-clean maintainer-clean: distclean infoclean
240 dist:
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/' \
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; \
256 tar -cf emacs-misc-${version}.tar emacs-misc-${version}
257 rm -rf emacs-misc-${version}
260 .PHONY: install-dvi install-html install-pdf install-ps install-doc
262 install-dvi: dvi
263 umask 022; $(MKDIR_P) "$(DESTDIR)$(dvidir)"
264 $(INSTALL_DATA) $(DVI_TARGETS) "$(DESTDIR)$(dvidir)"
265 install-html: html
266 umask 022; $(MKDIR_P) "$(DESTDIR)$(htmldir)"
267 $(INSTALL_DATA) $(HTML_TARGETS) "$(DESTDIR)$(htmldir)"
268 install-pdf: pdf
269 umask 022;$(MKDIR_P) "$(DESTDIR)$(pdfdir)"
270 $(INSTALL_DATA) $(PDF_TARGETS) "$(DESTDIR)$(pdfdir)"
271 install-ps: ps
272 umask 022; $(MKDIR_P) "$(DESTDIR)$(psdir)"
273 for file in $(PS_TARGETS); do \
274 $(INSTALL_DATA) $${file} "$(DESTDIR)$(psdir)"; \
275 [ -n "${GZIP_PROG}" ] || continue; \
276 rm -f "$(DESTDIR)$(psdir)/$${file}.gz"; \
277 ${GZIP_PROG} -9n "$(DESTDIR)$(psdir)/$${file}"; \
278 done
280 ## Top-level Makefile installs the info pages.
281 install-doc: install-dvi install-html install-pdf install-ps
285 .PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps uninstall-doc
287 uninstall-dvi:
288 for file in $(DVI_TARGETS); do \
289 rm -f "$(DESTDIR)$(dvidir)/$${file}"; \
290 done
291 uninstall-html:
292 for file in $(HTML_TARGETS); do \
293 rm -f "$(DESTDIR)$(htmldir)/$${file}"; \
294 done
295 uninstall-ps:
296 ext= ; [ -n "${GZIP_PROG}" ] && ext=.gz; \
297 for file in $(PS_TARGETS); do \
298 rm -f "$(DESTDIR)$(psdir)/$${file}$${ext}"; \
299 done
300 uninstall-pdf:
301 for file in $(PDF_TARGETS); do \
302 rm -f "$(DESTDIR)$(pdfdir)/$${file}"; \
303 done
305 uninstall-doc: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps
308 ### Makefile ends here