* doc/misc/tramp.texi (Frequently Asked Questions): Improve indices.
[emacs.git] / Makefile.in
blob30a762ed03b02e63ae223859bd6c1d93fb6c99af
1 ### @configure_input@
3 # Copyright (C) 1992-2024 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 <https://www.gnu.org/licenses/>.
20 ### Commentary:
22 # make all to compile and build Emacs.
23 # make install to install it.
24 # make TAGS to update tags tables.
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.
33 # Delete '.dvi' files here if they are not part of the distribution.
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.
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.
49 # make extraclean
50 # Still more severe - delete backup and autosave files, too.
52 # make bootstrap
53 # Removes all the compiled files to force a new bootstrap from a
54 # clean slate, and then build in the normal way. If the FAST Make
55 # variable is set, then the autom4te.cache directory and the
56 # config.cache file are not removed. This lets you say
58 # ./configure -C
59 # make FAST=true bootstrap
61 # and use the cached results from the configure run, which is much
62 # faster though it does not work in general.
64 # make docs
65 # Make Emacs documentation files from their sources; requires makeinfo.
67 # make check (or check-expensive or check-all)
68 # Run the Emacs test suite.
69 # check-expensive includes additional tests that can be slow.
70 # check-all runs all tests, including ones that can be slow, or
71 # fail unpredictably
73 SHELL = @SHELL@
75 DUMPING=@DUMPING@
77 # This only matters when inheriting a CDPATH not starting with the
78 # current directory.
79 CDPATH=
81 # ==================== Things 'configure' Might Edit ====================
83 cache_file = @cache_file@
84 CONFIGURE_FLAGS = --cache-file=$(cache_file)
86 AWK = @AWK@
88 EXEEXT=@EXEEXT@
90 ### These help us choose version- and architecture-specific directories
91 ### to install files in.
93 ### This should be the number of the Emacs version we're building,
94 ### like '24.5' or '25.0.50'.
95 version=@version@
97 ### This should be the name of the configuration we're building Emacs
98 ### for, like 'x86_64-unknown-linux-gnu' or 'powerpc-ibm-aix7.1.2.0'.
99 configuration=@configuration@
101 ### The nt/ subdirectory gets built only for MinGW
102 NTDIR=@NTDIR@
104 top_builddir = @top_builddir@
105 -include ${top_builddir}/src/verbose.mk
107 FIND_DELETE = @FIND_DELETE@
109 USE_STARTUP_NOTIFICATION = @USE_STARTUP_NOTIFICATION@
111 HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@
112 HAVE_BE_APP = @HAVE_BE_APP@
113 HAVE_PGTK = @HAVE_PGTK@
114 HAVE_GSETTINGS = @HAVE_GSETTINGS@
116 ANDROID = @ANDROID@
118 # ==================== Where To Install Things ====================
120 # Location to install Emacs.app under GNUstep / macOS.
121 # Later values may use these.
122 ns_appdir=@ns_appdir@
123 ns_appbindir=@ns_appbindir@
124 ns_applibexecdir=@ns_applibexecdir@
125 ns_appresdir=@ns_appresdir@
126 ns_applibdir=@ns_applibdir@
127 # Either yes or no depending on whether this is a relocatable Emacs.app.
128 ns_self_contained=@ns_self_contained@
130 # The default location for installation. Everything is placed in
131 # subdirectories of this directory. The default values for many of
132 # the variables below are expressed in terms of this one, so you may
133 # not need to change them. This defaults to /usr/local.
134 prefix=@prefix@
136 # Like 'prefix', but used for architecture-specific files.
137 exec_prefix=@exec_prefix@
139 # Where to install Emacs and other binaries that people will want to
140 # run directly (like etags).
141 bindir=@bindir@
143 # The root of the directory tree for read-only architecture-independent
144 # data files. ${datadir}, ${infodir} and ${mandir} are based on this.
145 datarootdir=@datarootdir@
147 # Where to install architecture-independent data files. ${lispdir}
148 # and ${etcdir} are subdirectories of this.
149 datadir=@datadir@
151 # Where to install and expect the files that Emacs modifies as it
152 # runs. These files are all architecture-independent.
153 # Right now, this is not used.
154 sharedstatedir=@sharedstatedir@
156 # Where to install and expect executable files to be run by Emacs
157 # rather than directly by users (and other architecture-dependent
158 # data, although Emacs does not have any). The executables
159 # are actually installed in ${archlibdir}, which is (normally)
160 # a subdirectory of this.
161 libexecdir=@libexecdir@
163 # Currently only used for the systemd service file.
164 libdir=@libdir@
166 # Where to install emacs-module.h.
167 includedir=@includedir@
169 # Where to install Emacs's man pages.
170 # Note they contain cross-references that expect them to be in section 1.
171 mandir=@mandir@
172 man1dir=$(mandir)/man1
174 # Where to install and expect the info files describing Emacs.
175 infodir=@infodir@
176 # Info files not in the doc/misc directory (we get those via make echo-info).
177 INFO_NONMISC=emacs.info eintr.info elisp.info
179 # Directory for local state files for all programs.
180 localstatedir=@localstatedir@
182 # Where to look for bitmap files.
183 bitmapdir=@bitmapdir@
185 # Where to find the source code. The source code for Emacs's C kernel is
186 # expected to be in ${srcdir}/src, and the source code for Emacs's
187 # utility programs is expected to be in ${srcdir}/lib-src. This is
188 # set by the configure script's '--srcdir' option.
190 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
191 srcdir=@srcdir@
192 abs_srcdir=@abs_srcdir@
194 # Where the manpage source files are kept.
195 mansrcdir=$(srcdir)/doc/man
197 # Tell make where to find source files; this is needed for the makefiles.
198 VPATH=@srcdir@
200 # Where to find the application default.
201 x_default_search_path=@x_default_search_path@
203 # Where the etc/emacs.desktop file is to be installed.
204 desktopdir=$(datarootdir)/applications
206 # Where the etc/emacs.metainfo.xml file is to be installed.
207 metainfodir=$(datarootdir)/metainfo
209 # Where the etc/emacs.service file is to be installed.
210 # The system value (typically /usr/lib/systemd/user) can be
211 # obtained with: pkg-config --variable=systemduserunitdir systemd
212 # but that does not respect configure's prefix.
213 # It is not clear where we should install this file when
214 # prefix != /usr (or /usr/local?) (eg for non-root installs).
215 # Other options include ~/.config/systemd/user/,
216 # $XDG_RUNTIME_DIR/systemd/user/
217 # It seems the user may end up having to make a manual link...
218 systemdunitdir=$(libdir)/systemd/user
220 # Where the etc/images/icons/hicolor directory is to be installed.
221 icondir=$(datarootdir)/icons
223 # The source directory for the icon files.
224 iconsrcdir=$(srcdir)/etc/images/icons
226 # Where to install the gsettings schema file.
227 gsettingsschemadir = $(datadir)/glib-2.0/schemas
229 # ==================== Emacs-specific directories ====================
231 # These variables hold the values Emacs will actually use. They are
232 # based on the values of the standard Make variables above.
234 # Where lisp files are installed in a distributed with Emacs (relative
235 # path to the installation directory).
236 lispdirrel=@lispdirrel@
238 # Where to install the lisp files distributed with Emacs.
239 # This includes the Emacs version, so that the lisp files for different
240 # versions of Emacs will install themselves in separate directories.
241 lispdir=@lispdir@
243 # Directories Emacs should search for standard lisp files.
244 # The default is ${lispdir}.
245 standardlisppath=@standardlisppath@
247 # Directories Emacs should search for lisp files specific to this
248 # site (i.e. customizations), before consulting ${standardlisppath}.
249 # This should be a colon-separated list of directories.
250 locallisppath=@locallisppath@
252 # Where Emacs will search to find its lisp files. Before
253 # changing this, check to see if your purpose wouldn't
254 # better be served by changing locallisppath. This
255 # should be a colon-separated list of directories.
256 # The default is ${locallisppath}:${standardlisppath}.
257 lisppath=@lisppath@
259 # Where Emacs will search for its lisp files while building.
260 # This is only used during the process of compiling Emacs,
261 # to help Emacs find its lisp files before they've been installed
262 # in their final location.
263 # This should be a colon-separated list of directories.
264 # Normally it points to the lisp/ directory in the sources.
265 # NB lread.c relies on lisp/ being first here.
266 buildlisppath=${abs_srcdir}/lisp
268 # Where to install the other architecture-independent
269 # data files distributed with Emacs (like the tutorial,
270 # the cookie recipes and the Zippy database). This path
271 # usually contains the Emacs version number, so the data
272 # files for multiple versions of Emacs may be installed
273 # at once.
274 etcdir=@etcdir@
276 # Where to put executables to be run by Emacs rather than
277 # the user. This path usually includes the Emacs version
278 # and configuration name, so that multiple configurations
279 # for multiple versions of Emacs may be installed at
280 # once.
281 archlibdir=@archlibdir@
283 # Where to put the etc/DOC file.
284 etcdocdir=@etcdocdir@
286 # User or group of the auxiliary program update-game-score, which is
287 # installed on platforms with a game directory shared by multiple users.
288 # On other platforms Emacs can update the score files itself.
289 gameuser=@gameuser@
290 gamegroup=@gamegroup@
291 # Where to install game score files, if gameuser or gamegroup is nonempty.
292 gamedir=@gamedir@
293 # Nonempty if and only if a shared gamedir is used.
294 use_gamedir=$(gameuser)$(gamegroup)
296 # ==================== Utility Programs for the Build ====================
298 # Allow the user to specify the install program.
299 # Note that if the system does not provide a suitable install,
300 # configure will use build-aux/install-sh. Annoyingly, it does
301 # not use an absolute path. So we must take care to always run
302 # INSTALL-type commands from the directory containing the Makefile.
303 # This explains (I think) the cd thisdir seen in several install rules.
304 SYSTEM_TYPE = @SYSTEM_TYPE@
305 INSTALL = @INSTALL@
306 INSTALL_PROGRAM = @INSTALL_PROGRAM@
307 INSTALL_DATA = @INSTALL_DATA@
308 INSTALL_INFO = @INSTALL_INFO@
309 ifeq ($(SYSTEM_TYPE),cygwin)
310 INSTALL_ELN = $(INSTALL)
311 else
312 INSTALL_ELN = $(INSTALL_DATA)
313 endif
314 # By default, we uphold the dignity of our programs.
315 INSTALL_STRIP =
316 MKDIR_P = @MKDIR_P@
317 # Create a link to a file in the same directory as the target.
318 LN_S_FILEONLY = @LN_S_FILEONLY@
320 # We use gzip to compress installed .el and some .txt files.
321 GZIP_PROG = @GZIP_PROG@
323 GLIB_COMPILE_SCHEMAS = glib-compile-schemas
325 # ============================= Targets ==============================
327 # Program name transformation.
328 TRANSFORM = @program_transform_name@
330 # Prevent any settings in the user environment causing problems.
331 unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH
333 # What emacs should be called when installed.
334 EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
335 EMACS = ${EMACS_NAME}${EXEEXT}
336 EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT}
337 EMACS_PDMP = `./src/emacs${EXEEXT} --fingerprint`.pdmp
339 # Subdirectories to make recursively.
340 SUBDIR = $(NTDIR) lib lib-src src lisp
342 ifeq ($(ANDROID),yes)
343 SUBDIR := $(SUBDIR) java
344 endif
346 # The subdir makefiles created by config.status.
347 SUBDIR_MAKEFILES_IN = @SUBDIR_MAKEFILES_IN@
348 SUBDIR_MAKEFILES = $(patsubst ${srcdir}/%,%,${SUBDIR_MAKEFILES_IN:.in=})
350 # Non-makefile files created by config.status.
351 CONFIG_STATUS_FILES_IN = \
352 ${srcdir}/nt/emacs.rc.in ${srcdir}/nt/emacsclient.rc.in \
353 ${srcdir}/doc/man/emacs.1.in ${srcdir}/src/emacs-module.h.in \
354 ${srcdir}/src/module-env-*.h
356 # Subdirectories to install, and where they'll go. lib-src's and nt's
357 # makefiles know how to install them, so we don't do that here.
358 # Directories that cannot simply be copied, eg info, are treated
359 # separately.
360 COPYDIR = ${srcdir}/etc ${srcdir}/lisp
361 COPYDESTS = "$(DESTDIR)${etcdir}" "$(DESTDIR)${lispdir}"
363 ifeq (${ns_self_contained},no)
364 BIN_DESTDIR = $(DESTDIR)${bindir}/
365 ELN_DESTDIR = $(DESTDIR)${libdir}/emacs/${version}/
366 else
367 BIN_DESTDIR = ${ns_appbindir}/
368 ELN_DESTDIR = ${ns_applibdir}/
369 endif
371 gsettings_SCHEMAS = etc/org.gnu.emacs.defaults.gschema.xml
373 all:
374 $(MAKE) actual-all || $(MAKE) advice-on-failure make-target=all exit-status=$$?
375 $(MAKE) sanity-check make-target=all
377 # This target is used by the 'bootstrap' target in GNUmakefile, instead of 'all'.
378 bootstrap-all:
379 $(MAKE) actual-all || $(MAKE) advice-on-failure make-target=bootstrap exit-status=$$?
380 $(MAKE) sanity-check make-target=bootstrap
382 .PHONY: bootstrap-all actual-all advice-on-failure sanity-check
384 actual-all: ${SUBDIR} info $(gsettings_SCHEMAS:.xml=.valid) src-depending-on-lisp blessmail
386 # ADVICE-ON-FAILURE-BEGIN:all
387 # You could try to:
388 # - run "make bootstrap", which might fix the problem
389 # - run "make V=1", which displays the full commands invoked by make,
390 # to further investigate the problem
391 # ADVICE-ON-FAILURE-END:all
393 # ADVICE-ON-FAILURE-BEGIN:bootstrap
394 # You could try to:
395 # - run "make extraclean" and run "make" again (or, equivalently, run
396 # "make bootstrap configure=default"), to rebuild Emacs with the
397 # default configuration options, which might fix the problem
398 # - run "git clean -fdx" and run "make bootstrap" again, which might
399 # fix the problem if "make bootstrap configure=default" did not
400 # !BEWARE! "git clean -fdx" deletes all files that are not under
401 # !BEWARE! version control, which means that all changes to such
402 # !BEWARE! files will be lost and cannot be restored later
403 # - run "make V=1", which displays the full commands invoked by make,
404 # to further investigate the problem
405 # - report the problem and ask for help by sending an email to
406 # bug-gnu-emacs@gnu.org, mentioning at least the build error
407 # message, the platform, and the repository revision displayed by
408 # "git rev-parse HEAD"
409 # ADVICE-ON-FAILURE-END:bootstrap
411 advice-on-failure:
412 @[ -f .no-advice-on-failure ] && exit ${exit-status}; true
413 @echo >&2 '***'
414 @echo >&2 '*** '"\"make ${make-target}\" failed with exit status ${exit-status}."
415 @echo >&2 '***'
416 @cat Makefile | \
417 sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# ADVICE-ON-FAILURE-END:${make-target}/q;};' | \
418 sed 's/^# /*** /' | grep -v '^\*\*\* ADVICE-ON-FAILURE-' >&2
419 @echo >&2 '***'
420 @exit ${exit-status}
422 sanity-check:
423 @[ -f .no-advice-on-failure ] && exit 0; true
424 @v=`src/emacs${EXEEXT} --batch -Q --eval \
425 '(progn (defun f (n) (if (= 0 n) 1 (* n (f (- n 1))))) (princ (f 10)))' \
426 2> /dev/null`; \
427 [ "X$$v" = "X3628800" ] && exit 0; \
428 echo >&2 '***'; \
429 echo >&2 '*** '"\"make ${make-target}\" succeeded, but Emacs is not functional."; \
430 echo >&2 '***'; \
431 cat Makefile | \
432 sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# ADVICE-ON-FAILURE-END:${make-target}/q;};' | \
433 sed 's/^# /*** /' | grep -v '^\*\*\* ADVICE-ON-FAILURE-' >&2; \
434 echo >&2 '***'; \
435 exit 1
437 .PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 epaths-force-ns-self-contained etc-emacsver
439 # Changes in lisp may require us to reconsider the build in src. For
440 # example, if loaddefs.{el,elc} were built in lisp, we need a new
441 # .pdmp containing the new autoloads.
442 .PHONY: src-depending-on-lisp
443 src-depending-on-lisp: lisp
444 ${MAKE} -C src BIN_DESTDIR='$(BIN_DESTDIR)' ELN_DESTDIR='$(ELN_DESTDIR)'
446 # If configure were to just generate emacsver.tex from emacsver.tex.in
447 # in the normal way, the timestamp of emacsver.tex would always be
448 # newer than that of the pdf files, which are prebuilt in release tarfiles.
449 # So we use this rule, and move-if-change, to avoid that.
450 etc-emacsver:
451 majorversion=`echo ${version} | sed 's/\..*//'`; \
452 sed "s/[@]majorversion@/$${majorversion}/" \
453 ${srcdir}/etc/refcards/emacsver.tex.in > emacsver.tex.$$$$ && \
454 ${srcdir}/build-aux/move-if-change emacsver.tex.$$$$ \
455 ${srcdir}/etc/refcards/emacsver.tex
457 # The shared gamedir name as a C string literal, or a null ptr if not in use.
458 PATH_GAME = $(if $(use_gamedir),"$(gamedir)",((char const *) 0))
460 # Generate epaths.h from epaths.in. This target is invoked by 'configure'.
461 # See comments in configure.ac for why it is done this way, as opposed
462 # to just letting configure generate epaths.h from epaths.in in a
463 # similar way to how Makefile is made from Makefile.in.
464 epaths-force:
465 @for dir in '$(abs_srcdir)' '$(lispdir)' '$(archlibdir)'; do \
466 case $$dir in \
467 *:*) \
468 printf >&2 "Build or installation directory '%s'\\n" "$$dir"; \
469 echo >&2 "cannot contain ':'."; \
470 exit 1;; \
471 esac; \
472 done
473 @(gamedir='${gamedir}'; \
474 sed < ${srcdir}/src/epaths.in > epaths.h.$$$$ \
475 -e 's;\(#define.*PATH_LOADSEARCH\).*$$;\1 "${standardlisppath}";' \
476 -e 's;\(#define.*PATH_REL_LOADSEARCH\).*$$;\1 "${lispdirrel}";' \
477 -e 's;\(#define.*PATH_SITELOADSEARCH\).*$$;\1 "${locallisppath}";' \
478 -e 's;\(#define.*PATH_DUMPLOADSEARCH\).*$$;\1 "${buildlisppath}";' \
479 -e '/^#define PATH_[^ ]*SEARCH /s/\([":]\):*/\1/g' \
480 -e '/^#define PATH_[^ ]*SEARCH /s/:"/"/' \
481 -e 's;\(#define.*PATH_EXEC\).*$$;\1 "${archlibdir}";' \
482 -e 's;\(#define.*PATH_INFO\).*$$;\1 "${infodir}";' \
483 -e 's;\(#define.*PATH_DATA\).*$$;\1 "${etcdir}";' \
484 -e 's;\(#define.*PATH_BITMAPS\).*$$;\1 "${bitmapdir}";' \
485 -e 's;\(#define.*PATH_X_DEFAULTS\).*$$;\1 "${x_default_search_path}";' \
486 -e 's;\(#define.*PATH_GAME\).*$$;\1 $(PATH_GAME);' \
487 -e 's;\(#define.*PATH_DOC\).*$$;\1 "${etcdocdir}";') && \
488 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
490 # The w32 build needs a slightly different editing, and it uses
491 # nt/epaths.nt as the template.
493 # Use the value of ${locallisppath} supplied by 'configure',
494 # to support the --enable-locallisppath argument.
496 # In this case, the paths written to 'src/epaths.h' must be in native
497 # MS-Windows format (e.g. 'c:/foo/bar'), because temacs is a MinGW
498 # program that doesn't support MSYS-style paths (e.g. '/c/foo/bar' or
499 # '/foo/bar').
500 epaths-force-w32:
501 @(w32srcdir=`${srcdir}/build-aux/msys-to-w32 "${abs_srcdir}"`; \
502 w32prefix=`${srcdir}/build-aux/msys-to-w32 "${prefix}"`; \
503 w32locallisppath=`${srcdir}/build-aux/msys-to-w32 "${locallisppath}"` ; \
504 w32locallisppath=$${w32locallisppath//$${w32prefix}/"%emacs_dir%"} ; \
505 sed < ${srcdir}/nt/epaths.nt > epaths.h.$$$$ \
506 -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${w32locallisppath//;/\\;}"'";' \
507 -e 's;\(#.*PATH_REL_LOADSEARCH\).*$$;\1 "${lispdirrel}";' \
508 -e '/^.*#/s/@VER@/${version}/g' \
509 -e '/^.*#/s/@CFG@/${configuration}/g' \
510 -e "/^.*#/s|@SRC@|$${w32srcdir}|g") && \
511 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
513 # A NextStep style app bundle is relocatable, so instead of
514 # hard-coding paths try to generate them at run-time.
516 # The paths are mostly the same, and the bundle paths are different
517 # between macOS and GNUstep, so just replace any references to the app
518 # bundle root itself with the relative path.
519 epaths-force-ns-self-contained: epaths-force
520 @(sed < src/epaths.h > epaths.h.$$$$ \
521 -e 's;${ns_appdir}/;;') && \
522 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
524 ifneq ($(NTDIR),)
525 $(NTDIR): lib
526 endif
528 lib-src src: $(NTDIR) lib
530 src: lib-src
532 # We need to build 'emacs' in 'src' to compile the *.elc files in 'lisp'.
533 lisp: src
535 # These targets should be "${SUBDIR} without 'src'".
536 lib lib-src lisp nt: Makefile
537 $(MAKE) -C $@ all
539 java: lisp info
540 $(MAKE) -C $@ all
542 cross: src
543 $(MAKE) -C $@ all
545 trampolines: src lisp
546 ifeq ($(HAVE_NATIVE_COMP),yes)
547 $(MAKE) -C lisp trampolines
548 endif
550 # Pass an unexpanded $srcdir to src's Makefile, which then
551 # expands it using its own value of srcdir (which points to the
552 # source directory of src/).
553 src: Makefile
554 $(MAKE) -C $@ BIN_DESTDIR='$(BIN_DESTDIR)' \
555 ELN_DESTDIR='$(ELN_DESTDIR)' all
557 blessmail: Makefile src
558 $(MAKE) -C lib-src maybe-blessmail
560 # We used to have one rule per */Makefile.in, but that leads to race
561 # conditions with parallel makes, so assume that the timestamp on
562 # ./Makefile represents the timestamp on all the other Makefiles.
563 # Similarly, assume the timestamp on ./configure represents the
564 # timestamp on src/config.in.
566 # config.status overrides MAKEFILE_NAME with a bogus name when creating
567 # src/epaths.h, so that 'make epaths-force' does not recursively invoke
568 # config.status and overwrite config.status while executing it (Bug#11214).
570 # 'make bootstrap' overrides MAKEFILE_NAME to a nonexistent file but
571 # then attempts to build that file. This forces 'Makefile', 'lib/Makefile',
572 # etc. to be built without running into similar recursion problems.
573 MAKEFILE_NAME = Makefile
574 $(MAKEFILE_NAME): config.status $(srcdir)/configure \
575 $(srcdir)/lib/gnulib.mk.in \
576 $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN) $(CONFIG_STATUS_FILES_IN)
577 MAKE='$(MAKE)' ./config.status
579 # Don't erase these files if make is interrupted while refreshing them.
580 .PRECIOUS: Makefile config.status
582 # Note that calling config.status --recheck is insufficient on Android
583 # due to the recursive calls to configure.
585 config.status: ${srcdir}/configure
586 if [ -x ./config.status ]; then \
587 $(CFG) ./config.status --recheck; \
588 else \
589 $(CFG) $(srcdir)/configure $(CONFIGURE_FLAGS); \
592 $(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/m4/*.m4
593 cd $(srcdir) && ./autogen.sh autoconf
595 # ==================== Installation ====================
597 .PHONY: install install-arch-dep install-arch-indep install-etcdoc install-info
598 .PHONY: install-man install-etc install-strip install-$(NTDIR) install-eln
599 .PHONY: uninstall uninstall-$(NTDIR)
601 ## If we let lib-src do its own installation, that means we
602 ## don't have to duplicate the list of utilities to install in
603 ## this Makefile as well.
605 install: actual-all install-arch-indep install-etcdoc install-arch-dep install-$(NTDIR) install-eln install-gsettings-schemas
606 @true
608 ## Ensure that $subdir contains a subdirs.el file.
609 ## Here and elsewhere, we set the umask so that any created files are
610 ## world-readable.
611 ## TODO it might be good to warn about non-standard permissions of
612 ## pre-existing directories, but that does not seem easy.
613 write_subdir=if [ -f "$${subdir}/subdirs.el" ]; \
614 then true; \
615 else \
616 umask 022; \
617 ${MKDIR_P} "$${subdir}"; \
618 (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
619 echo " (normal-top-level-add-subdirs-to-load-path))") \
620 > "$${subdir}/subdirs.el"; \
623 ### Install the executables that were compiled specifically for this machine.
624 ### We do install-arch-indep first because the executable needs the
625 ### Lisp files and DOC file to work properly.
626 install-arch-dep: src install-arch-indep install-etcdoc install-$(NTDIR)
627 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
628 $(MAKE) -C lib-src install
629 ifeq (${ns_self_contained},no)
630 ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} "$(DESTDIR)${bindir}/$(EMACSFULL)"
631 ifeq (${HAVE_BE_APP},yes)
632 ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/Emacs "$(DESTDIR)${prefix}/apps/Emacs"
633 endif
634 ifeq (${DUMPING},pdumper)
635 ifeq (${HAVE_BE_APP},yes)
636 ${INSTALL_DATA} src/Emacs.pdmp "$(DESTDIR)${libexecdir}/emacs/${version}/${configuration}"/Emacs.pdmp
637 endif
638 ${INSTALL_DATA} src/emacs.pdmp "$(DESTDIR)${libexecdir}/emacs/${version}/${configuration}"/emacs-${EMACS_PDMP}
639 endif
640 -chmod 755 "$(DESTDIR)${bindir}/$(EMACSFULL)"
641 ifndef NO_BIN_LINK
642 rm -f "$(DESTDIR)${bindir}/$(EMACS)"
643 cd "$(DESTDIR)${bindir}" && $(LN_S_FILEONLY) "$(EMACSFULL)" "$(EMACS)"
644 endif
645 else
646 ${INSTALL_DATA} src/emacs.pdmp "$(DESTDIR)${libexecdir}/Emacs.pdmp"
647 subdir=${ns_appresdir}/site-lisp && ${write_subdir}
648 rm -rf ${ns_appresdir}/share
649 endif
651 ### Windows-specific install target for installing programs produced
652 ### in nt/, and its Posix do-nothing shadow.
653 install-:
654 install-nt:
655 $(MAKE) -C $(NTDIR) install
657 ## In the share directory, we are deleting:
658 ## applications (with emacs.desktop, also found in etc/)
659 ## emacs (basically empty except for unneeded site-lisp directories)
660 ## icons (duplicates etc/images/icons/hicolor)
662 ## This is install-etc for everything except self-contained-ns builds.
663 ## For them, it is empty.
664 INSTALL_ARCH_INDEP_EXTRA = @INSTALL_ARCH_INDEP_EXTRA@
666 ## https://lists.gnu.org/r/emacs-devel/2007-10/msg01672.html
667 ## Needs to be the user running install, so configure can't set it.
668 set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \
669 `(id -u) 2> /dev/null`; do \
670 [ -n "$${installuser}" ] && break ; \
671 done; \
672 installgroup=`(id -g) 2>/dev/null` && [ -n "$$installgroup" ] && \
673 installuser=$$installuser:$$installgroup
675 ### Install the files that are machine-independent.
676 ### Most of them come straight from the distribution; the exception is
677 ### the DOC file, which is copied from the build directory.
679 ## We delete each directory in ${COPYDESTS} before we copy into it;
680 ## that way, we can reinstall over directories that have been put in
681 ## place with their files read-only (perhaps because they are checked
682 ## into RCS). In order to make this safe, we make sure that the
683 ## source exists and is distinct from the destination.
685 ## We delete etc/DOC* because there may be irrelevant DOC files from
686 ## other builds in the source directory. This is ok because we just
687 ## deleted the entire installed etc/ directory and recreated it.
688 ## install-etcdoc installs the relevant DOC.
690 ## Note that we install etc/refcards/*.ps if present.
691 ## TODO we should compress these if GZIP_PROG is set.
692 ## It would be simpler to have a separate install rule for etc/refcards
693 ## (maybe move it to doc/refcards?).
695 ## Note that the Makefiles in the etc directory are potentially useful
696 ## in an installed Emacs, so should not be excluded.
698 ## We always create the _default_ locallisppath directories, and
699 ## ensure that they contain a subdirs.el file (via write_subdir).
700 ## This is true even if locallisppath has a non-default value.
701 ## In case of non-default value, we used to create the specified directories,
702 ## but not add subdirs.el to them. This was a strange halfway house.
703 ## Nowadays we do not create non-default directories.
705 ## Note that we use tar instead of plain old cp -R/-r because the latter
706 ## is apparently not portable (even in 2012!).
707 ## https://lists.gnu.org/r/emacs-devel/2012-05/msg00278.html
708 ## I have no idea which platforms Emacs supports where cp -R does not
709 ## work correctly, and therefore no idea when tar can be replaced.
710 ## See also these comments from 2004 about cp -r working fine:
711 ## https://lists.gnu.org/r/autoconf-patches/2004-11/msg00005.html
712 install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
713 umask 022 && $(MKDIR_P) "$(DESTDIR)$(includedir)"
714 $(INSTALL_DATA) src/emacs-module.h "$(DESTDIR)$(includedir)/emacs-module.h"
715 -set ${COPYDESTS} ; \
716 unset CDPATH; \
717 $(set_installuser); \
718 for dir in ${COPYDIR} ; do \
719 [ -d $${dir} ] || exit 1 ; \
720 dest="$$1" ; shift ; \
721 if [ -d "$${dest}" ]; then \
722 exp_dest=`cd "$${dest}" && pwd -P`; \
723 [ "$$exp_dest" = "`cd $${dir} && pwd -P`" ] && continue ; \
724 else true; \
725 fi; \
726 rm -rf "$${dest}" ; \
727 umask 022; ${MKDIR_P} "$${dest}" ; \
728 printf 'Copying %s to %s...\n' "$$dir" "$$dest" ; \
729 (cd $${dir}; tar -chf - . ) \
730 | (cd "$${dest}"; umask 022; \
731 tar -xvf - && cat > /dev/null) || exit 1; \
732 if [ "$${dir}" = "${srcdir}/etc" ]; then \
733 rm -f "$${dest}/DOC"* ; \
734 rm -f "$${dest}/refcards"/*.aux "$${dest}/refcards"/*.dvi; \
735 rm -f "$${dest}/refcards"/*.log "$${dest}/refcards"/*.in; \
736 else true; \
737 fi; \
738 (cd "$${dest}" || exit 1; \
739 for subdir in `find . -type d -print` ; do \
740 chmod a+rx $${subdir} ; \
741 rm -f $${subdir}/.gitignore ; \
742 rm -f $${subdir}/.arch-inventory ; \
743 rm -f $${subdir}/.DS_Store ; \
744 rm -f $${subdir}/#* ; \
745 rm -f $${subdir}/.#* ; \
746 rm -f $${subdir}/*~ ; \
747 rm -f $${subdir}/*.orig ; \
748 rm -f $${subdir}/ChangeLog* ; \
749 [ "$${dir}" != "${srcdir}/etc" ] && \
750 rm -f $${subdir}/[mM]akefile*[.-]in $${subdir}/[mM]akefile ; \
751 done ); \
752 find "$${dest}" -exec chown $${installuser} {} ';' ;\
753 done
754 -rm -f "$(DESTDIR)${lispdir}/subdirs.el"
755 umask 022; $(srcdir)/build-aux/update-subdirs "$(DESTDIR)${lispdir}"
756 subdir="$(DESTDIR)${datadir}/emacs/${version}/site-lisp" ; \
757 ${write_subdir}
758 subdir="$(DESTDIR)${datadir}/emacs/site-lisp" ; \
759 ${write_subdir} || true
760 [ -z "${GZIP_PROG}" ] || { \
761 echo "Compressing *.el etc. ..." && \
762 cd "$(DESTDIR)${lispdir}" && \
763 for f in `find . -name "*.elc" -print | sed 's/.elc$$/.el/'`; do \
764 ${GZIP_PROG} -9n "$$f"; \
765 done; \
766 ${GZIP_PROG} -9n "../etc/publicsuffix.txt"; \
768 -chmod -R a+r "$(DESTDIR)${datadir}/emacs/${version}" ${COPYDESTS}
770 ## The above chmods are needed because "umask 022; tar ..." is not
771 ## guaranteed to do the right thing; eg if we are root and tar is
772 ## preserving source permissions.
774 ## Note that install-arch-indep deletes and recreates the entire
775 ## installed etc/ directory, so we need it to run before this does.
776 install-etcdoc: src install-arch-indep
777 -unset CDPATH; \
778 umask 022; ${MKDIR_P} "$(DESTDIR)${etcdocdir}" ; \
779 exp_etcdocdir=`cd "$(DESTDIR)${etcdocdir}"; pwd -P`; \
780 if [ "`cd ./etc; pwd -P`" != "$$exp_etcdocdir" ]; \
781 then \
782 docfile="DOC"; \
783 printf 'Copying %s to %s ...\n' "etc/$$docfile" \
784 "$(DESTDIR)${etcdocdir}"; \
785 ${INSTALL_DATA} etc/$${docfile} "$(DESTDIR)${etcdocdir}/$${docfile}"; \
786 else true; fi
788 ## FIXME:
789 ## If info/dir is missing, but we have install-info, we should let
790 ## that handle it. If info/dir is present and we do not have install-info,
791 ## we should check for missing entries and add them by hand.
792 install-info: info
793 umask 022; ${MKDIR_P} "$(DESTDIR)${infodir}"
794 -unset CDPATH; \
795 thisdir=`pwd -P`; \
796 exp_infodir=`cd "$(DESTDIR)${infodir}" && pwd -P`; \
797 if [ "`cd ${srcdir}/info && pwd -P`" = "$$exp_infodir" ]; then \
798 true; \
799 else \
800 [ -f "$(DESTDIR)${infodir}/dir" ] || \
801 [ ! -f ${srcdir}/info/dir ] || \
802 ${INSTALL_DATA} ${srcdir}/info/dir "$(DESTDIR)${infodir}/dir"; \
803 info_misc=`MAKEFLAGS= $(MAKE) --no-print-directory -s -C doc/misc echo-info`; \
804 cd ${srcdir}/info ; \
805 for elt in ${INFO_NONMISC} $${info_misc}; do \
806 for f in `ls $$elt $$elt-[1-9] $$elt-[1-9][0-9] 2>/dev/null`; do \
807 (cd "$${thisdir}"; \
808 ${INSTALL_DATA} ${srcdir}/info/$$f "$(DESTDIR)${infodir}/$$f"); \
809 [ -n "${GZIP_PROG}" ] || continue ; \
810 rm -f "$(DESTDIR)${infodir}/$$f.gz"; \
811 ${GZIP_PROG} -9n "$(DESTDIR)${infodir}/$$f"; \
812 done; \
813 (cd "$${thisdir}"; \
814 ${INSTALL_INFO} --info-dir="$(DESTDIR)${infodir}" "$(DESTDIR)${infodir}/$$elt"); \
815 cp elisp_type_hierarchy* $(DESTDIR)${infodir}/; \
816 done; \
819 ## "gzip || true" is because some gzips exit with non-zero status
820 ## if compression would not reduce the file size. Eg, the gzip in
821 ## OpenBSD 4.9 seems to do this (2013/03). In Emacs, this can
822 ## only happen with the tiny ctags.1 manpage. We don't really care if
823 ## ctags.1 is compressed or not. "gzip -f" is another option here,
824 ## but not sure if portable.
825 install-man:
826 umask 022; ${MKDIR_P} "$(DESTDIR)${man1dir}"
827 thisdir=`pwd -P`; \
828 cd ${mansrcdir}; \
829 for page in *.1; do \
830 test "$$page" = ChangeLog.1 && continue; \
831 dest=`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1; \
832 (cd "$${thisdir}"; \
833 ${INSTALL_DATA} ${mansrcdir}/$${page} "$(DESTDIR)${man1dir}/$${dest}"); \
834 [ -n "${GZIP_PROG}" ] || continue ; \
835 rm -f "$(DESTDIR)${man1dir}/$${dest}.gz"; \
836 ${GZIP_PROG} -9n "$(DESTDIR)${man1dir}/$${dest}" || true; \
837 done
839 ## Install those items from etc/ that need to end up elsewhere.
841 ## If you prefer, choose "emacs22" at installation time.
842 ## Note: emacs22 does not have all the resolutions.
843 EMACS_ICON=emacs
845 ifeq (${USE_STARTUP_NOTIFICATION},no)
846 USE_STARTUP_NOTIFICATION_SED_CMD=-e "/^StartupNotify=true$$/d"
847 endif
848 ifeq ($(HAVE_PGTK),yes)
849 USE_WAYLAND_DISPLAY_SED_CMD=-e "s/display=[^ ]*/reuse-frame/"
850 endif
851 install-etc:
852 umask 022; ${MKDIR_P} "$(DESTDIR)${desktopdir}"
853 tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \
854 sed -e "/^Exec=emacs/ s/emacs/${EMACS_NAME}/" \
855 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
856 $(USE_STARTUP_NOTIFICATION_SED_CMD) \
857 ${srcdir}/etc/emacs.desktop > $${tmp}; \
858 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"; \
859 rm -f $${tmp}
860 tmp=etc/emacsclient.tmpdesktop; rm -f $${tmp}; \
861 client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
862 sed -e "/^Exec=/ s|emacsclient|${bindir}/$${client_name}|" \
863 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
864 $(USE_STARTUP_NOTIFICATION_SED_CMD) \
865 $(USE_WAYLAND_DISPLAY_SED_CMD) \
866 ${srcdir}/etc/emacsclient.desktop > $${tmp}; \
867 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}.desktop"; \
868 rm -f $${tmp}
869 tmp=etc/emacs-mail.tmpdesktop; rm -f $${tmp}; \
870 sed -e "/^Exec=emacs/ s/emacs/${EMACS_NAME}/" \
871 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
872 ${srcdir}/etc/emacs-mail.desktop > $${tmp}; \
873 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}-mail.desktop"; \
874 rm -f $${tmp}
875 tmp=etc/emacsclient-mail.tmpdesktop; rm -f $${tmp}; \
876 client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
877 sed -e "/^Exec=/ s|emacsclient|${bindir}/$${client_name}|" \
878 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
879 $(USE_WAYLAND_DISPLAY_SED_CMD) \
880 ${srcdir}/etc/emacsclient-mail.desktop > $${tmp}; \
881 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}-mail.desktop"; \
882 rm -f $${tmp}
883 umask 022; ${MKDIR_P} "$(DESTDIR)${metainfodir}"
884 tmp=etc/emacs.tmpmetainfo; rm -f $${tmp}; \
885 sed -e "s/emacs\.desktop/${EMACS_NAME}.desktop/" \
886 ${srcdir}/etc/emacs.metainfo.xml > $${tmp}; \
887 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"; \
888 rm -f $${tmp}
889 umask 022; $(MKDIR_P) "$(DESTDIR)$(systemdunitdir)"
890 tmp=etc/emacs.tmpservice; rm -f $${tmp}; \
891 client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
892 sed -e '/^##/d' \
893 -e "/^Documentation/ s/emacs(1)/${EMACS_NAME}(1)/" \
894 -e "/^ExecStart/ s|emacs|${bindir}/${EMACS}|" \
895 -e "/^ExecStop/ s|emacsclient|${bindir}/$${client_name}|" \
896 ${srcdir}/etc/emacs.service > $${tmp}; \
897 $(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"; \
898 rm -f $${tmp}
899 thisdir=`pwd -P`; \
900 cd ${iconsrcdir} || exit 1; umask 022 ; \
901 for dir in */*/apps */*/mimetypes; do \
902 [ -d $${dir} ] || continue ; \
903 ( cd "$${thisdir}"; ${MKDIR_P} "$(DESTDIR)${icondir}/$${dir}" ) ; \
904 for icon in $${dir}/${EMACS_ICON}[.-]*; do \
905 [ -r $${icon} ] || continue ; \
906 ext=`echo "$${icon}" | sed -e 's|.*\.||'`; \
907 dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\\.$${ext}\$$||" -e 's/$(EMACS_ICON)/emacs/' -e '$(TRANSFORM)'`.$${ext} ; \
908 ( cd "$${thisdir}"; \
909 ${INSTALL_DATA} ${iconsrcdir}/$${icon} "$(DESTDIR)${icondir}/$${dir}/$${dest}" ) \
910 || exit 1; \
911 done ; \
912 done
914 ### Install native compiled Lisp files.
915 install-eln: lisp
916 ifeq ($(HAVE_NATIVE_COMP),yes)
917 umask 022 ; \
918 find native-lisp -exec sh -c \
919 'for f in "$$@"; do \
920 if test -d "$$f"; then \
921 $(MKDIR_P) '\''$(ELN_DESTDIR)'\''"$$f" || exit; \
922 else \
923 $(INSTALL_ELN) "$$f" '\''$(ELN_DESTDIR)'\''"$$f"; \
924 fi || exit; \
925 done' - {} +
926 endif
928 ### Build Emacs and install it, stripping binaries while installing them.
929 install-strip:
930 $(MAKE) INSTALL_STRIP=-s install
932 ### Delete all the installed files that the 'install' target would
933 ### create (but not the noninstalled files such as 'make all' would create).
935 ### Don't delete the lisp and etc directories if they're in the source tree.
936 uninstall: uninstall-$(NTDIR) uninstall-doc uninstall-gsettings-schemas
937 rm -f "$(DESTDIR)$(includedir)/emacs-module.h"
938 $(MAKE) -C lib-src uninstall
939 -unset CDPATH; \
940 for dir in "$(DESTDIR)${lispdir}" "$(DESTDIR)${etcdir}" '$(ELN_DESTDIR)' ; do \
941 if [ -d "$${dir}" ]; then \
942 case `cd "$${dir}" ; pwd -P` in \
943 "`cd ${srcdir} ; pwd -P`"* ) ;; \
944 * ) rm -rf "$${dir}" ;; \
945 esac ; \
946 case "$${dir}" in \
947 "$(DESTDIR)${datadir}/emacs/${version}"/* ) \
948 rm -rf "$(DESTDIR)${datadir}/emacs/${version}" \
949 ;; \
950 esac ; \
951 fi ; \
952 done
953 -rm -rf "$(DESTDIR)${libexecdir}/emacs/${version}"
954 thisdir=`pwd -P`; \
955 (info_misc=`MAKEFLAGS= $(MAKE) --no-print-directory -s -C doc/misc echo-info`; \
956 if cd "$(DESTDIR)${infodir}"; then \
957 for elt in ${INFO_NONMISC} $${info_misc}; do \
958 (cd "$${thisdir}"; \
959 $(INSTALL_INFO) --remove --info-dir="$(DESTDIR)${infodir}" "$(DESTDIR)${infodir}/$$elt"); \
960 if [ -n "${GZIP_PROG}" ]; then \
961 ext=.gz; else ext=; fi; \
962 rm -f $$elt$$ext $$elt-[1-9]$$ext $$elt-[1-9][0-9]$$ext; \
963 done; \
964 rm -f elisp_type_hierarchy.jpg elisp_type_hierarchy.txt; \
966 (if [ -n "${GZIP_PROG}" ]; then \
967 ext=.gz; else ext=; fi; \
968 if cd ${mansrcdir}; then \
969 for page in *.1; do \
970 rm -f "$(DESTDIR)${man1dir}"/`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1$$ext; done; \
972 rm -f "$(DESTDIR)${bindir}/$(EMACS)" "$(DESTDIR)${bindir}/$(EMACSFULL)"
973 (if cd "$(DESTDIR)${icondir}"; then \
974 rm -f hicolor/*x*/apps/"${EMACS_NAME}.png" \
975 "hicolor/scalable/apps/${EMACS_NAME}.svg" \
976 "hicolor/scalable/apps/${EMACS_NAME}.ico" \
977 "hicolor/scalable/mimetypes/${EMACS_NAME}-document.svg" \
978 "hicolor/scalable/mimetypes/${EMACS_NAME}-document23.svg"; \
980 -rm -f "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"
981 -rm -f "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"
982 -rm -f "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"
983 ifneq (,$(use_gamedir))
984 for file in snake-scores tetris-scores; do \
985 file="$(DESTDIR)${gamedir}/$${file}"; \
986 [ -s "$${file}" ] || rm -f "$$file"; \
987 done
988 endif
990 ### Windows-specific uninstall target for removing programs produced
991 ### in nt/, and its Posix do-nothing shadow.
992 uninstall-:
993 uninstall-nt:
994 $(MAKE) -C $(NTDIR) uninstall
996 # ==================== Cleaning up and miscellanea ====================
998 .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean extraclean
1000 ## Eg:
1001 ## src_clean:
1002 ## make -C src clean
1003 define submake_template
1004 .PHONY: $(1)_$(2)
1005 $(1)_$(2):
1006 $$(MAKE) -C $(1) $(2)
1007 endef
1009 ### 'mostlyclean'
1010 ### Like 'clean', but may refrain from deleting a few files that people
1011 ### normally don't want to recompile. For example, the 'mostlyclean'
1012 ### target for GCC does not delete 'libgcc.a', because recompiling it
1013 ### is rarely necessary and takes a lot of time.
1014 mostlyclean_dirs = src oldXMenu lwlib lib lib-src nt doc/emacs doc/misc \
1015 doc/lispref doc/lispintro test
1017 ### Add the libexec directory to mostlyclean_dirs if its Makefile has
1018 ### been created.
1019 ifneq ($(wildcard exec/Makefile),)
1020 mostlyclean_dirs := $(mostlyclean_dirs) exec
1021 endif
1023 $(foreach dir,$(mostlyclean_dirs),$(eval $(call submake_template,$(dir),mostlyclean)))
1025 mostlyclean: $(mostlyclean_dirs:=_mostlyclean)
1027 ### 'clean'
1028 ### Delete all files from the current directory that are normally
1029 ### created by building the program. Don't delete the files that
1030 ### record the configuration. Also preserve files that could be made
1031 ### by building, but normally aren't because the distribution comes
1032 ### with them.
1034 ### Delete '.dvi' files here if they are not part of the distribution.
1035 clean_dirs = $(mostlyclean_dirs) java cross nextstep admin/charsets \
1036 admin/unidata
1038 $(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean)))
1040 clean: $(clean_dirs:=_clean) clean-gsettings-schemas
1041 -rm -f ./*.tmp etc/*.tmp*
1042 -rm -rf info-dir.*
1043 -rm -rf native-lisp
1045 ### 'bootclean'
1046 ### Delete all files that need to be remade for a clean bootstrap.
1047 top_bootclean=\
1048 rm -f config.log ${srcdir}/doc/man/emacs.1
1050 ### 'distclean'
1051 ### Delete all files from the current directory that are created by
1052 ### configuring or building the program. If you have unpacked the
1053 ### source and built the program without creating any other files,
1054 ### 'make distclean' should leave only the files that were in the
1055 ### distribution.
1056 top_distclean=\
1057 ${top_bootclean}; \
1058 rm -f config.cache config.status config.log~ \
1059 Makefile makefile lib/gnulib.mk ${SUBDIR_MAKEFILES}
1061 distclean_dirs = $(clean_dirs) leim lisp admin/grammars
1063 $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean)))
1065 distclean: $(distclean_dirs:=_distclean) clean-gsettings-schemas
1066 ${top_distclean}
1067 ifeq ($(HAVE_NATIVE_COMP),yes)
1068 rm -rf native-lisp
1069 endif
1071 ### 'bootstrap-clean'
1072 ### Delete everything that can be reconstructed by 'make' and that
1073 ### needs to be deleted in order to force a bootstrap from a clean state.
1074 $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),bootstrap-clean)))
1076 bootstrap-clean: $(distclean_dirs:=_bootstrap-clean)
1077 [ ! -f config.log ] || mv -f config.log config.log~
1078 rm -rf ${srcdir}/info
1079 rm -f ${srcdir}/etc/refcards/emacsver.tex
1080 rm -rf native-lisp/ lisp/leim/ja-dic/
1081 ifndef FAST
1082 rm -fr autom4te.cache config.cache
1083 endif
1084 ${top_bootclean}
1086 ### 'maintainer-clean'
1087 ### Delete everything from the current directory that can be
1088 ### reconstructed with this Makefile. This typically includes
1089 ### everything deleted by distclean, plus more: C source files
1090 ### produced by Bison, tags tables, info files, and so on.
1092 ### One exception, however: 'make maintainer-clean' should not delete
1093 ### 'configure' even if 'configure' can be remade using a rule in the
1094 ### Makefile. More generally, 'make maintainer-clean' should not delete
1095 ### anything that needs to exist in order to run 'configure' and then
1096 ### begin to build the program.
1097 top_maintainer_clean=\
1098 ${top_distclean}; \
1099 rm -fr ${srcdir}/autom4te.cache
1101 $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),maintainer-clean)))
1103 maintainer-clean: $(distclean_dirs:=_maintainer-clean)
1104 rm -rf ${srcdir}/info
1105 rm -f ${srcdir}/etc/refcards/emacsver.tex
1106 ${top_maintainer_clean}
1108 ### This doesn't actually appear in the coding standards, but Karl
1109 ### says GCC supports it, and that's where the configuration part of
1110 ### the coding standards seem to come from. It's like distclean, but
1111 ### it deletes backup and autosave files too.
1112 extraclean: maintainer-clean
1113 -rm -f config-tmp-* ${srcdir}/aclocal.m4 ${srcdir}/configure \
1114 ${srcdir}/src/config.in
1115 -[ "${srcdir}" = "." ] || \
1116 find ${srcdir} '(' -name '*~' -o -name '#*' ')' ${FIND_DELETE}
1117 -find . '(' -name '*~' -o -name '#*' ')' ${FIND_DELETE}
1118 -rm -f ${srcdir}/exec/config-tmp-* ${srcdir}/exec/aclocal.m4 \
1119 ${srcdir}/src/config.in ${srcdir}/exec/configure
1121 # The src subdir knows how to do the right thing
1122 # even when the build directory and source dir are different.
1123 .PHONY: TAGS tags
1124 # FIXME: We used to include `src` in the dependencies, not sure why.
1125 # I removed it because it causes `make tags` to build Emacs.
1126 TAGS tags: lib lib-src # src
1127 $(MAKE) -C src tags
1128 $(MAKE) -C doc/emacs tags
1129 $(MAKE) -C doc/lispintro tags
1130 $(MAKE) -C doc/lispref tags
1131 $(MAKE) -C doc/misc tags
1133 CHECK_TARGETS = check check-maybe check-expensive check-all check-byte-compile
1134 .PHONY: $(CHECK_TARGETS)
1135 $(CHECK_TARGETS): all
1136 $(MAKE) -C test $@
1138 test/%:
1139 $(MAKE) -C test $*
1142 dist:
1143 cd ${srcdir}; ./make-dist
1145 DVIS = lispref-dvi lispintro-dvi emacs-dvi misc-dvi
1146 HTMLS = lispref-html lispintro-html emacs-html misc-html
1147 INFOS = lispref-info lispintro-info emacs-info misc-info
1148 PDFS = lispref-pdf lispintro-pdf emacs-pdf misc-pdf
1149 PSS = lispref-ps lispintro-ps emacs-ps misc-ps
1151 DOCS = $(DVIS) $(HTMLS) $(INFOS) $(PDFS) $(PSS)
1152 $(DOCS):
1153 $(MAKE) -C doc/$(subst -, ,$@)
1155 .PHONY: $(DOCS) docs pdf ps
1156 .PHONY: info dvi dist html info-dir check-info
1158 ## TODO add etc/refcards.
1159 docs: $(DOCS)
1160 dvi: $(DVIS)
1161 html: $(HTMLS)
1162 info: $(INFOS) info-dir
1163 pdf: $(PDFS)
1164 ps: $(PSS)
1166 # This dependency is due to those doc/misc/ manuals that use .org sources.
1167 # Depending on src is sufficient, but ends up being slow, since the
1168 # uncompiled lisp/org/*.el files are used to build the .texi files
1169 # (which can be slow even with the elc files).
1170 misc-info: lisp
1171 # Using src rather than lisp because one is less likely to get unnecessary
1172 # rebuilds of stuff that is not strictly necessary for generating manuals.
1173 misc-dvi misc-html misc-pdf misc-ps: src
1175 info-dir: ${srcdir}/info/dir
1177 texi_misc = $(shell MAKEFLAGS= ${MAKE} --no-print-directory -s -C doc/misc echo-sources)
1179 srcdir_doc_info_dir_inputs = \
1180 ${srcdir}/doc/emacs/emacs.texi \
1181 ${srcdir}/doc/lispintro/emacs-lisp-intro.texi \
1182 ${srcdir}/doc/lispref/elisp.texi \
1183 $(addprefix ${srcdir}/doc/misc/,${texi_misc})
1184 info_dir_inputs = \
1185 ../build-aux/dir_top \
1186 $(subst ${srcdir}/doc/,,${srcdir_doc_info_dir_inputs})
1187 info_dir_deps = \
1188 ${srcdir}/build-aux/make-info-dir \
1189 ${srcdir}/build-aux/dir_top \
1190 ${srcdir_doc_info_dir_inputs}
1192 ## It would be much simpler if info/dir was only created in the
1193 ## installation location by the install-info rule, but we also
1194 ## need one in the source directory for people running uninstalled.
1195 ## FIXME it would be faster to use the install-info program if we have it,
1196 ## but then we would need to depend on ${INFOS}, which would
1197 ## slow down parallelization.
1198 ${srcdir}/info/dir: ${info_dir_deps}
1199 $(AM_V_GEN)${MKDIR_P} ${srcdir}/info
1200 $(AM_V_at)(cd ${srcdir}/doc && \
1201 AWK='${AWK}' ../build-aux/make-info-dir ${info_dir_inputs} \
1202 ) >$@.tmp && mv $@.tmp $@
1204 INSTALL_DVI = install-emacs-dvi install-lispref-dvi \
1205 install-lispintro-dvi install-misc-dvi
1206 INSTALL_HTML = install-emacs-html install-lispref-html \
1207 install-lispintro-html install-misc-html
1208 INSTALL_PDF = install-emacs-pdf install-lispref-pdf \
1209 install-lispintro-pdf install-misc-pdf
1210 INSTALL_PS = install-emacs-ps install-lispref-ps \
1211 install-lispintro-ps install-misc-ps
1212 INSTALL_DOC = $(INSTALL_DVI) $(INSTALL_HTML) $(INSTALL_PDF) $(INSTALL_PS)
1214 ## Install non .info forms of the documentation.
1215 ## TODO add etc/refcards.
1216 $(INSTALL_DOC):
1217 $(MAKE) -C doc/$(subst -, install-,$(subst install-,,$@))
1219 .PHONY: $(INSTALL_DOC) install-doc
1220 .PHONY: install-dvi install-html install-pdf install-ps
1222 install-doc: $(INSTALL_DOC)
1223 install-dvi: $(INSTALL_DVI)
1224 install-html: $(INSTALL_HTML)
1225 install-pdf: $(INSTALL_PDF)
1226 install-ps: $(INSTALL_PS)
1229 UNINSTALL_DVI = uninstall-emacs-dvi uninstall-lispref-dvi \
1230 uninstall-lispintro-dvi uninstall-misc-dvi
1231 UNINSTALL_HTML = uninstall-emacs-html uninstall-lispref-html \
1232 uninstall-lispintro-html uninstall-misc-html
1233 UNINSTALL_PDF = uninstall-emacs-pdf uninstall-lispref-pdf \
1234 uninstall-lispintro-pdf uninstall-misc-pdf
1235 UNINSTALL_PS = uninstall-emacs-ps uninstall-lispref-ps \
1236 uninstall-lispintro-ps uninstall-misc-ps
1237 UNINSTALL_DOC = $(UNINSTALL_DVI) $(UNINSTALL_HTML) $(UNINSTALL_PDF) $(UNINSTALL_PS)
1239 $(UNINSTALL_DOC):
1240 $(MAKE) -C doc/$(subst -, uninstall-,$(subst uninstall-,,$@))
1242 .PHONY: $(UNINSTALL_DOC) uninstall-doc
1243 .PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps
1245 uninstall-doc: $(UNINSTALL_DOC)
1246 uninstall-dvi: $(UNINSTALL_DVI)
1247 uninstall-html: $(UNINSTALL_HTML)
1248 uninstall-pdf: $(UNINSTALL_PDF)
1249 uninstall-ps: $(UNINSTALL_PS)
1251 ## build-aux/make-info-dir expects only certain dircategories.
1252 check-info: info
1253 cd info ; \
1254 bad= ; \
1255 for file in *; do \
1256 test -f "$${file}" || continue ; \
1257 case $${file} in \
1258 *-[0-9]*|COPYING|dir) continue ;; \
1259 esac ; \
1260 cat=`sed -n 's/^INFO-DIR-SECTION //p' $${file}`; \
1261 case $${cat} in \
1262 "Texinfo documentation system" | "Emacs"| "Emacs lisp" | \
1263 "Emacs editing modes" | "Emacs network features" | \
1264 "Emacs misc features" | "Emacs lisp libraries" ) : ;; \
1265 *) bad="$${bad} $${file}" ;; \
1266 esac; \
1267 done ; \
1268 if test -n "$${bad}"; then \
1269 echo "Unexpected dircategory in: $${bad}" ; \
1270 exit 1 ; \
1271 fi ; \
1272 echo "info files are OK"
1274 #### Bootstrapping.
1276 ### This first cleans the lisp subdirectory, removing all compiled
1277 ### Lisp files. Then re-run make to build all the files anew.
1279 .PHONY: bootstrap actual-bootstrap
1281 bootstrap:
1282 $(MAKE) actual-bootstrap || $(MAKE) advice-on-failure make-target=bootstrap exit-status=$$?
1283 $(MAKE) sanity-check make-target=bootstrap
1285 # Without a 'configure' variable, bootstrapping does the following:
1286 # * Remove files to start from a bootstrap-clean slate.
1287 # * Run autogen.sh.
1288 # * Rebuild Makefile, to update the build procedure itself.
1289 # * Do the actual build.
1290 # With a 'configure' variable, bootstrapping does the following:
1291 # * Remove files to start from an extraclean slate.
1292 # * Do the actual build, during which the 'configure' variable is
1293 # used (see the Makefile goal in GNUmakefile).
1294 actual-bootstrap:
1295 ifndef configure
1296 $(MAKE) bootstrap-clean
1297 cd $(srcdir) && ./autogen.sh autoconf
1298 $(MAKE) MAKEFILE_NAME=force-Makefile force-Makefile
1299 else
1300 $(MAKE) extraclean
1301 endif
1302 $(MAKE) actual-all
1304 .PHONY: ChangeLog change-history change-history-commit change-history-nocommit
1305 .PHONY: preferred-branch-is-current unchanged-history-files
1307 CHANGELOG = ChangeLog
1308 emacslog = build-aux/gitlog-to-emacslog
1309 # The ChangeLog history files are called ChangeLog.1, ChangeLog.2, ...,
1310 # ChangeLog.$(CHANGELOG_HISTORY_INDEX_MAX). $(CHANGELOG_N) stands for
1311 # the newest (highest-numbered) ChangeLog history file.
1312 CHANGELOG_HISTORY_INDEX_MAX = 4
1313 CHANGELOG_N = ChangeLog.$(CHANGELOG_HISTORY_INDEX_MAX)
1315 # Convert git commit log to ChangeLog file. make-dist uses this.
1316 # I guess this is PHONY so it always updates?
1317 ChangeLog:
1318 $(AM_V_GEN)cd $(srcdir) && \
1319 ./$(emacslog) -o $(CHANGELOG) -n $(CHANGELOG_HISTORY_INDEX_MAX)
1321 # Check that we are in a good state for changing history.
1322 PREFERRED_BRANCH = emacs-30
1323 preferred-branch-is-current:
1324 git branch | grep -q '^\* $(PREFERRED_BRANCH)$$'
1325 unchanged-history-files:
1326 x=`git diff-files --name-only $(CHANGELOG_N) $(emacslog)` && \
1327 test -z "$$x"
1329 # Regular expression that matches the newest commit covered by a ChangeLog.
1330 new_commit_regexp = ^commit [0123456789abcdef]* (inclusive)
1332 # Copy newer commit messages to the start of the ChangeLog history file,
1333 # and consider them to be older.
1334 change-history-nocommit: preferred-branch-is-current unchanged-history-files
1335 -rm -f ChangeLog.tmp
1336 $(MAKE) ChangeLog CHANGELOG=ChangeLog.tmp
1337 sed '/^This file records repository revisions/,$$d' \
1338 ChangeLog.tmp >$(CHANGELOG_N).tmp
1339 new_commit_line=`grep '$(new_commit_regexp)' ChangeLog.tmp` && \
1340 sed 's/$(new_commit_regexp).*/'"$$new_commit_line/" \
1341 $(CHANGELOG_N) >>$(CHANGELOG_N).tmp
1342 rm ChangeLog.tmp
1343 mv $(CHANGELOG_N).tmp $(CHANGELOG_N)
1345 change-history: change-history-nocommit
1346 $(MAKE) $@-commit
1348 # If 'make change-history' fails because the newest ChangeLog history
1349 # file contains invalid text, fix the file by hand and then run
1350 # 'make change-history-commit'.
1351 change-history-commit:
1352 git commit -m'; make $@' $(CHANGELOG_N) $(emacslog)
1354 .PHONY: check-declare
1356 check-declare:
1357 @if [ ! -f $(srcdir)/src/emacs ]; then \
1358 echo "You must build Emacs to use this command"; \
1359 exit 1; \
1361 $(MAKE) -C lisp $@
1362 $(MAKE) -C test $@
1364 .PHONY: gitmerge
1366 GITMERGE_EMACS = ./src/emacs${EXEEXT}
1367 GITMERGE_NMIN = 10
1369 gitmerge:
1370 ${GITMERGE_EMACS} -batch --no-site-file --no-site-lisp \
1371 -l ${srcdir}/admin/gitmerge.el \
1372 --eval '(setq gitmerge-minimum-missing ${GITMERGE_NMIN})' -f gitmerge
1374 install-gsettings-schemas:
1375 ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
1376 $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"
1377 $(INSTALL_DATA) $(srcdir)/$(gsettings_SCHEMAS) "$(DESTDIR)$(gsettingsschemadir)"
1378 if [ -z "$(DESTDIR)" ]; then $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); fi
1379 endif
1381 uninstall-gsettings-schemas:
1382 ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
1383 for x in $(gsettings_SCHEMAS); do \
1384 xx=`echo $$x | sed -e 's|.*/||'`; \
1385 rm -f "$(DESTDIR)$(gsettingsschemadir)/$${xx}"; \
1386 done
1387 if [ -z "$(DESTDIR)" ]; then $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); fi
1388 endif
1390 clean-gsettings-schemas:
1391 ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
1392 rm -f $(gsettings_SCHEMAS:.xml=.valid)
1393 endif
1395 $(gsettings_SCHEMAS:.xml=.valid): $(srcdir)/$(gsettings_SCHEMAS)
1396 ifeq ($(HAVE_PGTK)$(HAVE_GSETTINGS),yesyes)
1397 $(GLIB_COMPILE_SCHEMAS) --strict --dry-run --schema-file=$(srcdir)/$(gsettings_SCHEMAS)
1398 $(MKDIR_P) $(@D)
1399 touch $@
1400 endif