Merge from emacs-24; up to 2014-06-03T06:51:18Z!eliz@gnu.org
[bpt/emacs.git] / Makefile.in
CommitLineData
bbece175 1### @configure_input@
067d23c9 2
ba318903 3# Copyright (C) 1992-2014 Free Software Foundation, Inc.
067d23c9
KY
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 <http://www.gnu.org/licenses/>.
19
20### Commentary:
21
22# make all to compile and build Emacs.
23# make install to install it.
24# make TAGS to update tags tables.
25#
26# make clean or make mostlyclean
27# Delete all files from the current directory that are normally
28# created by building the program. Don't delete the files that
29# record the configuration. Also preserve files that could be made
30# by building, but normally aren't because the distribution comes
31# with them.
32#
33# Delete `.dvi' files here if they are not part of the distribution.
34#
35# make distclean
36# Delete all files from the current directory that are created by
37# configuring or building the program. If you have unpacked the
38# source and built the program without creating any other files,
39# `make distclean' should leave only the files that were in the
40# distribution.
41#
42# make maintainer-clean
43# Delete everything from the current directory that can be
44# reconstructed with this Makefile. This typically includes
45# everything deleted by distclean, plus more: .elc files,
46# C source files produced by Bison, tags tables, info files,
47# and so on.
48#
49# make extraclean
50# Still more severe - delete backup and autosave files, too.
7e3bf78c
GM
51# Also generated files that do not normally change and can be slow
52# to rebuild (eg leim/ja-dic).
067d23c9
KY
53#
54# make bootstrap
55# Removes all the compiled files to force a new bootstrap from a
56# clean slate, and then build in the normal way.
b59a2e9e
PE
57#
58# make docs
59# Make Emacs documentation files from their sources; requires makeinfo.
067d23c9 60
50b13cde 61SHELL = @SHELL@
067d23c9 62
f6dce6c1
GM
63# This only matters when inheriting a CDPATH not starting with the
64# current directory.
067d23c9
KY
65CDPATH=
66
67# If Make doesn't predefine MAKE, set it here.
68@SET_MAKE@
69
4c9a1377
PE
70# Prevent submakes from outputting "Entering directory ..." and
71# "Leaving directory..." diagnostics that would mess up 'make echo-info'.
72QUIET_SUBMAKE = MAKELEVEL=0
73
067d23c9
KY
74# ==================== Things `configure' Might Edit ====================
75
6c269a38 76cache_file = @cache_file@
501390c5 77CONFIGURE_FLAGS = --cache-file=$(cache_file)
6c269a38 78
61784fd1
GM
79AUTOCONF = @AUTOCONF@
80AUTOMAKE = @AUTOMAKE@
81AUTOHEADER = @AUTOHEADER@
82ACLOCAL = @ACLOCAL@
83
067d23c9 84EXEEXT=@EXEEXT@
067d23c9
KY
85
86### These help us choose version- and architecture-specific directories
87### to install files in.
88
89### This should be the number of the Emacs version we're building,
90### like `18.59' or `19.0'.
91version=@version@
92
93### This should be the name of the configuration we're building Emacs
94### for, like `mips-dec-ultrix' or `sparc-sun-sunos'.
95configuration=@configuration@
96
095bf253
EZ
97### The nt/ subdirectory gets built only for MinGW
98NTDIR=@NTDIR@
99
067d23c9
KY
100# ==================== Where To Install Things ====================
101
3a4155de
GM
102# Location to install Emacs.app under GNUstep / Mac OS X.
103# Later values may use these.
104ns_appbindir=@ns_appbindir@
105ns_appresdir=@ns_appresdir@
b4a36200
GM
106# Either yes or no depending on whether this is a relocatable Emacs.app.
107ns_self_contained=@ns_self_contained@
3a4155de 108
067d23c9
KY
109# The default location for installation. Everything is placed in
110# subdirectories of this directory. The default values for many of
111# the variables below are expressed in terms of this one, so you may
112# not need to change them. This defaults to /usr/local.
113prefix=@prefix@
114
115# Like `prefix', but used for architecture-specific files.
116exec_prefix=@exec_prefix@
117
118# Where to install Emacs and other binaries that people will want to
119# run directly (like etags).
120bindir=@bindir@
121
122# The root of the directory tree for read-only architecture-independent
123# data files. ${datadir}, ${infodir} and ${mandir} are based on this.
124datarootdir=@datarootdir@
125
126# Where to install architecture-independent data files. ${lispdir}
127# and ${etcdir} are subdirectories of this.
128datadir=@datadir@
129
130# Where to install and expect the files that Emacs modifies as it
131# runs. These files are all architecture-independent.
132# Right now, this is not used.
133sharedstatedir=@sharedstatedir@
134
135# Where to install and expect executable files to be run by Emacs
3a4155de
GM
136# rather than directly by users (and other architecture-dependent
137# data, although Emacs does not have any). The executables
138# are actually installed in ${archlibdir}, which is (normally)
139# a subdirectory of this.
067d23c9
KY
140libexecdir=@libexecdir@
141
142# Where to install Emacs's man pages.
ab1121bd 143# Note they contain cross-references that expect them to be in section 1.
067d23c9
KY
144mandir=@mandir@
145man1dir=$(mandir)/man1
067d23c9 146
9aa071df 147# Where to install and expect the info files describing Emacs.
067d23c9 148infodir=@infodir@
9aa071df 149# Info files not in the doc/misc directory (we get those via make echo-info).
40abffe4 150INFO_NONMISC=emacs.info eintr.info elisp.info
067d23c9 151
e5365138
GM
152# If no makeinfo was found and configured --without-makeinfo, "no"; else "yes".
153HAVE_MAKEINFO=@HAVE_MAKEINFO@
154
067d23c9
KY
155# Directory for local state files for all programs.
156localstatedir=@localstatedir@
157
158# Where to look for bitmap files.
159bitmapdir=@bitmapdir@
160
161# Where to find the source code. The source code for Emacs's C kernel is
162# expected to be in ${srcdir}/src, and the source code for Emacs's
163# utility programs is expected to be in ${srcdir}/lib-src. This is
164# set by the configure script's `--srcdir' option.
165
166# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
167srcdir=@srcdir@
b8e3b0a9 168abs_srcdir=@abs_srcdir@
067d23c9
KY
169
170# Where the manpage source files are kept.
171mansrcdir=$(srcdir)/doc/man
172
173# Tell make where to find source files; this is needed for the makefiles.
174VPATH=@srcdir@
175
176# Where to find the application default.
177x_default_search_path=@x_default_search_path@
178
067d23c9
KY
179# Where the etc/emacs.desktop file is to be installed.
180desktopdir=$(datarootdir)/applications
181
182# Where the etc/images/icons/hicolor directory is to be installed.
183icondir=$(datarootdir)/icons
184
185# The source directory for the icon files.
186iconsrcdir=$(srcdir)/etc/images/icons
187
188# ==================== Emacs-specific directories ====================
189
190# These variables hold the values Emacs will actually use. They are
191# based on the values of the standard Make variables above.
192
cb6c95a3
GM
193# Where to install the lisp files distributed with Emacs.
194# This includes the Emacs version, so that the lisp files for different
195# versions of Emacs will install themselves in separate directories.
067d23c9
KY
196lispdir=@lispdir@
197
ca26824c 198# Directories Emacs should search for standard lisp files.
cb6c95a3 199# The default is ${lispdir}.
ca26824c
GM
200standardlisppath=@standardlisppath@
201
202# Directories Emacs should search for lisp files specific to this
203# site (i.e. customizations), before consulting ${standardlisppath}.
204# This should be a colon-separated list of directories.
067d23c9
KY
205locallisppath=@locallisppath@
206
207# Where Emacs will search to find its lisp files. Before
208# changing this, check to see if your purpose wouldn't
209# better be served by changing locallisppath. This
210# should be a colon-separated list of directories.
ca26824c 211# The default is ${locallisppath}:${standardlisppath}.
067d23c9
KY
212lisppath=@lisppath@
213
624780f0
GM
214# Where Emacs will search for its lisp files while building.
215# This is only used during the process of compiling Emacs,
216# to help Emacs find its lisp files before they've been installed
217# in their final location.
5b43da69 218# This should be a colon-separated list of directories.
cb6c95a3 219# Normally it points to the lisp/ directory in the sources.
624780f0 220# NB lread.c relies on lisp/ being first here.
cb6c95a3 221buildlisppath=${abs_srcdir}/lisp
067d23c9
KY
222
223# Where to install the other architecture-independent
224# data files distributed with Emacs (like the tutorial,
225# the cookie recipes and the Zippy database). This path
226# usually contains the Emacs version number, so the data
227# files for multiple versions of Emacs may be installed
228# at once.
229etcdir=@etcdir@
230
231# Where to put executables to be run by Emacs rather than
232# the user. This path usually includes the Emacs version
233# and configuration name, so that multiple configurations
234# for multiple versions of Emacs may be installed at
235# once.
236archlibdir=@archlibdir@
237
8496d8d7
GM
238# Where to put the etc/DOC file.
239etcdocdir=@etcdocdir@
067d23c9
KY
240
241# Where to install Emacs game score files.
242gamedir=@gamedir@
243
244# ==================== Utility Programs for the Build ====================
245
246# Allow the user to specify the install program.
a36e64d0
GM
247# Note that if the system does not provide a suitable install,
248# configure will use build-aux/install-sh. Annoyingly, it does
249# not use an absolute path. So we must take care to always run
3fe7cdc8 250# INSTALL-type commands from the directory containing the Makefile.
a36e64d0 251# This explains (I think) the cd thisdir seen in several install rules.
067d23c9
KY
252INSTALL = @INSTALL@
253INSTALL_PROGRAM = @INSTALL_PROGRAM@
254INSTALL_DATA = @INSTALL_DATA@
255INSTALL_INFO = @INSTALL_INFO@
256# By default, we uphold the dignity of our programs.
257INSTALL_STRIP =
3fe7cdc8 258MKDIR_P = @MKDIR_P@
4f8902cd
GM
259# Create a link to a file in the same directory as the target.
260LN_S_FILEONLY = @LN_S_FILEONLY@
067d23c9
KY
261
262# We use gzip to compress installed .el files.
263GZIP_PROG = @GZIP_PROG@
067d23c9
KY
264
265# ============================= Targets ==============================
266
267# Program name transformation.
268TRANSFORM = @program_transform_name@
269
270# What emacs should be called when installed.
59696ae0
GM
271EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
272EMACS = ${EMACS_NAME}${EXEEXT}
eeced60b 273EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT}
067d23c9 274
9192d37d 275# Subdirectories to make recursively.
cb6c95a3 276SUBDIR = $(NTDIR) lib lib-src src lisp
067d23c9
KY
277
278# The subdir makefiles created by config.status.
70716b1d 279SUBDIR_MAKEFILES_IN = @SUBDIR_MAKEFILES_IN@
cee4acda 280SUBDIR_MAKEFILES = `echo $(SUBDIR_MAKEFILES_IN:.in=) | sed 's|$(srcdir)/||g'`
067d23c9 281
095bf253
EZ
282# Subdirectories to install, and where they'll go. lib-src's and nt's
283# makefiles know how to install them, so we don't do that here.
284# Directories that cannot simply be copied, eg info, are treated
cb6c95a3
GM
285# separately.
286COPYDIR = ${srcdir}/etc ${srcdir}/lisp
287COPYDESTS = "$(DESTDIR)${etcdir}" "$(DESTDIR)${lispdir}"
067d23c9 288
931be30d 289all: ${SUBDIR} info
067d23c9 290
2ff06dac 291.PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32
0aee6912 292
c6e7fc0e 293removenullpaths=sed -e 's/^:*//' -e 's/:*$$//g' -e 's/::*/:/g'
067d23c9
KY
294
295# Generate epaths.h from epaths.in. This target is invoked by `configure'.
c4444d16 296# See comments in configure.ac for why it is done this way, as opposed
067d23c9
KY
297# to just letting configure generate epaths.h from epaths.in in a
298# similar way to how Makefile is made from Makefile.in.
2ff06dac 299epaths-force:
ffd817eb
JD
300 @(standardlisppath=`echo "${standardlisppath}" | ${removenullpaths}` ; \
301 locallisppath=`echo "${locallisppath}" | ${removenullpaths}` ; \
302 buildlisppath=`echo "${buildlisppath}" | ${removenullpaths}` ; \
067d23c9
KY
303 x_default_search_path=`echo ${x_default_search_path}`; \
304 gamedir=`echo ${gamedir}`; \
305 sed < ${srcdir}/src/epaths.in > epaths.h.$$$$ \
ca26824c
GM
306 -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "'"$${standardlisppath}"'";' \
307 -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${locallisppath}"'";' \
067d23c9
KY
308 -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'"$${buildlisppath}"'";' \
309 -e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";' \
310 -e 's;\(#.*PATH_INFO\).*$$;\1 "${infodir}";' \
311 -e 's;\(#.*PATH_DATA\).*$$;\1 "${etcdir}";' \
312 -e 's;\(#.*PATH_BITMAPS\).*$$;\1 "${bitmapdir}";' \
313 -e 's;\(#.*PATH_X_DEFAULTS\).*$$;\1 "${x_default_search_path}";' \
314 -e 's;\(#.*PATH_GAME\).*$$;\1 "${gamedir}";' \
8496d8d7 315 -e 's;\(#.*PATH_DOC\).*$$;\1 "${etcdocdir}";') && \
24e0f6b1 316 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
067d23c9 317
e976486e 318# Replace "${w32prefix}" with '%emacs_dir%' (which expands to install
6c0a9ed1 319# directory at runtime).
e976486e 320msys_w32prefix_subst=sed -e 's!\(^\|;\)'"$${w32prefixpattern}"'\([;/]\|$$\)!\1%emacs_dir%\2!g'
6c0a9ed1
RC
321
322# Quote Sed special characters (except backslash and newline) with
323# a double backslash.
324msys_sed_sh_escape=sed -e 's/[];$$*.^[]/\\\\&/g'
d6db9fd6
EZ
325
326# The w32 build needs a slightly different editing, and it uses
327# nt/epaths.nt as the template.
e976486e 328#
6c0a9ed1
RC
329# Use the value of ${locallisppath} supplied by `configure',
330# to support the --enable-locallisppath argument.
c923b188 331#
e976486e
DM
332# In this case, the paths written to 'src/epaths.h' must be in native
333# MS-Windows format (e.g. 'c:/foo/bar'), because temacs is a MinGW
334# program that doesn't support MSYS-style paths (e.g. '/c/foo/bar' or
335# '/foo/bar').
2ff06dac 336epaths-force-w32:
e976486e
DM
337 @(w32srcdir=`${srcdir}/build-aux/msys-to-w32 "${srcdir}"`; \
338 w32prefix=`${srcdir}/build-aux/msys-to-w32 "${prefix}" N`; \
04445382 339 w32prefixpattern=`echo "$${w32prefix}" | ${msys_sed_sh_escape}` ; \
e976486e 340 w32locallisppath=`${srcdir}/build-aux/msys-to-w32 "${locallisppath}" N ":" "\\;" | ${msys_w32prefix_subst}` ; \
d6db9fd6 341 sed < ${srcdir}/nt/epaths.nt > epaths.h.$$$$ \
e976486e 342 -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${w32locallisppath}"'";' \
d6db9fd6
EZ
343 -e '/^.*#/s/@VER@/${version}/g' \
344 -e '/^.*#/s/@CFG@/${configuration}/g' \
345 -e "/^.*#/s|@SRC@|$${w32srcdir}|g") && \
346 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
347
224e313d
PE
348# If lib/Makefile would build files in '.', then build them before
349# building 'lib', to avoid races with parallel makes.
350lib: am--refresh
351
030a1c5e 352lib-src src: $(NTDIR) lib
9a514d4a 353
224e313d 354src: lib-src
067d23c9 355
cb6c95a3
GM
356# We need to build `emacs' in `src' to compile the *.elc files in `lisp'.
357lisp: src
067d23c9
KY
358
359# These targets should be "${SUBDIR} without `src'".
2ff06dac 360lib lib-src lisp nt: Makefile
f9d80c51 361 cd $@ && $(MAKE) all
067d23c9
KY
362
363# Pass to src/Makefile.in an additional BOOTSTRAPEMACS variable which
364# is either set to bootstrap-emacs (in case bootstrap-emacs has not been
365# constructed yet) or the empty string (otherwise).
366# src/Makefile.in uses it to implement conditional dependencies, so that
367# files that need bootstrap-emacs to be built do not additionally need
368# to be kept fresher than bootstrap-emacs. Otherwise changing a single
369# file src/foo.c forces dumping a new bootstrap-emacs, then re-byte-compiling
370# all preloaded elisp files, and only then dump the actual src/emacs, which
371# is not wrong, but is overkill in 99.99% of the cases.
c6e81186
GM
372#
373# Note the use of single quotes in the value of vcswitness.
76a0368a 374# This passes an unexpanded $srcdir to src's Makefile, which then
c6e81186
GM
375# expands it using its own value of srcdir (which points to the
376# source directory of src/).
2ff06dac 377src: Makefile
224e313d
PE
378 dirstate='.bzr/checkout/dirstate'; \
379 vcswitness='$$(srcdir)/../'$$dirstate; \
380 [ -r "$(srcdir)/$$dirstate" ] || vcswitness=''; \
381 cd $@ || exit; \
382 boot=bootstrap-emacs$(EXEEXT); \
383 [ ! -x "$$boot" ] || boot=''; \
f9d80c51 384 $(MAKE) all BOOTSTRAPEMACS="$$boot" VCSWITNESS="$$vcswitness"
067d23c9 385
2ff06dac 386blessmail: Makefile src
f9d80c51 387 cd lib-src && $(MAKE) maybe-blessmail
067d23c9
KY
388
389# We used to have one rule per */Makefile.in, but that leads to race
390# conditions with parallel makes, so let's assume that the time stamp on
391# ./Makefile is representative of the time stamp on all the other Makefiles.
8f25abd3
PE
392#
393# config.status overrides MAKEFILE_NAME with a bogus name when creating
394# src/epaths.h, so that 'make epaths-force' does not recursively invoke
395# config.status and overwrite config.status while executing it (Bug#11214).
c462dda8
PE
396#
397# 'make bootstrap' overrides MAKEFILE_NAME to a nonexistent file but
398# then attempts to build that file. This forces 'Makefile', 'lib/Makefile',
399# etc. to be built without running into similar recursion problems.
8f25abd3
PE
400MAKEFILE_NAME = Makefile
401$(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \
90eacf99 402 $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN) $(srcdir)/src/lisp.mk
50bfc824 403 MAKE='$(MAKE)' ./config.status
067d23c9 404
b8b0239f
PE
405# Don't erase these files if make is interrupted while refreshing them.
406.PRECIOUS: Makefile config.status
bfab7d85 407
50bfc824 408config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
bfab7d85 409 if [ -x ./config.status ]; then \
224e1caa 410 $(CFG) ./config.status --recheck; \
bfab7d85 411 else \
224e1caa 412 $(CFG) $(srcdir)/configure $(CONFIGURE_FLAGS); \
bfab7d85 413 fi
067d23c9 414
c4444d16 415AUTOCONF_INPUTS = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
067d23c9
KY
416
417$(srcdir)/configure: $(AUTOCONF_INPUTS)
61784fd1 418 cd ${srcdir} && ${AUTOCONF}
067d23c9 419
541df9f4 420ACLOCAL_PATH = @ACLOCAL_PATH@
946ec224 421ACLOCAL_INPUTS = $(srcdir)/configure.ac $(srcdir)/m4/gnulib-comp.m4
9a514d4a 422$(srcdir)/aclocal.m4: $(ACLOCAL_INPUTS)
61784fd1 423 cd $(srcdir) && ACLOCAL_PATH='$(ACLOCAL_PATH)' $(ACLOCAL) -I m4
9a514d4a 424
501390c5
PE
425AUTOMAKE_INPUTS = $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am \
426 $(srcdir)/lib/gnulib.mk
9a514d4a 427$(srcdir)/lib/Makefile.in: $(AUTOMAKE_INPUTS)
61784fd1 428 cd $(srcdir) && $(AUTOMAKE) --gnu -a -c lib/Makefile
b8b0239f
PE
429
430# Regenerate files that this makefile would have made, if this makefile
431# had been built by Automake. The name 'am--refresh' is for
432# compatibility with subsidiary Automake-generated makefiles.
925e561d 433am--refresh: $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/src/config.in
3cbecb8f 434.PHONY: am--refresh
9a514d4a 435
067d23c9
KY
436$(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in
437 @ # Usually, there's no need to rebuild src/config.in just
438 @ # because stamp-h.in has changed (since building stamp-h.in
439 @ # refreshes config.in as well), but if config.in is missing
440 @ # then we really need to do something more.
61784fd1 441 [ -r "$@" ] || ( cd ${srcdir} && ${AUTOHEADER} )
067d23c9 442$(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
61784fd1 443 cd ${srcdir} && ${AUTOHEADER}
067d23c9
KY
444 rm -f $(srcdir)/src/stamp-h.in
445 echo timestamp > $(srcdir)/src/stamp-h.in
446
447# ==================== Installation ====================
448
8496d8d7 449.PHONY: install install-arch-dep install-arch-indep install-etcdoc install-info
da53c452
EZ
450.PHONY: install-man install-etc install-strip install-$(NTDIR)
451.PHONY: uninstall uninstall-$(NTDIR)
0aee6912 452
067d23c9
KY
453## If we let lib-src do its own installation, that means we
454## don't have to duplicate the list of utilities to install in
455## this Makefile as well.
456
8496d8d7 457install: all install-arch-indep install-etcdoc install-arch-dep install-$(NTDIR) blessmail
067d23c9
KY
458 @true
459
53a84f3c 460## Ensure that $subdir contains a subdirs.el file.
7606c360
GM
461## Here and elsewhere, we set the umask so that any created files are
462## world-readable.
463## TODO it might be good to warn about non-standard permissions of
464## pre-existing directories, but that does not seem easy.
48f73cfb 465write_subdir=if [ -f "$${subdir}/subdirs.el" ]; \
53a84f3c
GM
466 then true; \
467 else \
4c54abe1 468 umask 022; \
48f73cfb 469 ${MKDIR_P} "$${subdir}"; \
53a84f3c
GM
470 (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
471 echo " (normal-top-level-add-subdirs-to-load-path))") \
48f73cfb 472 > "$${subdir}/subdirs.el"; \
4c54abe1 473 fi
53a84f3c 474
067d23c9 475### Install the executables that were compiled specifically for this machine.
ed0ba302
GM
476### We do install-arch-indep first because the executable needs the
477### Lisp files and DOC file to work properly.
8496d8d7 478install-arch-dep: src install-arch-indep install-etcdoc install-$(NTDIR)
48f73cfb 479 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
f9d80c51 480 cd lib-src && $(MAKE) install
b4a36200 481 if test "${ns_self_contained}" = "no"; then \
48f73cfb
GM
482 ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} "$(DESTDIR)${bindir}/$(EMACSFULL)" || exit 1 ; \
483 chmod 1755 "$(DESTDIR)${bindir}/$(EMACSFULL)" || true; \
5af9cb6b 484 if test "x${NO_BIN_LINK}" = x; then \
48f73cfb
GM
485 rm -f "$(DESTDIR)${bindir}/$(EMACS)" ; \
486 cd "$(DESTDIR)${bindir}" && $(LN_S_FILEONLY) $(EMACSFULL) $(EMACS); \
5af9cb6b 487 fi; \
96182ae6 488 else \
05f3d308 489 subdir=${ns_appresdir}/site-lisp; \
05f3d308
GM
490 ${write_subdir} || exit 1; \
491 rm -rf ${ns_appresdir}/share; \
96182ae6 492 fi
da53c452
EZ
493
494### Windows-specific install target for installing programs produced
495### in nt/, and its Posix do-nothing shadow.
496install-:
497install-nt:
f9d80c51 498 cd $(NTDIR) && $(MAKE) install
067d23c9 499
05f3d308 500## In the share directory, we are deleting:
660c8c1e
GM
501## applications (with emacs.desktop, also found in etc/)
502## emacs (basically empty except for unneeded site-lisp directories)
05f3d308 503## icons (duplicates etc/images/icons/hicolor)
05f3d308 504
6b3868cb
GM
505## This is install-etc for everything except self-contained-ns builds.
506## For them, it is empty.
507INSTALL_ARCH_INDEP_EXTRA = @INSTALL_ARCH_INDEP_EXTRA@
508
067d23c9
KY
509## http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01672.html
510## Needs to be the user running install, so configure can't set it.
511set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \
512 `id -un 2> /dev/null`; do \
513 [ -n "$${installuser}" ] && break ; \
514 done
515
516### Install the files that are machine-independent.
29473393
GM
517### Most of them come straight from the distribution; the exception is
518### the DOC file, which is copied from the build directory.
067d23c9 519
7606c360
GM
520## We delete each directory in ${COPYDESTS} before we copy into it;
521## that way, we can reinstall over directories that have been put in
522## place with their files read-only (perhaps because they are checked
523## into RCS). In order to make this safe, we make sure that the
524## source exists and is distinct from the destination.
62061397 525
29473393
GM
526## We delete etc/DOC* because there may be irrelevant DOC files from
527## other builds in the source directory. This is ok because we just
528## deleted the entire installed etc/ directory and recreated it.
8496d8d7 529## install-etcdoc installs the relevant DOC.
29473393 530
4fa44856
GM
531## Note that we install etc/refcards/*.ps if present.
532## TODO we should compress these if GZIP_PROG is set.
533## It would be simpler to have a separate install rule for etc/refcards
534## (maybe move it to doc/refcards?).
535
29473393
GM
536## Note that the Makefiles in the etc directory are potentially useful
537## in an installed Emacs, so should not be excluded.
538
1bb1b50d
GM
539## We always create the _default_ locallisppath directories, and
540## ensure that they contain a subdirs.el file (via write_subdir).
541## This is true even if locallisppath has a non-default value.
542## In case of non-default value, we used to create the specified directories,
543## but not add subdirs.el to them. This was a strange halfway house.
544## Nowadays we do not create non-default directories.
41a2ce39
GM
545
546## Note that we use tar instead of plain old cp -R/-r because the latter
547## is apparently not portable (even in 2012!).
548## http://lists.gnu.org/archive/html/emacs-devel/2012-05/msg00278.html
549## I have no idea which platforms Emacs supports where cp -R does not
550## work correctly, and therefore no idea when tar can be replaced.
567739fb
GM
551## See also these comments from 2004 about cp -r working fine:
552## http://lists.gnu.org/archive/html/autoconf-patches/2004-11/msg00005.html
cb6c95a3 553install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
067d23c9
KY
554 -set ${COPYDESTS} ; \
555 unset CDPATH; \
067d23c9
KY
556 $(set_installuser); \
557 for dir in ${COPYDIR} ; do \
7606c360 558 [ -d $${dir} ] || exit 1 ; \
48f73cfb 559 dest="$$1" ; shift ; \
357a5081
GM
560 if [ -d "$${dest}" ]; then \
561 exp_dest=`cd "$${dest}" && /bin/pwd`; \
562 [ "$$exp_dest" = "`cd $${dir} && /bin/pwd`" ] && continue ; \
563 else true; \
564 fi; \
cb6c95a3
GM
565 rm -rf "$${dest}" ; \
566 umask 022; ${MKDIR_P} "$${dest}" ; \
e39b9806
GM
567 echo "Copying $${dir} to $${dest}..." ; \
568 (cd $${dir}; tar -chf - . ) \
48f73cfb 569 | (cd "$${dest}"; umask 022; \
e39b9806 570 tar -xvf - && cat > /dev/null) || exit 1; \
4fa44856 571 if [ "$${dir}" = "${srcdir}/etc" ]; then \
48f73cfb
GM
572 rm -f "$${dest}/DOC"* ; \
573 rm -f "$${dest}/refcards"/*.aux "$${dest}/refcards"/*.dvi; \
574 rm -f "$${dest}/refcards"/*.log; \
4fa44856
GM
575 else true; \
576 fi; \
48f73cfb
GM
577 (cd "$${dest}" || exit 1; \
578 for subdir in `find . -type d -print` ; do \
579 chmod a+rx $${subdir} ; \
580 rm -f $${subdir}/.gitignore ; \
581 rm -f $${subdir}/.arch-inventory ; \
582 rm -f $${subdir}/.DS_Store ; \
583 rm -f $${subdir}/\#* ; \
584 rm -f $${subdir}/.\#* ; \
585 rm -f $${subdir}/*~ ; \
586 rm -f $${subdir}/*.orig ; \
587 rm -f $${subdir}/ChangeLog* ; \
588 [ "$${dir}" != "${srcdir}/etc" ] && \
589 rm -f $${subdir}/[mM]akefile*[.-]in $${subdir}/[mM]akefile ; \
590 done ); \
591 find "$${dest}" -exec chown $${installuser} {} ';' ;\
067d23c9 592 done
48f73cfb
GM
593 -rm -f "$(DESTDIR)${lispdir}/subdirs.el"
594 umask 022; $(srcdir)/build-aux/update-subdirs "$(DESTDIR)${lispdir}"
595 subdir="$(DESTDIR)${datadir}/emacs/${version}/site-lisp" ; \
9f1ea7dc 596 ${write_subdir}
48f73cfb 597 subdir="$(DESTDIR)${datadir}/emacs/site-lisp" ; \
9f1ea7dc 598 ${write_subdir} || true
89a97129
PE
599 [ -z "${GZIP_PROG}" ] || { \
600 echo "Compressing *.el ..." && \
96fbe2b9
PE
601 cd "$(DESTDIR)${lispdir}" && \
602 find . -name '*.elc' -exec $(SHELL) -c \
603 '${GZIP_PROG} -9n `expr "$$1" : "\\(.*\\)c"`' dummy '{}' ';'; \
89a97129 604 }
48f73cfb 605 -chmod -R a+r "$(DESTDIR)${datadir}/emacs/${version}" ${COPYDESTS}
660c8c1e 606
94898d72
GM
607## The above chmods are needed because "umask 022; tar ..." is not
608## guaranteed to do the right thing; eg if we are root and tar is
609## preserving source permissions.
42d5aa3e 610
bfed8334
GM
611## Note that install-arch-indep deletes and recreates the entire
612## installed etc/ directory, so we need it to run before this does.
8496d8d7 613install-etcdoc: src install-arch-indep
660c8c1e 614 -unset CDPATH; \
48f73cfb 615 umask 022; ${MKDIR_P} "$(DESTDIR)${etcdocdir}" ; \
357a5081
GM
616 exp_etcdocdir=`cd "$(DESTDIR)${etcdocdir}"; /bin/pwd`; \
617 if [ "`cd ./etc; /bin/pwd`" != "$$exp_etcdocdir" ]; \
067d23c9 618 then \
6e911150 619 docfile="DOC"; \
8496d8d7 620 echo "Copying etc/$${docfile} to $(DESTDIR)${etcdocdir} ..." ; \
48f73cfb 621 ${INSTALL_DATA} etc/$${docfile} "$(DESTDIR)${etcdocdir}/$${docfile}"; \
29473393 622 $(set_installuser); \
48f73cfb 623 chown $${installuser} "$(DESTDIR)${etcdocdir}/$${docfile}" || true ; \
067d23c9 624 else true; fi
660c8c1e 625
62bd73fa
GM
626## FIXME:
627## If info/dir is missing, but we have install-info, we should let
628## that handle it. If info/dir is present and we do not have install-info,
629## we should check for missing entries and add them by hand.
b55e11bf
GM
630##
631## FIXME:
632## If HAVE_MAKEINFO = no and there are no info files, do not install info/dir.
660c8c1e 633install-info: info
48f73cfb 634 umask 022; ${MKDIR_P} "$(DESTDIR)${infodir}"
067d23c9
KY
635 -unset CDPATH; \
636 thisdir=`/bin/pwd`; \
357a5081
GM
637 exp_infodir=`cd "$(DESTDIR)${infodir}" && /bin/pwd`; \
638 if [ "`cd ${srcdir}/info && /bin/pwd`" = "$$exp_infodir" ]; then \
b8e3b0a9
GM
639 true; \
640 else \
e035a207 641 [ -f "$(DESTDIR)${infodir}/dir" ] || \
b55e11bf 642 [ ! -f ${srcdir}/info/dir ] || \
e035a207 643 ${INSTALL_DATA} ${srcdir}/info/dir "$(DESTDIR)${infodir}/dir"; \
b8e3b0a9 644 info_misc=`cd doc/misc && $(QUIET_SUBMAKE) $(MAKE) -s echo-info`; \
067d23c9 645 cd ${srcdir}/info ; \
9aa071df 646 for elt in ${INFO_NONMISC} $${info_misc}; do \
4f8c52a9 647 test "$(HAVE_MAKEINFO)" = "no" && test ! -f $$elt && continue; \
067d23c9 648 for f in `ls $$elt $$elt-[1-9] $$elt-[1-9][0-9] 2>/dev/null`; do \
b8e3b0a9 649 (cd "$${thisdir}"; \
48f73cfb 650 ${INSTALL_DATA} ${srcdir}/info/$$f "$(DESTDIR)${infodir}/$$f"); \
335142f9 651 [ -n "${GZIP_PROG}" ] || continue ; \
48f73cfb
GM
652 rm -f "$(DESTDIR)${infodir}/$$f.gz"; \
653 ${GZIP_PROG} -9n "$(DESTDIR)${infodir}/$$f"; \
067d23c9 654 done; \
b8e3b0a9 655 (cd "$${thisdir}"; \
48f73cfb 656 ${INSTALL_INFO} --info-dir="$(DESTDIR)${infodir}" "$(DESTDIR)${infodir}/$$elt"); \
b8e3b0a9
GM
657 done; \
658 fi
660c8c1e 659
b3cdfd9e
GM
660## "gzip || true" is because some gzips exit with non-zero status
661## if compression would not reduce the file size. Eg, the gzip in
662## OpenBSD 4.9 seems to do this (2013/03). In Emacs, this can
663## only happen with the tiny ctags.1 manpage. We don't really care if
664## ctags.1 is compressed or not. "gzip -f" is another option here,
665## but not sure if portable.
660c8c1e 666install-man:
48f73cfb 667 umask 022; ${MKDIR_P} "$(DESTDIR)${man1dir}"
067d23c9
KY
668 thisdir=`/bin/pwd`; \
669 cd ${mansrcdir}; \
ab1121bd 670 for page in *.1; do \
a6c2cc07 671 dest=`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1; \
b8e3b0a9 672 (cd "$${thisdir}"; \
48f73cfb 673 ${INSTALL_DATA} ${mansrcdir}/$${page} "$(DESTDIR)${man1dir}/$${dest}"); \
335142f9 674 [ -n "${GZIP_PROG}" ] || continue ; \
48f73cfb
GM
675 rm -f "$(DESTDIR)${man1dir}/$${dest}.gz"; \
676 ${GZIP_PROG} -9n "$(DESTDIR)${man1dir}/$${dest}" || true; \
067d23c9
KY
677 done
678
679## Install those items from etc/ that need to end up elsewhere.
d036bcdf
GM
680
681## If you prefer, choose "emacs22" at installation time.
682## Note: emacs22 does not have all the resolutions.
683EMACS_ICON=emacs
684
d9a1e2c2 685install-etc:
48f73cfb 686 umask 022; ${MKDIR_P} "$(DESTDIR)${desktopdir}"
1a9c6830 687 tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \
59696ae0
GM
688 emacs_name=`echo emacs | sed '$(TRANSFORM)'`; \
689 sed -e "/^Exec=emacs/ s/emacs/$${emacs_name}/" \
690 -e "/^Icon=emacs/ s/emacs/$${emacs_name}/" \
1a9c6830 691 ${srcdir}/etc/emacs.desktop > $${tmp}; \
48f73cfb 692 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"; \
1a9c6830 693 rm -f $${tmp}
7606c360 694 thisdir=`/bin/pwd`; \
d9a1e2c2
GM
695 cd ${iconsrcdir} || exit 1; umask 022 ; \
696 for dir in */*/apps */*/mimetypes; do \
697 [ -d $${dir} ] || continue ; \
48f73cfb 698 ( cd "$${thisdir}"; ${MKDIR_P} "$(DESTDIR)${icondir}/$${dir}" ) ; \
d036bcdf 699 for icon in $${dir}/${EMACS_ICON}[.-]*; do \
d9a1e2c2 700 [ -r $${icon} ] || continue ; \
8bfcb8a6 701 ext=`echo "$${icon}" | sed -e 's|.*\.||'`; \
d036bcdf 702 dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\.$${ext}$$||" -e 's/$(EMACS_ICON)/emacs/' -e '$(TRANSFORM)'`.$${ext} ; \
b8e3b0a9 703 ( cd "$${thisdir}"; \
48f73cfb 704 ${INSTALL_DATA} ${iconsrcdir}/$${icon} "$(DESTDIR)${icondir}/$${dir}/$${dest}" ) \
7606c360 705 || exit 1; \
d9a1e2c2 706 done ; \
067d23c9
KY
707 done
708
067d23c9
KY
709### Build Emacs and install it, stripping binaries while installing them.
710install-strip:
f9d80c51 711 $(MAKE) INSTALL_STRIP=-s install
067d23c9 712
067d23c9
KY
713### Delete all the installed files that the `install' target would
714### create (but not the noninstalled files such as `make all' would create).
715###
716### Don't delete the lisp and etc directories if they're in the source tree.
8496d8d7 717uninstall: uninstall-$(NTDIR) uninstall-doc
f9d80c51 718 cd lib-src && $(MAKE) uninstall
067d23c9 719 -unset CDPATH; \
48f73cfb
GM
720 for dir in "$(DESTDIR)${lispdir}" "$(DESTDIR)${etcdir}" ; do \
721 if [ -d "$${dir}" ]; then \
722 case `cd "$${dir}" ; /bin/pwd` in \
b8e3b0a9 723 "`cd ${srcdir} ; /bin/pwd`"* ) ;; \
48f73cfb 724 * ) rm -rf "$${dir}" ;; \
067d23c9 725 esac ; \
48f73cfb
GM
726 case "$${dir}" in \
727 "$(DESTDIR)${datadir}/emacs/${version}"/* ) \
728 rm -rf "$(DESTDIR)${datadir}/emacs/${version}" \
067d23c9
KY
729 ;; \
730 esac ; \
731 fi ; \
732 done
48f73cfb 733 -rm -rf "$(DESTDIR)${libexecdir}/emacs/${version}"
a36e64d0 734 thisdir=`/bin/pwd`; \
4c9a1377 735 (info_misc=`cd doc/misc && $(QUIET_SUBMAKE) $(MAKE) -s echo-info`; \
48f73cfb 736 if cd "$(DESTDIR)${infodir}"; then \
25ca4587 737 for elt in ${INFO_NONMISC} $${info_misc}; do \
b8e3b0a9 738 (cd "$${thisdir}"; \
48f73cfb 739 $(INSTALL_INFO) --remove --info-dir="$(DESTDIR)${infodir}" "$(DESTDIR)${infodir}/$$elt"); \
335142f9 740 if [ -n "${GZIP_PROG}" ]; then \
25ca4587
GM
741 ext=.gz; else ext=; fi; \
742 rm -f $$elt$$ext $$elt-[1-9]$$ext $$elt-[1-9][0-9]$$ext; \
743 done; \
744 fi)
335142f9 745 (if [ -n "${GZIP_PROG}" ]; then \
7eb21b49 746 ext=.gz; else ext=; fi; \
25ca4587
GM
747 if cd ${mansrcdir}; then \
748 for page in *.1; do \
48f73cfb 749 rm -f "$(DESTDIR)${man1dir}"/`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1$$ext; done; \
25ca4587 750 fi)
48f73cfb
GM
751 (cd "$(DESTDIR)${bindir}" && rm -f $(EMACSFULL) $(EMACS) || true)
752 (if cd "$(DESTDIR)${icondir}"; then \
59696ae0
GM
753 rm -f hicolor/*x*/apps/${EMACS_NAME}.png \
754 hicolor/scalable/apps/${EMACS_NAME}.svg \
25ca4587
GM
755 hicolor/scalable/mimetypes/`echo emacs-document | sed '$(TRANSFORM)'`.svg; \
756 fi)
48f73cfb 757 -rm -f "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"
067d23c9 758 for file in snake-scores tetris-scores; do \
48f73cfb
GM
759 file="$(DESTDIR)${gamedir}/$${file}"; \
760 [ -s "$${file}" ] || rm -f "$$file"; \
067d23c9
KY
761 done
762
da53c452
EZ
763### Windows-specific uninstall target for removing programs produced
764### in nt/, and its Posix do-nothing shadow.
765uninstall-:
766uninstall-nt:
f9d80c51 767 cd $(NTDIR) && $(MAKE) uninstall
da53c452 768
067d23c9
KY
769# ==================== Cleaning up and miscellanea ====================
770
0aee6912 771.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean extraclean
067d23c9
KY
772
773### `mostlyclean'
774### Like `clean', but may refrain from deleting a few files that people
775### normally don't want to recompile. For example, the `mostlyclean'
776### target for GCC does not delete `libgcc.a', because recompiling it
777### is rarely necessary and takes a lot of time.
2ff06dac 778mostlyclean:
f9d80c51
GM
779 cd src && $(MAKE) mostlyclean
780 cd oldXMenu && $(MAKE) mostlyclean
781 cd lwlib && $(MAKE) mostlyclean
782 cd lib && $(MAKE) mostlyclean
783 cd lib-src && $(MAKE) mostlyclean
784 cd nt && $(MAKE) mostlyclean
785 -cd doc/emacs && $(MAKE) mostlyclean
786 -cd doc/misc && $(MAKE) mostlyclean
787 -cd doc/lispref && $(MAKE) mostlyclean
788 -cd doc/lispintro && $(MAKE) mostlyclean
067d23c9
KY
789
790### `clean'
791### Delete all files from the current directory that are normally
792### created by building the program. Don't delete the files that
793### record the configuration. Also preserve files that could be made
794### by building, but normally aren't because the distribution comes
795### with them.
796###
797### Delete `.dvi' files here if they are not part of the distribution.
2ff06dac 798clean:
1a9c6830 799 -rm -f etc/emacs.tmpdesktop
f9d80c51
GM
800 cd src && $(MAKE) clean
801 cd oldXMenu && $(MAKE) clean
802 cd lwlib && $(MAKE) clean
803 cd lib && $(MAKE) clean
804 cd lib-src && $(MAKE) clean
805 cd nt && $(MAKE) clean
806 -cd doc/emacs && $(MAKE) clean
807 -cd doc/misc && $(MAKE) clean
808 -cd doc/lispref && $(MAKE) clean
809 -cd doc/lispintro && $(MAKE) clean
810 cd nextstep && $(MAKE) clean
067d23c9
KY
811
812### `bootclean'
813### Delete all files that need to be remade for a clean bootstrap.
814top_bootclean=\
815 rm -f config.cache config.log
816### `distclean'
817### Delete all files from the current directory that are created by
818### configuring or building the program. If you have unpacked the
819### source and built the program without creating any other files,
820### `make distclean' should leave only the files that were in the
821### distribution.
822top_distclean=\
823 ${top_bootclean}; \
773233f8 824 rm -f config.status config.log~ Makefile stamp-h1 ${SUBDIR_MAKEFILES}
2ff06dac 825distclean:
f9d80c51
GM
826 cd src && $(MAKE) distclean
827 cd oldXMenu && $(MAKE) distclean
828 cd lwlib && $(MAKE) distclean
829 cd lib && $(MAKE) distclean
830 cd lib-src && $(MAKE) distclean
831 cd nt && $(MAKE) distclean
832 cd doc/emacs && $(MAKE) distclean
833 cd doc/misc && $(MAKE) distclean
834 cd doc/lispref && $(MAKE) distclean
835 cd doc/lispintro && $(MAKE) distclean
836 cd leim && $(MAKE) distclean
837 cd lisp && $(MAKE) distclean
838 cd nextstep && $(MAKE) distclean
f9b697dd 839 for dir in test/automated admin/grammars admin/unidata; do \
f9d80c51 840 [ ! -d $$dir ] || (cd $$dir && $(MAKE) distclean); \
55498a0f 841 done
067d23c9
KY
842 ${top_distclean}
843
844### `bootstrap-clean'
845### Delete everything that can be reconstructed by `make' and that
846### needs to be deleted in order to force a bootstrap from a clean state.
2ff06dac 847bootstrap-clean:
f9d80c51
GM
848 cd src && $(MAKE) bootstrap-clean
849 cd oldXMenu && $(MAKE) maintainer-clean
850 cd lwlib && $(MAKE) maintainer-clean
851 cd lib && $(MAKE) maintainer-clean
852 cd lib-src && $(MAKE) maintainer-clean
853 cd nt && $(MAKE) maintainer-clean
854 -cd doc/emacs && $(MAKE) maintainer-clean
855 -cd doc/misc && $(MAKE) maintainer-clean
856 -cd doc/lispref && $(MAKE) maintainer-clean
857 -cd doc/lispintro && $(MAKE) maintainer-clean
858 cd leim && $(MAKE) bootstrap-clean
859 cd lisp && $(MAKE) bootstrap-clean
860 cd nextstep && $(MAKE) maintainer-clean
f9b697dd 861 for dir in test/automated admin/grammars admin/unidata; do \
f9d80c51 862 [ ! -d $$dir ] || (cd $$dir && $(MAKE) bootstrap-clean); \
55498a0f 863 done
4f8c52a9 864 [ ! -f config.log ] || mv -f config.log config.log~
62bd73fa 865 rm -rf ${srcdir}/info
067d23c9
KY
866 ${top_bootclean}
867
868### `maintainer-clean'
869### Delete everything from the current directory that can be
870### reconstructed with this Makefile. This typically includes
871### everything deleted by distclean, plus more: C source files
872### produced by Bison, tags tables, info files, and so on.
873###
874### One exception, however: `make maintainer-clean' should not delete
875### `configure' even if `configure' can be remade using a rule in the
876### Makefile. More generally, `make maintainer-clean' should not delete
877### anything that needs to exist in order to run `configure' and then
878### begin to build the program.
9a514d4a
PE
879top_maintainer_clean=\
880 ${top_distclean}; \
e02ea74b 881 rm -fr autom4te.cache
2ff06dac 882maintainer-clean: bootstrap-clean
f9d80c51
GM
883 cd src && $(MAKE) maintainer-clean
884 cd leim && $(MAKE) maintainer-clean
885 cd lisp && $(MAKE) maintainer-clean
f9b697dd 886 for dir in test/automated admin/grammars admin/unidata; do \
f9d80c51 887 [ ! -d $$dir ] || (cd $$dir && $(MAKE) maintainer-clean); \
55498a0f 888 done
9a514d4a 889 ${top_maintainer_clean}
067d23c9
KY
890
891### This doesn't actually appear in the coding standards, but Karl
892### says GCC supports it, and that's where the configuration part of
893### the coding standards seem to come from. It's like distclean, but
894### it deletes backup and autosave files too.
895extraclean:
f9d80c51 896 for i in ${SUBDIR}; do (cd $$i; $(MAKE) extraclean); done
9a514d4a 897 ${top_maintainer_clean}
067d23c9
KY
898 -rm -f config-tmp-*
899 -rm -f *~ \#*
900
901# The src subdir knows how to do the right thing
902# even when the build directory and source dir are different.
0aee6912 903.PHONY: TAGS tags
9a514d4a 904TAGS tags: lib lib-src src
f9d80c51 905 cd src && $(MAKE) tags
067d23c9 906
67fb4e6a 907check: all
6c7e099d 908 @if test ! -d test/automated; then \
a22d9d2c
GM
909 echo "You do not seem to have the test/ directory."; \
910 echo "Maybe you are using a release tarfile, rather than a repository checkout."; \
911 else \
f9d80c51 912 cd test/automated && $(MAKE) check; \
a22d9d2c 913 fi
067d23c9
KY
914
915dist:
916 cd ${srcdir}; ./make-dist
917
b59a2e9e
PE
918DVIS = lispref-dvi lispintro-dvi emacs-dvi misc-dvi
919HTMLS = lispref-html lispintro-html emacs-html misc-html
920INFOS = lispref-info lispintro-info emacs-info misc-info
921PDFS = lispref-pdf lispintro-pdf emacs-pdf misc-pdf
8496d8d7 922PSS = lispref-ps lispintro-ps emacs-ps misc-ps
b59a2e9e
PE
923
924DOCS = $(DVIS) $(HTMLS) $(INFOS) $(PDFS) $(PSS)
925$(DOCS):
f9d80c51 926 t=$@; IFS=-; set $$t; IFS=; cd doc/$$1 && $(MAKE) $$2
b59a2e9e
PE
927
928.PHONY: $(DOCS) docs pdf ps
8ac457d5 929.PHONY: info dvi dist check html info-real info-dir check-info
067d23c9 930
8496d8d7 931## TODO add etc/refcards.
b59a2e9e
PE
932docs: $(DOCS)
933dvi: $(DVIS)
934html: $(HTMLS)
935info-real: $(INFOS)
936pdf: $(PDFS)
937ps: $(PSS)
067d23c9 938
62bd73fa
GM
939info-dir: ${srcdir}/info/dir
940
b55e11bf
GM
941## Not strictly necessary, but speeds things up a bit by stopping
942## the info-dir rule from running when not needed.
943## Hopefully doc/misc/*.texi is not too long for some systems?
944info_dir_deps = ${srcdir}/build-aux/dir_top \
945 ${srcdir}/doc/emacs/emacs.texi \
946 ${srcdir}/doc/lispintro/emacs-lisp-intro.texi \
947 ${srcdir}/doc/lispref/elisp.texi ${srcdir}/doc/misc/*.texi
948
62bd73fa
GM
949## It would be much simpler if info/dir was only created in the
950## installation location by the install-info rule, but we also
951## need one in the source directory for people running uninstalled.
b55e11bf
GM
952## FIXME it would be faster to use the install-info program if we have it,
953## but then we would need to depend on info-real, which would
954## slow down parallelization.
955${srcdir}/info/dir: ${info_dir_deps}
62bd73fa
GM
956 tempfile=info-dir.$$$$; \
957 rm -f $${tempfile}; \
958 thisdir=`pwd`; \
959 (cd ${srcdir} && ./build-aux/make-info-dir $${thisdir}/$${tempfile}); \
960 ${srcdir}/build-aux/move-if-change $${tempfile} ${srcdir}/info/dir
8496d8d7
GM
961
962INSTALL_DVI = install-emacs-dvi install-lispref-dvi \
963 install-lispintro-dvi install-misc-dvi
964INSTALL_HTML = install-emacs-html install-lispref-html \
965 install-lispintro-html install-misc-html
966INSTALL_PDF = install-emacs-pdf install-lispref-pdf \
967 install-lispintro-pdf install-misc-pdf
968INSTALL_PS = install-emacs-ps install-lispref-ps \
969 install-lispintro-ps install-misc-ps
970INSTALL_DOC = $(INSTALL_DVI) $(INSTALL_HTML) $(INSTALL_PDF) $(INSTALL_PS)
971
972## Install non .info forms of the documentation.
973## TODO add etc/refcards.
974$(INSTALL_DOC):
f9d80c51 975 t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $$1-$$3
8496d8d7
GM
976
977.PHONY: $(INSTALL_DOC) install-doc
978.PHONY: install-dvi install-html install-pdf install-ps
979
980install-doc: $(INSTALL_DOC)
981install-dvi: $(INSTALL_DVI)
982install-html: $(INSTALL_HTML)
983install-pdf: $(INSTALL_PDF)
984install-ps: $(INSTALL_PS)
985
986
987UNINSTALL_DVI = uninstall-emacs-dvi uninstall-lispref-dvi \
988 uninstall-lispintro-dvi uninstall-misc-dvi
989UNINSTALL_HTML = uninstall-emacs-html uninstall-lispref-html \
990 uninstall-lispintro-html uninstall-misc-html
991UNINSTALL_PDF = uninstall-emacs-pdf uninstall-lispref-pdf \
992 uninstall-lispintro-pdf uninstall-misc-pdf
993UNINSTALL_PS = uninstall-emacs-ps uninstall-lispref-ps \
994 uninstall-lispintro-ps uninstall-misc-ps
995UNINSTALL_DOC = $(UNINSTALL_DVI) $(UNINSTALL_HTML) $(UNINSTALL_PDF) $(UNINSTALL_PS)
996
997$(UNINSTALL_DOC):
f9d80c51 998 t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $$1-$$3
8496d8d7
GM
999
1000.PHONY: $(UNINSTALL_DOC) uninstall-doc
1001.PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps
1002
1003uninstall-doc: $(UNINSTALL_DOC)
1004uninstall-dvi: $(UNINSTALL_DVI)
1005uninstall-html: $(UNINSTALL_HTML)
1006uninstall-pdf: $(UNINSTALL_PDF)
1007uninstall-ps: $(UNINSTALL_PS)
1008
1009
067d23c9
KY
1010# Note that man/Makefile knows how to put the info files in $(srcdir),
1011# so we can do ok running make in the build dir.
1012# This used to have a clause that exited with an error if MAKEINFO = no.
1013# But it is inappropriate to do so without checking if makeinfo is
1014# actually needed - it is not if the info files are up-to-date. (Bug#3982)
1015# Only the doc/*/Makefiles can decide that, so we let those rules run
1016# and give a standard error if makeinfo is needed but missing.
1017# While it would be nice to give a more detailed error message, that
1018# would require changing every rule in doc/ that builds an info file,
1019# and it's not worth it. This case is only relevant if you download a
1020# release, then change the .texi files.
8ac457d5 1021info:
e5365138 1022 @if test "$(HAVE_MAKEINFO)" = "no"; then \
067d23c9
KY
1023 echo "Configured --without-makeinfo, not building manuals" ; \
1024 else \
f9d80c51 1025 $(MAKE) info-real info-dir; \
067d23c9
KY
1026 fi
1027
62bd73fa
GM
1028## build-aux/make-info-dir expects only certain dircategories.
1029check-info: info
067d23c9 1030 cd info ; \
62bd73fa 1031 bad= ; \
067d23c9
KY
1032 for file in *; do \
1033 test -f "$${file}" || continue ; \
1034 case $${file} in \
62bd73fa 1035 *-[0-9]*|COPYING|dir) continue ;; \
067d23c9 1036 esac ; \
62bd73fa
GM
1037 cat=`sed -n 's/^INFO-DIR-SECTION //p' $${file}`; \
1038 case $${cat} in \
b55e11bf 1039 "Texinfo documentation system" | "Emacs"| "Emacs lisp" | \
62bd73fa
GM
1040 "Emacs editing modes" | "Emacs network features" | \
1041 "Emacs misc features" | "Emacs lisp libraries" ) : ;; \
1042 *) bad="$${bad} $${file}" ;; \
1043 esac; \
067d23c9 1044 done ; \
62bd73fa
GM
1045 if test -n "$${bad}"; then \
1046 echo "Unexpected dircategory in: $${bad}" ; \
067d23c9
KY
1047 exit 1 ; \
1048 fi ; \
62bd73fa 1049 echo "info files are OK"
067d23c9 1050
067d23c9
KY
1051#### Bootstrapping.
1052
1053### This first cleans the lisp subdirectory, removing all compiled
1054### Lisp files. Then re-run make to build all the files anew.
1055
1056.PHONY: bootstrap
1057
b8b0239f 1058# Bootstrapping does the following:
bbe099e7 1059# * Remove files to start from a bootstrap-clean slate.
4dde498b 1060# * Run autogen.sh.
bbe099e7 1061# * Rebuild Makefile, to update the build procedure itself.
b8b0239f 1062# * Do the actual build.
2ff06dac 1063bootstrap: bootstrap-clean
4dde498b 1064 cd $(srcdir) && ./autogen.sh
f9d80c51
GM
1065 $(MAKE) MAKEFILE_NAME=force-Makefile force-Makefile
1066 $(MAKE) all
067d23c9
KY
1067
1068.PHONY: check-declare
1069
1070check-declare:
4f8c52a9 1071 @if [ ! -f $(srcdir)/src/emacs ]; then \
067d23c9
KY
1072 echo "You must build Emacs to use this command"; \
1073 exit 1; \
1074 fi
f9d80c51 1075 cd lisp && $(MAKE) $@