; Commit files changed by "autoreconf -i -I m4 --force"
[emacs.git] / Makefile.in
blob7beb5480a4c9a0fee1e56285a708ab1397b974f0
1 ### @configure_input@
3 # Copyright (C) 1992-2022 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.
56 # make docs
57 # Make Emacs documentation files from their sources; requires makeinfo.
59 # make check (or check-expensive or check-all)
60 # Run the Emacs test suite.
61 # check-expensive includes additional tests that can be slow.
62 # check-all runs all tests, including ones that can be slow, or
63 # fail unpredictably
65 SHELL = @SHELL@
67 DUMPING=@DUMPING@
69 # This only matters when inheriting a CDPATH not starting with the
70 # current directory.
71 CDPATH=
73 # ==================== Things 'configure' Might Edit ====================
75 cache_file = @cache_file@
76 CONFIGURE_FLAGS = --cache-file=$(cache_file)
78 AWK = @AWK@
80 EXEEXT=@EXEEXT@
82 ### These help us choose version- and architecture-specific directories
83 ### to install files in.
85 ### This should be the number of the Emacs version we're building,
86 ### like '24.5' or '25.0.50'.
87 version=@version@
89 ### This should be the name of the configuration we're building Emacs
90 ### for, like 'x86_64-unknown-linux-gnu' or 'powerpc-ibm-aix7.1.2.0'.
91 configuration=@configuration@
93 ### The nt/ subdirectory gets built only for MinGW
94 NTDIR=@NTDIR@
96 top_builddir = @top_builddir@
97 -include ${top_builddir}/src/verbose.mk
99 FIND_DELETE = @FIND_DELETE@
101 HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@
103 USE_STARTUP_NOTIFICATION = @USE_STARTUP_NOTIFICATION@
105 # ==================== Where To Install Things ====================
107 # Location to install Emacs.app under GNUstep / macOS.
108 # Later values may use these.
109 ns_appdir=@ns_appdir@
110 ns_appbindir=@ns_appbindir@
111 ns_applibexecdir=@ns_applibexecdir@
112 ns_appresdir=@ns_appresdir@
113 ns_applibdir=@ns_applibdir@
114 # Either yes or no depending on whether this is a relocatable Emacs.app.
115 ns_self_contained=@ns_self_contained@
117 # The default location for installation. Everything is placed in
118 # subdirectories of this directory. The default values for many of
119 # the variables below are expressed in terms of this one, so you may
120 # not need to change them. This defaults to /usr/local.
121 prefix=@prefix@
123 # Like 'prefix', but used for architecture-specific files.
124 exec_prefix=@exec_prefix@
126 # Where to install Emacs and other binaries that people will want to
127 # run directly (like etags).
128 bindir=@bindir@
130 # The root of the directory tree for read-only architecture-independent
131 # data files. ${datadir}, ${infodir} and ${mandir} are based on this.
132 datarootdir=@datarootdir@
134 # Where to install architecture-independent data files. ${lispdir}
135 # and ${etcdir} are subdirectories of this.
136 datadir=@datadir@
138 # Where to install and expect the files that Emacs modifies as it
139 # runs. These files are all architecture-independent.
140 # Right now, this is not used.
141 sharedstatedir=@sharedstatedir@
143 # Where to install and expect executable files to be run by Emacs
144 # rather than directly by users (and other architecture-dependent
145 # data, although Emacs does not have any). The executables
146 # are actually installed in ${archlibdir}, which is (normally)
147 # a subdirectory of this.
148 libexecdir=@libexecdir@
150 # Currently only used for the systemd service file.
151 libdir=@libdir@
153 # Where to install emacs-module.h.
154 includedir=@includedir@
156 # Where to install Emacs's man pages.
157 # Note they contain cross-references that expect them to be in section 1.
158 mandir=@mandir@
159 man1dir=$(mandir)/man1
161 # Where to install and expect the info files describing Emacs.
162 infodir=@infodir@
163 # Info files not in the doc/misc directory (we get those via make echo-info).
164 INFO_NONMISC=emacs.info eintr.info elisp.info
166 # Directory for local state files for all programs.
167 localstatedir=@localstatedir@
169 # Where to look for bitmap files.
170 bitmapdir=@bitmapdir@
172 # Where to find the source code. The source code for Emacs's C kernel is
173 # expected to be in ${srcdir}/src, and the source code for Emacs's
174 # utility programs is expected to be in ${srcdir}/lib-src. This is
175 # set by the configure script's '--srcdir' option.
177 # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
178 srcdir=@srcdir@
179 abs_srcdir=@abs_srcdir@
181 # Where the manpage source files are kept.
182 mansrcdir=$(srcdir)/doc/man
184 # Tell make where to find source files; this is needed for the makefiles.
185 VPATH=@srcdir@
187 # Where to find the application default.
188 x_default_search_path=@x_default_search_path@
190 # Where the etc/emacs.desktop file is to be installed.
191 desktopdir=$(datarootdir)/applications
193 # Where the etc/emacs.metainfo.xml file is to be installed.
194 metainfodir=$(datarootdir)/metainfo
196 # Where the etc/emacs.service file is to be installed.
197 # The system value (typically /usr/lib/systemd/user) can be
198 # obtained with: pkg-config --variable=systemduserunitdir systemd
199 # but that does not respect configure's prefix.
200 # It is not clear where we should install this file when
201 # prefix != /usr (or /usr/local?) (eg for non-root installs).
202 # Other options include ~/.config/systemd/user/,
203 # $XDG_RUNTIME_DIR/systemd/user/
204 # It seems the user may end up having to make a manual link...
205 systemdunitdir=$(libdir)/systemd/user
207 # Where the etc/images/icons/hicolor directory is to be installed.
208 icondir=$(datarootdir)/icons
210 # The source directory for the icon files.
211 iconsrcdir=$(srcdir)/etc/images/icons
213 # ==================== Emacs-specific directories ====================
215 # These variables hold the values Emacs will actually use. They are
216 # based on the values of the standard Make variables above.
218 # Where lisp files are installed in a distributed with Emacs (relative
219 # path to the installation directory).
220 lispdirrel=@lispdirrel@
222 # Where to install the lisp files distributed with Emacs.
223 # This includes the Emacs version, so that the lisp files for different
224 # versions of Emacs will install themselves in separate directories.
225 lispdir=@lispdir@
227 # Directories Emacs should search for standard lisp files.
228 # The default is ${lispdir}.
229 standardlisppath=@standardlisppath@
231 # Directories Emacs should search for lisp files specific to this
232 # site (i.e. customizations), before consulting ${standardlisppath}.
233 # This should be a colon-separated list of directories.
234 locallisppath=@locallisppath@
236 # Where Emacs will search to find its lisp files. Before
237 # changing this, check to see if your purpose wouldn't
238 # better be served by changing locallisppath. This
239 # should be a colon-separated list of directories.
240 # The default is ${locallisppath}:${standardlisppath}.
241 lisppath=@lisppath@
243 # Where Emacs will search for its lisp files while building.
244 # This is only used during the process of compiling Emacs,
245 # to help Emacs find its lisp files before they've been installed
246 # in their final location.
247 # This should be a colon-separated list of directories.
248 # Normally it points to the lisp/ directory in the sources.
249 # NB lread.c relies on lisp/ being first here.
250 buildlisppath=${abs_srcdir}/lisp
252 # Where to install the other architecture-independent
253 # data files distributed with Emacs (like the tutorial,
254 # the cookie recipes and the Zippy database). This path
255 # usually contains the Emacs version number, so the data
256 # files for multiple versions of Emacs may be installed
257 # at once.
258 etcdir=@etcdir@
260 # Where to put executables to be run by Emacs rather than
261 # the user. This path usually includes the Emacs version
262 # and configuration name, so that multiple configurations
263 # for multiple versions of Emacs may be installed at
264 # once.
265 archlibdir=@archlibdir@
267 # Where to put the etc/DOC file.
268 etcdocdir=@etcdocdir@
270 # User or group of the auxiliary program update-game-score, which is
271 # installed on platforms with a game directory shared by multiple users.
272 # On other platforms Emacs can update the score files itself.
273 gameuser=@gameuser@
274 gamegroup=@gamegroup@
275 # Where to install game score files, if gameuser or gamegroup is nonempty.
276 gamedir=@gamedir@
277 # Nonempty if and only if a shared gamedir is used.
278 use_gamedir=$(gameuser)$(gamegroup)
280 # ==================== Utility Programs for the Build ====================
282 # Allow the user to specify the install program.
283 # Note that if the system does not provide a suitable install,
284 # configure will use build-aux/install-sh. Annoyingly, it does
285 # not use an absolute path. So we must take care to always run
286 # INSTALL-type commands from the directory containing the Makefile.
287 # This explains (I think) the cd thisdir seen in several install rules.
288 SYSTEM_TYPE = @SYSTEM_TYPE@
289 INSTALL = @INSTALL@
290 INSTALL_PROGRAM = @INSTALL_PROGRAM@
291 INSTALL_DATA = @INSTALL_DATA@
292 INSTALL_INFO = @INSTALL_INFO@
293 ifeq ($(SYSTEM_TYPE),cygwin)
294 INSTALL_ELN = $(INSTALL)
295 else
296 INSTALL_ELN = $(INSTALL_DATA)
297 endif
298 # By default, we uphold the dignity of our programs.
299 INSTALL_STRIP =
300 MKDIR_P = @MKDIR_P@
301 # Create a link to a file in the same directory as the target.
302 LN_S_FILEONLY = @LN_S_FILEONLY@
304 # We use gzip to compress installed .el and some .txt files.
305 GZIP_PROG = @GZIP_PROG@
307 # ============================= Targets ==============================
309 # Program name transformation.
310 TRANSFORM = @program_transform_name@
312 # What emacs should be called when installed.
313 EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'`
314 EMACS = ${EMACS_NAME}${EXEEXT}
315 EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT}
317 # Subdirectories to make recursively.
318 SUBDIR = $(NTDIR) lib lib-src src lisp
320 # The subdir makefiles created by config.status.
321 SUBDIR_MAKEFILES_IN = @SUBDIR_MAKEFILES_IN@
322 SUBDIR_MAKEFILES = $(patsubst ${srcdir}/%,%,${SUBDIR_MAKEFILES_IN:.in=})
324 # Non-makefile files created by config.status.
325 CONFIG_STATUS_FILES_IN = \
326 ${srcdir}/nt/emacs.rc.in ${srcdir}/nt/emacsclient.rc.in \
327 ${srcdir}/doc/man/emacs.1.in ${srcdir}/src/emacs-module.h.in \
328 ${srcdir}/src/module-env-*.h
330 # Subdirectories to install, and where they'll go. lib-src's and nt's
331 # makefiles know how to install them, so we don't do that here.
332 # Directories that cannot simply be copied, eg info, are treated
333 # separately.
334 COPYDIR = ${srcdir}/etc ${srcdir}/lisp
335 COPYDESTS = "$(DESTDIR)${etcdir}" "$(DESTDIR)${lispdir}"
337 ifeq (${ns_self_contained},no)
338 BIN_DESTDIR='$(DESTDIR)${bindir}/'
339 ELN_DESTDIR = $(DESTDIR)${libdir}/emacs/${version}/
340 else
341 BIN_DESTDIR='${ns_appbindir}/'
342 ELN_DESTDIR = ${ns_applibdir}/
343 endif
345 all: ${SUBDIR} info
347 .PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 epaths-force-ns-self-contained etc-emacsver
349 # If configure were to just generate emacsver.tex from emacsver.tex.in
350 # in the normal way, the timestamp of emacsver.tex would always be
351 # newer than that of the pdf files, which are prebuilt in release tarfiles.
352 # So we use this rule, and move-if-change, to avoid that.
353 etc-emacsver:
354 majorversion=`echo ${version} | sed 's/\..*//'`; \
355 sed "s/[@]majorversion@/$${majorversion}/" \
356 ${srcdir}/etc/refcards/emacsver.tex.in > emacsver.tex.$$$$ && \
357 ${srcdir}/build-aux/move-if-change emacsver.tex.$$$$ \
358 ${srcdir}/etc/refcards/emacsver.tex
360 # The shared gamedir name as a C string literal, or a null ptr if not in use.
361 PATH_GAME = $(if $(use_gamedir),"$(gamedir)",((char const *) 0))
363 # Generate epaths.h from epaths.in. This target is invoked by 'configure'.
364 # See comments in configure.ac for why it is done this way, as opposed
365 # to just letting configure generate epaths.h from epaths.in in a
366 # similar way to how Makefile is made from Makefile.in.
367 epaths-force:
368 @for dir in '$(abs_srcdir)' '$(lispdir)' '$(archlibdir)'; do \
369 case $$dir in \
370 *:*) \
371 printf >&2 "Build or installation directory '%s'\\n" "$$dir"; \
372 echo >&2 "cannot contain ':'."; \
373 exit 1;; \
374 esac; \
375 done
376 @(gamedir='${gamedir}'; \
377 sed < ${srcdir}/src/epaths.in > epaths.h.$$$$ \
378 -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "${standardlisppath}";' \
379 -e 's;\(#.*PATH_REL_LOADSEARCH\).*$$;\1 "${lispdirrel}";' \
380 -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "${locallisppath}";' \
381 -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "${buildlisppath}";' \
382 -e '/^#define PATH_[^ ]*SEARCH /s/\([":]\):*/\1/g' \
383 -e '/^#define PATH_[^ ]*SEARCH /s/:"/"/' \
384 -e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";' \
385 -e 's;\(#.*PATH_INFO\).*$$;\1 "${infodir}";' \
386 -e 's;\(#.*PATH_DATA\).*$$;\1 "${etcdir}";' \
387 -e 's;\(#.*PATH_BITMAPS\).*$$;\1 "${bitmapdir}";' \
388 -e 's;\(#.*PATH_X_DEFAULTS\).*$$;\1 "${x_default_search_path}";' \
389 -e 's;\(#.*PATH_GAME\).*$$;\1 $(PATH_GAME);' \
390 -e 's;\(#.*PATH_DOC\).*$$;\1 "${etcdocdir}";') && \
391 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
393 # The w32 build needs a slightly different editing, and it uses
394 # nt/epaths.nt as the template.
396 # Use the value of ${locallisppath} supplied by 'configure',
397 # to support the --enable-locallisppath argument.
399 # In this case, the paths written to 'src/epaths.h' must be in native
400 # MS-Windows format (e.g. 'c:/foo/bar'), because temacs is a MinGW
401 # program that doesn't support MSYS-style paths (e.g. '/c/foo/bar' or
402 # '/foo/bar').
403 epaths-force-w32:
404 @(w32srcdir=`${srcdir}/build-aux/msys-to-w32 "${abs_srcdir}"`; \
405 w32prefix=`${srcdir}/build-aux/msys-to-w32 "${prefix}"`; \
406 w32locallisppath=`${srcdir}/build-aux/msys-to-w32 "${locallisppath}"` ; \
407 w32locallisppath=$${w32locallisppath//$${w32prefix}/"%emacs_dir%"} ; \
408 sed < ${srcdir}/nt/epaths.nt > epaths.h.$$$$ \
409 -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${w32locallisppath//;/\\;}"'";' \
410 -e 's;\(#.*PATH_REL_LOADSEARCH\).*$$;\1 "${lispdirrel}";' \
411 -e '/^.*#/s/@VER@/${version}/g' \
412 -e '/^.*#/s/@CFG@/${configuration}/g' \
413 -e "/^.*#/s|@SRC@|$${w32srcdir}|g") && \
414 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
416 # A NextStep style app bundle is relocatable, so instead of
417 # hard-coding paths try to generate them at run-time.
419 # The paths are mostly the same, and the bundle paths are different
420 # between macOS and GNUstep, so just replace any references to the app
421 # bundle root itself with the relative path.
422 epaths-force-ns-self-contained: epaths-force
423 @(sed < src/epaths.h > epaths.h.$$$$ \
424 -e 's;${ns_appdir}/;;') && \
425 ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
427 lib-src src: $(NTDIR) lib
429 src: lib-src
431 # We need to build 'emacs' in 'src' to compile the *.elc files in 'lisp'.
432 lisp: src
434 # These targets should be "${SUBDIR} without 'src'".
435 lib lib-src lisp nt: Makefile
436 $(MAKE) -C $@ all
438 # Ideally, VCSWITNESS should be a file that is modified whenever the
439 # repository registers a commit from either a local checkin or a
440 # repository pull. In git there is no single file that guarantees
441 # this, but the local log for the current head should be close enough.
443 # Pass an unexpanded $srcdir to src's Makefile, which then
444 # expands it using its own value of srcdir (which points to the
445 # source directory of src/).
446 dirstate = .git/logs/HEAD
447 VCSWITNESS = $(if $(wildcard $(srcdir)/$(dirstate)),$$(srcdir)/../$(dirstate))
448 src: Makefile
449 $(MAKE) -C $@ VCSWITNESS='$(VCSWITNESS)' BIN_DESTDIR='$(BIN_DESTDIR)' \
450 ELN_DESTDIR='$(ELN_DESTDIR)' all
452 blessmail: Makefile src
453 $(MAKE) -C lib-src maybe-blessmail
455 # We used to have one rule per */Makefile.in, but that leads to race
456 # conditions with parallel makes, so assume that the timestamp on
457 # ./Makefile represents the timestamp on all the other Makefiles.
458 # Similarly, assume the timestamp on ./configure represents the
459 # timestamp on src/config.in.
461 # config.status overrides MAKEFILE_NAME with a bogus name when creating
462 # src/epaths.h, so that 'make epaths-force' does not recursively invoke
463 # config.status and overwrite config.status while executing it (Bug#11214).
465 # 'make bootstrap' overrides MAKEFILE_NAME to a nonexistent file but
466 # then attempts to build that file. This forces 'Makefile', 'lib/Makefile',
467 # etc. to be built without running into similar recursion problems.
468 MAKEFILE_NAME = Makefile
469 $(MAKEFILE_NAME): config.status $(srcdir)/configure \
470 $(srcdir)/lib/gnulib.mk.in \
471 $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN) $(CONFIG_STATUS_FILES_IN)
472 MAKE='$(MAKE)' ./config.status
474 # Don't erase these files if make is interrupted while refreshing them.
475 .PRECIOUS: Makefile config.status
477 config.status: ${srcdir}/configure
478 if [ -x ./config.status ]; then \
479 $(CFG) ./config.status --recheck; \
480 else \
481 $(CFG) $(srcdir)/configure $(CONFIGURE_FLAGS); \
484 $(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/m4/*.m4
485 cd $(srcdir) && ./autogen.sh autoconf
487 # ==================== Installation ====================
489 .PHONY: install install-arch-dep install-arch-indep install-etcdoc install-info
490 .PHONY: install-man install-etc install-strip install-$(NTDIR) install-eln
491 .PHONY: uninstall uninstall-$(NTDIR)
493 ## If we let lib-src do its own installation, that means we
494 ## don't have to duplicate the list of utilities to install in
495 ## this Makefile as well.
497 install: all install-arch-indep install-etcdoc install-arch-dep install-$(NTDIR) blessmail install-eln
498 @true
500 ## Ensure that $subdir contains a subdirs.el file.
501 ## Here and elsewhere, we set the umask so that any created files are
502 ## world-readable.
503 ## TODO it might be good to warn about non-standard permissions of
504 ## pre-existing directories, but that does not seem easy.
505 write_subdir=if [ -f "$${subdir}/subdirs.el" ]; \
506 then true; \
507 else \
508 umask 022; \
509 ${MKDIR_P} "$${subdir}"; \
510 (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
511 echo " (normal-top-level-add-subdirs-to-load-path))") \
512 > "$${subdir}/subdirs.el"; \
515 ### Install the executables that were compiled specifically for this machine.
516 ### We do install-arch-indep first because the executable needs the
517 ### Lisp files and DOC file to work properly.
518 install-arch-dep: src install-arch-indep install-etcdoc install-$(NTDIR)
519 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
520 $(MAKE) -C lib-src install
521 ifeq (${ns_self_contained},no)
522 ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} "$(DESTDIR)${bindir}/$(EMACSFULL)"
523 ifeq (${DUMPING},pdumper)
524 ${INSTALL_DATA} src/emacs.pdmp "$(DESTDIR)${libexecdir}/emacs/${version}/${configuration}"/emacs.pdmp
525 endif
526 -chmod 755 "$(DESTDIR)${bindir}/$(EMACSFULL)"
527 ifndef NO_BIN_LINK
528 rm -f "$(DESTDIR)${bindir}/$(EMACS)"
529 cd "$(DESTDIR)${bindir}" && $(LN_S_FILEONLY) "$(EMACSFULL)" "$(EMACS)"
530 endif
531 else
532 subdir=${ns_appresdir}/site-lisp && ${write_subdir}
533 rm -rf ${ns_appresdir}/share
534 endif
536 ### Windows-specific install target for installing programs produced
537 ### in nt/, and its Posix do-nothing shadow.
538 install-:
539 install-nt:
540 $(MAKE) -C $(NTDIR) install
542 ## In the share directory, we are deleting:
543 ## applications (with emacs.desktop, also found in etc/)
544 ## emacs (basically empty except for unneeded site-lisp directories)
545 ## icons (duplicates etc/images/icons/hicolor)
547 ## This is install-etc for everything except self-contained-ns builds.
548 ## For them, it is empty.
549 INSTALL_ARCH_INDEP_EXTRA = @INSTALL_ARCH_INDEP_EXTRA@
551 ## https://lists.gnu.org/r/emacs-devel/2007-10/msg01672.html
552 ## Needs to be the user running install, so configure can't set it.
553 set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \
554 `(id -u) 2> /dev/null`; do \
555 [ -n "$${installuser}" ] && break ; \
556 done; \
557 installgroup=`(id -g) 2>/dev/null` && [ -n "$$installgroup" ] && \
558 installuser=$$installuser:$$installgroup
560 ### Install the files that are machine-independent.
561 ### Most of them come straight from the distribution; the exception is
562 ### the DOC file, which is copied from the build directory.
564 ## We delete each directory in ${COPYDESTS} before we copy into it;
565 ## that way, we can reinstall over directories that have been put in
566 ## place with their files read-only (perhaps because they are checked
567 ## into RCS). In order to make this safe, we make sure that the
568 ## source exists and is distinct from the destination.
570 ## We delete etc/DOC* because there may be irrelevant DOC files from
571 ## other builds in the source directory. This is ok because we just
572 ## deleted the entire installed etc/ directory and recreated it.
573 ## install-etcdoc installs the relevant DOC.
575 ## Note that we install etc/refcards/*.ps if present.
576 ## TODO we should compress these if GZIP_PROG is set.
577 ## It would be simpler to have a separate install rule for etc/refcards
578 ## (maybe move it to doc/refcards?).
580 ## Note that the Makefiles in the etc directory are potentially useful
581 ## in an installed Emacs, so should not be excluded.
583 ## We always create the _default_ locallisppath directories, and
584 ## ensure that they contain a subdirs.el file (via write_subdir).
585 ## This is true even if locallisppath has a non-default value.
586 ## In case of non-default value, we used to create the specified directories,
587 ## but not add subdirs.el to them. This was a strange halfway house.
588 ## Nowadays we do not create non-default directories.
590 ## Note that we use tar instead of plain old cp -R/-r because the latter
591 ## is apparently not portable (even in 2012!).
592 ## https://lists.gnu.org/r/emacs-devel/2012-05/msg00278.html
593 ## I have no idea which platforms Emacs supports where cp -R does not
594 ## work correctly, and therefore no idea when tar can be replaced.
595 ## See also these comments from 2004 about cp -r working fine:
596 ## https://lists.gnu.org/r/autoconf-patches/2004-11/msg00005.html
597 install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
598 umask 022 && $(MKDIR_P) "$(DESTDIR)$(includedir)"
599 $(INSTALL_DATA) src/emacs-module.h "$(DESTDIR)$(includedir)/emacs-module.h"
600 -set ${COPYDESTS} ; \
601 unset CDPATH; \
602 $(set_installuser); \
603 for dir in ${COPYDIR} ; do \
604 [ -d $${dir} ] || exit 1 ; \
605 dest="$$1" ; shift ; \
606 if [ -d "$${dest}" ]; then \
607 exp_dest=`cd "$${dest}" && /bin/pwd`; \
608 [ "$$exp_dest" = "`cd $${dir} && /bin/pwd`" ] && continue ; \
609 else true; \
610 fi; \
611 rm -rf "$${dest}" ; \
612 umask 022; ${MKDIR_P} "$${dest}" ; \
613 printf 'Copying %s to %s...\n' "$$dir" "$$dest" ; \
614 (cd $${dir}; tar -chf - . ) \
615 | (cd "$${dest}"; umask 022; \
616 tar -xvf - && cat > /dev/null) || exit 1; \
617 if [ "$${dir}" = "${srcdir}/etc" ]; then \
618 rm -f "$${dest}/DOC"* ; \
619 rm -f "$${dest}/refcards"/*.aux "$${dest}/refcards"/*.dvi; \
620 rm -f "$${dest}/refcards"/*.log "$${dest}/refcards"/*.in; \
621 else true; \
622 fi; \
623 (cd "$${dest}" || exit 1; \
624 for subdir in `find . -type d -print` ; do \
625 chmod a+rx $${subdir} ; \
626 rm -f $${subdir}/.gitignore ; \
627 rm -f $${subdir}/.arch-inventory ; \
628 rm -f $${subdir}/.DS_Store ; \
629 rm -f $${subdir}/#* ; \
630 rm -f $${subdir}/.#* ; \
631 rm -f $${subdir}/*~ ; \
632 rm -f $${subdir}/*.orig ; \
633 rm -f $${subdir}/ChangeLog* ; \
634 [ "$${dir}" != "${srcdir}/etc" ] && \
635 rm -f $${subdir}/[mM]akefile*[.-]in $${subdir}/[mM]akefile ; \
636 done ); \
637 find "$${dest}" -exec chown $${installuser} {} ';' ;\
638 done
639 -rm -f "$(DESTDIR)${lispdir}/subdirs.el"
640 umask 022; $(srcdir)/build-aux/update-subdirs "$(DESTDIR)${lispdir}"
641 subdir="$(DESTDIR)${datadir}/emacs/${version}/site-lisp" ; \
642 ${write_subdir}
643 subdir="$(DESTDIR)${datadir}/emacs/site-lisp" ; \
644 ${write_subdir} || true
645 [ -z "${GZIP_PROG}" ] || { \
646 echo "Compressing *.el etc. ..." && \
647 cd "$(DESTDIR)${lispdir}" && \
648 for f in `find . -name "*.elc" -print | sed 's/.elc$$/.el/'`; do \
649 ${GZIP_PROG} -9n "$$f"; \
650 done; \
651 ${GZIP_PROG} -9n "../etc/publicsuffix.txt"; \
653 -chmod -R a+r "$(DESTDIR)${datadir}/emacs/${version}" ${COPYDESTS}
655 ## The above chmods are needed because "umask 022; tar ..." is not
656 ## guaranteed to do the right thing; eg if we are root and tar is
657 ## preserving source permissions.
659 ## Note that install-arch-indep deletes and recreates the entire
660 ## installed etc/ directory, so we need it to run before this does.
661 install-etcdoc: src install-arch-indep
662 -unset CDPATH; \
663 umask 022; ${MKDIR_P} "$(DESTDIR)${etcdocdir}" ; \
664 exp_etcdocdir=`cd "$(DESTDIR)${etcdocdir}"; /bin/pwd`; \
665 if [ "`cd ./etc; /bin/pwd`" != "$$exp_etcdocdir" ]; \
666 then \
667 docfile="DOC"; \
668 printf 'Copying %s to %s ...\n' "etc/$$docfile" \
669 "$(DESTDIR)${etcdocdir}"; \
670 ${INSTALL_DATA} etc/$${docfile} "$(DESTDIR)${etcdocdir}/$${docfile}"; \
671 $(set_installuser); \
672 chown $${installuser} "$(DESTDIR)${etcdocdir}/$${docfile}" || true ; \
673 else true; fi
675 ## FIXME:
676 ## If info/dir is missing, but we have install-info, we should let
677 ## that handle it. If info/dir is present and we do not have install-info,
678 ## we should check for missing entries and add them by hand.
679 install-info: info
680 umask 022; ${MKDIR_P} "$(DESTDIR)${infodir}"
681 -unset CDPATH; \
682 thisdir=`/bin/pwd`; \
683 exp_infodir=`cd "$(DESTDIR)${infodir}" && /bin/pwd`; \
684 if [ "`cd ${srcdir}/info && /bin/pwd`" = "$$exp_infodir" ]; then \
685 true; \
686 else \
687 [ -f "$(DESTDIR)${infodir}/dir" ] || \
688 [ ! -f ${srcdir}/info/dir ] || \
689 ${INSTALL_DATA} ${srcdir}/info/dir "$(DESTDIR)${infodir}/dir"; \
690 info_misc=`MAKEFLAGS= $(MAKE) --no-print-directory -s -C doc/misc echo-info`; \
691 cd ${srcdir}/info ; \
692 for elt in ${INFO_NONMISC} $${info_misc}; do \
693 for f in `ls $$elt $$elt-[1-9] $$elt-[1-9][0-9] 2>/dev/null`; do \
694 (cd "$${thisdir}"; \
695 ${INSTALL_DATA} ${srcdir}/info/$$f "$(DESTDIR)${infodir}/$$f"); \
696 [ -n "${GZIP_PROG}" ] || continue ; \
697 rm -f "$(DESTDIR)${infodir}/$$f.gz"; \
698 ${GZIP_PROG} -9n "$(DESTDIR)${infodir}/$$f"; \
699 done; \
700 (cd "$${thisdir}"; \
701 ${INSTALL_INFO} --info-dir="$(DESTDIR)${infodir}" "$(DESTDIR)${infodir}/$$elt"); \
702 done; \
705 ## "gzip || true" is because some gzips exit with non-zero status
706 ## if compression would not reduce the file size. Eg, the gzip in
707 ## OpenBSD 4.9 seems to do this (2013/03). In Emacs, this can
708 ## only happen with the tiny ctags.1 manpage. We don't really care if
709 ## ctags.1 is compressed or not. "gzip -f" is another option here,
710 ## but not sure if portable.
711 install-man:
712 umask 022; ${MKDIR_P} "$(DESTDIR)${man1dir}"
713 thisdir=`/bin/pwd`; \
714 cd ${mansrcdir}; \
715 for page in *.1; do \
716 test "$$page" = ChangeLog.1 && continue; \
717 dest=`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1; \
718 (cd "$${thisdir}"; \
719 ${INSTALL_DATA} ${mansrcdir}/$${page} "$(DESTDIR)${man1dir}/$${dest}"); \
720 [ -n "${GZIP_PROG}" ] || continue ; \
721 rm -f "$(DESTDIR)${man1dir}/$${dest}.gz"; \
722 ${GZIP_PROG} -9n "$(DESTDIR)${man1dir}/$${dest}" || true; \
723 done
725 ## Install those items from etc/ that need to end up elsewhere.
727 ## If you prefer, choose "emacs22" at installation time.
728 ## Note: emacs22 does not have all the resolutions.
729 EMACS_ICON=emacs
731 ifeq (${USE_STARTUP_NOTIFICATION},no)
732 USE_STARTUP_NOTIFICATION_SED_CMD=-e "/^StartupNotify=true$$/d"
733 endif
734 install-etc:
735 umask 022; ${MKDIR_P} "$(DESTDIR)${desktopdir}"
736 tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \
737 sed -e "/^Exec=emacs/ s/emacs/${EMACS_NAME}/" \
738 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
739 $(USE_STARTUP_NOTIFICATION_SED_CMD) \
740 ${srcdir}/etc/emacs.desktop > $${tmp}; \
741 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"; \
742 rm -f $${tmp}
743 tmp=etc/emacsclient.tmpdesktop; rm -f $${tmp}; \
744 client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
745 sed -e "/^Exec=emacsclient/ s|emacsclient|${bindir}/$${client_name}|" \
746 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
747 $(USE_STARTUP_NOTIFICATION_SED_CMD) \
748 ${srcdir}/etc/emacsclient.desktop > $${tmp}; \
749 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}.desktop"; \
750 rm -f $${tmp}
751 tmp=etc/emacs-mail.tmpdesktop; rm -f $${tmp}; \
752 sed -e "/^Exec=emacs/ s/emacs/${EMACS_NAME}/" \
753 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
754 ${srcdir}/etc/emacs-mail.desktop > $${tmp}; \
755 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}-mail.desktop"; \
756 rm -f $${tmp}
757 tmp=etc/emacsclient-mail.tmpdesktop; rm -f $${tmp}; \
758 client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
759 sed -e "/^Exec=emacsclient/ s|emacsclient|${bindir}/$${client_name}|" \
760 -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
761 ${srcdir}/etc/emacsclient-mail.desktop > $${tmp}; \
762 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}-mail.desktop"; \
763 rm -f $${tmp}
764 umask 022; ${MKDIR_P} "$(DESTDIR)${metainfodir}"
765 tmp=etc/emacs.tmpmetainfo; rm -f $${tmp}; \
766 sed -e "s/emacs\.desktop/${EMACS_NAME}.desktop/" \
767 ${srcdir}/etc/emacs.metainfo.xml > $${tmp}; \
768 ${INSTALL_DATA} $${tmp} "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"; \
769 rm -f $${tmp}
770 umask 022; $(MKDIR_P) "$(DESTDIR)$(systemdunitdir)"
771 tmp=etc/emacs.tmpservice; rm -f $${tmp}; \
772 client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
773 sed -e '/^##/d' \
774 -e "/^Documentation/ s/emacs(1)/${EMACS_NAME}(1)/" \
775 -e "/^ExecStart/ s|emacs|${bindir}/${EMACS}|" \
776 -e "/^ExecStop/ s|emacsclient|${bindir}/$${client_name}|" \
777 ${srcdir}/etc/emacs.service > $${tmp}; \
778 $(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"; \
779 rm -f $${tmp}
780 thisdir=`/bin/pwd`; \
781 cd ${iconsrcdir} || exit 1; umask 022 ; \
782 for dir in */*/apps */*/mimetypes; do \
783 [ -d $${dir} ] || continue ; \
784 ( cd "$${thisdir}"; ${MKDIR_P} "$(DESTDIR)${icondir}/$${dir}" ) ; \
785 for icon in $${dir}/${EMACS_ICON}[.-]*; do \
786 [ -r $${icon} ] || continue ; \
787 ext=`echo "$${icon}" | sed -e 's|.*\.||'`; \
788 dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\\.$${ext}\$$||" -e 's/$(EMACS_ICON)/emacs/' -e '$(TRANSFORM)'`.$${ext} ; \
789 ( cd "$${thisdir}"; \
790 ${INSTALL_DATA} ${iconsrcdir}/$${icon} "$(DESTDIR)${icondir}/$${dir}/$${dest}" ) \
791 || exit 1; \
792 done ; \
793 done
795 ### Install native compiled Lisp files.
796 install-eln: lisp
797 ifeq ($(HAVE_NATIVE_COMP),yes)
798 umask 022 ; \
799 find native-lisp -type d -exec $(MKDIR_P) "$(ELN_DESTDIR){}" \; ; \
800 find native-lisp -type f -exec ${INSTALL_ELN} "{}" "$(ELN_DESTDIR){}" \;
801 endif
803 ### Build Emacs and install it, stripping binaries while installing them.
804 install-strip:
805 $(MAKE) INSTALL_STRIP=-s install
807 ### Delete all the installed files that the 'install' target would
808 ### create (but not the noninstalled files such as 'make all' would create).
810 ### Don't delete the lisp and etc directories if they're in the source tree.
811 uninstall: uninstall-$(NTDIR) uninstall-doc
812 rm -f "$(DESTDIR)$(includedir)/emacs-module.h"
813 $(MAKE) -C lib-src uninstall
814 -unset CDPATH; \
815 for dir in "$(DESTDIR)${lispdir}" "$(DESTDIR)${etcdir}" "$(ELN_DESTDIR)" ; do \
816 if [ -d "$${dir}" ]; then \
817 case `cd "$${dir}" ; /bin/pwd` in \
818 "`cd ${srcdir} ; /bin/pwd`"* ) ;; \
819 * ) rm -rf "$${dir}" ;; \
820 esac ; \
821 case "$${dir}" in \
822 "$(DESTDIR)${datadir}/emacs/${version}"/* ) \
823 rm -rf "$(DESTDIR)${datadir}/emacs/${version}" \
824 ;; \
825 esac ; \
826 fi ; \
827 done
828 -rm -rf "$(DESTDIR)${libexecdir}/emacs/${version}"
829 thisdir=`/bin/pwd`; \
830 (info_misc=`MAKEFLAGS= $(MAKE) --no-print-directory -s -C doc/misc echo-info`; \
831 if cd "$(DESTDIR)${infodir}"; then \
832 for elt in ${INFO_NONMISC} $${info_misc}; do \
833 (cd "$${thisdir}"; \
834 $(INSTALL_INFO) --remove --info-dir="$(DESTDIR)${infodir}" "$(DESTDIR)${infodir}/$$elt"); \
835 if [ -n "${GZIP_PROG}" ]; then \
836 ext=.gz; else ext=; fi; \
837 rm -f $$elt$$ext $$elt-[1-9]$$ext $$elt-[1-9][0-9]$$ext; \
838 done; \
840 (if [ -n "${GZIP_PROG}" ]; then \
841 ext=.gz; else ext=; fi; \
842 if cd ${mansrcdir}; then \
843 for page in *.1; do \
844 rm -f "$(DESTDIR)${man1dir}"/`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1$$ext; done; \
846 rm -f "$(DESTDIR)${bindir}/$(EMACS)" "$(DESTDIR)${bindir}/$(EMACSFULL)"
847 (if cd "$(DESTDIR)${icondir}"; then \
848 rm -f hicolor/*x*/apps/"${EMACS_NAME}.png" \
849 "hicolor/scalable/apps/${EMACS_NAME}.svg" \
850 "hicolor/scalable/apps/${EMACS_NAME}.ico" \
851 "hicolor/scalable/mimetypes/${EMACS_NAME}-document.svg" \
852 "hicolor/scalable/mimetypes/${EMACS_NAME}-document23.svg"; \
854 -rm -f "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"
855 -rm -f "$(DESTDIR)${metainfodir}/${EMACS_NAME}.metainfo.xml"
856 -rm -f "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"
857 ifneq (,$(use_gamedir))
858 for file in snake-scores tetris-scores; do \
859 file="$(DESTDIR)${gamedir}/$${file}"; \
860 [ -s "$${file}" ] || rm -f "$$file"; \
861 done
862 endif
864 ### Windows-specific uninstall target for removing programs produced
865 ### in nt/, and its Posix do-nothing shadow.
866 uninstall-:
867 uninstall-nt:
868 $(MAKE) -C $(NTDIR) uninstall
870 # ==================== Cleaning up and miscellanea ====================
872 .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean extraclean
874 ## Eg:
875 ## src_clean:
876 ## make -C src clean
877 define submake_template
878 .PHONY: $(1)_$(2)
879 $(1)_$(2):
880 $$(MAKE) -C $(1) $(2)
881 endef
883 ### 'mostlyclean'
884 ### Like 'clean', but may refrain from deleting a few files that people
885 ### normally don't want to recompile. For example, the 'mostlyclean'
886 ### target for GCC does not delete 'libgcc.a', because recompiling it
887 ### is rarely necessary and takes a lot of time.
888 mostlyclean_dirs = src oldXMenu lwlib lib lib-src nt doc/emacs doc/misc \
889 doc/lispref doc/lispintro test
891 $(foreach dir,$(mostlyclean_dirs),$(eval $(call submake_template,$(dir),mostlyclean)))
893 mostlyclean: $(mostlyclean_dirs:=_mostlyclean)
895 ### 'clean'
896 ### Delete all files from the current directory that are normally
897 ### created by building the program. Don't delete the files that
898 ### record the configuration. Also preserve files that could be made
899 ### by building, but normally aren't because the distribution comes
900 ### with them.
902 ### Delete '.dvi' files here if they are not part of the distribution.
903 clean_dirs = $(mostlyclean_dirs) nextstep admin/charsets admin/unidata
905 $(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean)))
907 clean: $(clean_dirs:=_clean)
908 -rm -f ./*.tmp etc/*.tmp*
909 -rm -rf info-dir.*
910 -rm -rf native-lisp
912 ### 'bootclean'
913 ### Delete all files that need to be remade for a clean bootstrap.
914 top_bootclean=\
915 rm -f config.cache config.log ${srcdir}/doc/man/emacs.1
917 ### 'distclean'
918 ### Delete all files from the current directory that are created by
919 ### configuring or building the program. If you have unpacked the
920 ### source and built the program without creating any other files,
921 ### 'make distclean' should leave only the files that were in the
922 ### distribution.
923 top_distclean=\
924 ${top_bootclean}; \
925 rm -f config.status config.log~ \
926 Makefile makefile lib/gnulib.mk ${SUBDIR_MAKEFILES}
928 distclean_dirs = $(clean_dirs) leim lisp admin/grammars
930 $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean)))
932 distclean: $(distclean_dirs:=_distclean)
933 ${top_distclean}
935 ### 'bootstrap-clean'
936 ### Delete everything that can be reconstructed by 'make' and that
937 ### needs to be deleted in order to force a bootstrap from a clean state.
938 $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),bootstrap-clean)))
940 bootstrap-clean: $(distclean_dirs:=_bootstrap-clean)
941 [ ! -f config.log ] || mv -f config.log config.log~
942 rm -rf ${srcdir}/info
943 rm -f ${srcdir}/etc/refcards/emacsver.tex
944 ${top_bootclean}
946 ### 'maintainer-clean'
947 ### Delete everything from the current directory that can be
948 ### reconstructed with this Makefile. This typically includes
949 ### everything deleted by distclean, plus more: C source files
950 ### produced by Bison, tags tables, info files, and so on.
952 ### One exception, however: 'make maintainer-clean' should not delete
953 ### 'configure' even if 'configure' can be remade using a rule in the
954 ### Makefile. More generally, 'make maintainer-clean' should not delete
955 ### anything that needs to exist in order to run 'configure' and then
956 ### begin to build the program.
957 top_maintainer_clean=\
958 ${top_distclean}; \
959 rm -fr ${srcdir}/autom4te.cache
961 $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),maintainer-clean)))
963 maintainer-clean: $(distclean_dirs:=_maintainer-clean)
964 rm -rf ${srcdir}/info
965 rm -f ${srcdir}/etc/refcards/emacsver.tex
966 ${top_maintainer_clean}
968 ### This doesn't actually appear in the coding standards, but Karl
969 ### says GCC supports it, and that's where the configuration part of
970 ### the coding standards seem to come from. It's like distclean, but
971 ### it deletes backup and autosave files too.
972 extraclean: maintainer-clean
973 -rm -f config-tmp-* ${srcdir}/aclocal.m4 ${srcdir}/configure \
974 ${srcdir}/src/config.in
975 -[ "${srcdir}" = "." ] || \
976 find ${srcdir} '(' -name '*~' -o -name '#*' ')' ${FIND_DELETE}
977 -find . '(' -name '*~' -o -name '#*' ')' ${FIND_DELETE}
979 # The src subdir knows how to do the right thing
980 # even when the build directory and source dir are different.
981 .PHONY: TAGS tags
982 # FIXME: We used to include `src` in the dependencies, not sure why.
983 # I removed it because it causes `make tags` to build Emacs.
984 TAGS tags: lib lib-src # src
985 $(MAKE) -C src tags
986 $(MAKE) -C doc/emacs tags
987 $(MAKE) -C doc/lispintro tags
988 $(MAKE) -C doc/lispref tags
989 $(MAKE) -C doc/misc tags
991 CHECK_TARGETS = check check-maybe check-expensive check-all
992 .PHONY: $(CHECK_TARGETS)
993 $(CHECK_TARGETS): all
994 $(MAKE) -C test $@
996 test/%:
997 $(MAKE) -C test $*
1000 dist:
1001 cd ${srcdir}; ./make-dist
1003 DVIS = lispref-dvi lispintro-dvi emacs-dvi misc-dvi
1004 HTMLS = lispref-html lispintro-html emacs-html misc-html
1005 INFOS = lispref-info lispintro-info emacs-info misc-info
1006 PDFS = lispref-pdf lispintro-pdf emacs-pdf misc-pdf
1007 PSS = lispref-ps lispintro-ps emacs-ps misc-ps
1009 DOCS = $(DVIS) $(HTMLS) $(INFOS) $(PDFS) $(PSS)
1010 $(DOCS):
1011 $(MAKE) -C doc/$(subst -, ,$@)
1013 .PHONY: $(DOCS) docs pdf ps
1014 .PHONY: info dvi dist html info-dir check-info
1016 ## TODO add etc/refcards.
1017 docs: $(DOCS)
1018 dvi: $(DVIS)
1019 html: $(HTMLS)
1020 info: $(INFOS) info-dir
1021 pdf: $(PDFS)
1022 ps: $(PSS)
1024 # This dependency is due to those doc/misc/ manuals that use .org sources.
1025 # Depending on src is sufficient, but ends up being slow, since the
1026 # uncompiled lisp/org/*.el files are used to build the .texi files
1027 # (which can be slow even with the elc files).
1028 misc-info: lisp
1029 # Using src rather than lisp because one is less likely to get unnecessary
1030 # rebuilds of stuff that is not strictly necessary for generating manuals.
1031 misc-dvi misc-html misc-pdf misc-ps: src
1033 info-dir: ${srcdir}/info/dir
1035 texi_misc = $(shell MAKEFLAGS= ${MAKE} --no-print-directory -s -C doc/misc echo-sources)
1037 srcdir_doc_info_dir_inputs = \
1038 ${srcdir}/doc/emacs/emacs.texi \
1039 ${srcdir}/doc/lispintro/emacs-lisp-intro.texi \
1040 ${srcdir}/doc/lispref/elisp.texi \
1041 $(addprefix ${srcdir}/doc/misc/,${texi_misc})
1042 info_dir_inputs = \
1043 ../build-aux/dir_top \
1044 $(subst ${srcdir}/doc/,,${srcdir_doc_info_dir_inputs})
1045 info_dir_deps = \
1046 ${srcdir}/build-aux/make-info-dir \
1047 ${srcdir}/build-aux/dir_top \
1048 ${srcdir_doc_info_dir_inputs}
1050 ## It would be much simpler if info/dir was only created in the
1051 ## installation location by the install-info rule, but we also
1052 ## need one in the source directory for people running uninstalled.
1053 ## FIXME it would be faster to use the install-info program if we have it,
1054 ## but then we would need to depend on ${INFOS}, which would
1055 ## slow down parallelization.
1056 ${srcdir}/info/dir: ${info_dir_deps}
1057 $(AM_V_at)${MKDIR_P} ${srcdir}/info
1058 $(AM_V_GEN)(cd ${srcdir}/doc && \
1059 AWK='${AWK}' ../build-aux/make-info-dir ${info_dir_inputs} \
1060 ) >$@.tmp && mv $@.tmp $@
1062 INSTALL_DVI = install-emacs-dvi install-lispref-dvi \
1063 install-lispintro-dvi install-misc-dvi
1064 INSTALL_HTML = install-emacs-html install-lispref-html \
1065 install-lispintro-html install-misc-html
1066 INSTALL_PDF = install-emacs-pdf install-lispref-pdf \
1067 install-lispintro-pdf install-misc-pdf
1068 INSTALL_PS = install-emacs-ps install-lispref-ps \
1069 install-lispintro-ps install-misc-ps
1070 INSTALL_DOC = $(INSTALL_DVI) $(INSTALL_HTML) $(INSTALL_PDF) $(INSTALL_PS)
1072 ## Install non .info forms of the documentation.
1073 ## TODO add etc/refcards.
1074 $(INSTALL_DOC):
1075 $(MAKE) -C doc/$(subst -, install-,$(subst install-,,$@))
1077 .PHONY: $(INSTALL_DOC) install-doc
1078 .PHONY: install-dvi install-html install-pdf install-ps
1080 install-doc: $(INSTALL_DOC)
1081 install-dvi: $(INSTALL_DVI)
1082 install-html: $(INSTALL_HTML)
1083 install-pdf: $(INSTALL_PDF)
1084 install-ps: $(INSTALL_PS)
1087 UNINSTALL_DVI = uninstall-emacs-dvi uninstall-lispref-dvi \
1088 uninstall-lispintro-dvi uninstall-misc-dvi
1089 UNINSTALL_HTML = uninstall-emacs-html uninstall-lispref-html \
1090 uninstall-lispintro-html uninstall-misc-html
1091 UNINSTALL_PDF = uninstall-emacs-pdf uninstall-lispref-pdf \
1092 uninstall-lispintro-pdf uninstall-misc-pdf
1093 UNINSTALL_PS = uninstall-emacs-ps uninstall-lispref-ps \
1094 uninstall-lispintro-ps uninstall-misc-ps
1095 UNINSTALL_DOC = $(UNINSTALL_DVI) $(UNINSTALL_HTML) $(UNINSTALL_PDF) $(UNINSTALL_PS)
1097 $(UNINSTALL_DOC):
1098 $(MAKE) -C doc/$(subst -, uninstall-,$(subst uninstall-,,$@))
1100 .PHONY: $(UNINSTALL_DOC) uninstall-doc
1101 .PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps
1103 uninstall-doc: $(UNINSTALL_DOC)
1104 uninstall-dvi: $(UNINSTALL_DVI)
1105 uninstall-html: $(UNINSTALL_HTML)
1106 uninstall-pdf: $(UNINSTALL_PDF)
1107 uninstall-ps: $(UNINSTALL_PS)
1109 ## build-aux/make-info-dir expects only certain dircategories.
1110 check-info: info
1111 cd info ; \
1112 bad= ; \
1113 for file in *; do \
1114 test -f "$${file}" || continue ; \
1115 case $${file} in \
1116 *-[0-9]*|COPYING|dir) continue ;; \
1117 esac ; \
1118 cat=`sed -n 's/^INFO-DIR-SECTION //p' $${file}`; \
1119 case $${cat} in \
1120 "Texinfo documentation system" | "Emacs"| "Emacs lisp" | \
1121 "Emacs editing modes" | "Emacs network features" | \
1122 "Emacs misc features" | "Emacs lisp libraries" ) : ;; \
1123 *) bad="$${bad} $${file}" ;; \
1124 esac; \
1125 done ; \
1126 if test -n "$${bad}"; then \
1127 echo "Unexpected dircategory in: $${bad}" ; \
1128 exit 1 ; \
1129 fi ; \
1130 echo "info files are OK"
1132 #### Bootstrapping.
1134 ### This first cleans the lisp subdirectory, removing all compiled
1135 ### Lisp files. Then re-run make to build all the files anew.
1137 .PHONY: bootstrap
1139 # Bootstrapping does the following:
1140 # * Remove files to start from a bootstrap-clean slate.
1141 # * Run autogen.sh.
1142 # * Rebuild Makefile, to update the build procedure itself.
1143 # * Do the actual build.
1144 bootstrap: bootstrap-clean
1145 cd $(srcdir) && ./autogen.sh autoconf
1146 $(MAKE) MAKEFILE_NAME=force-Makefile force-Makefile
1147 $(MAKE) all
1149 .PHONY: ChangeLog change-history change-history-commit change-history-nocommit
1150 .PHONY: preferred-branch-is-current unchanged-history-files
1152 CHANGELOG = ChangeLog
1153 emacslog = build-aux/gitlog-to-emacslog
1154 # The ChangeLog history files are called ChangeLog.1, ChangeLog.2, ...,
1155 # ChangeLog.$(CHANGELOG_HISTORY_INDEX_MAX). $(CHANGELOG_N) stands for
1156 # the newest (highest-numbered) ChangeLog history file.
1157 CHANGELOG_HISTORY_INDEX_MAX = 3
1158 CHANGELOG_N = ChangeLog.$(CHANGELOG_HISTORY_INDEX_MAX)
1160 # Convert git commit log to ChangeLog file. make-dist uses this.
1161 # I guess this is PHONY so it always updates?
1162 ChangeLog:
1163 $(AM_V_GEN)cd $(srcdir) && \
1164 ./$(emacslog) -o $(CHANGELOG) -n $(CHANGELOG_HISTORY_INDEX_MAX)
1166 # Check that we are in a good state for changing history.
1167 PREFERRED_BRANCH = emacs-28
1168 preferred-branch-is-current:
1169 git branch | grep -q '^\* $(PREFERRED_BRANCH)$$'
1170 unchanged-history-files:
1171 x=$$(git diff-files --name-only $(CHANGELOG_N) $(emacslog)) && \
1172 test -z "$$x"
1174 # Regular expression that matches the newest commit covered by a ChangeLog.
1175 new_commit_regexp = ^commit [0123456789abcdef]* (inclusive)
1177 # Copy newer commit messages to the start of the ChangeLog history file,
1178 # and consider them to be older.
1179 change-history-nocommit: preferred-branch-is-current unchanged-history-files
1180 -rm -f ChangeLog.tmp
1181 $(MAKE) ChangeLog CHANGELOG=ChangeLog.tmp
1182 sed '/^This file records repository revisions/,$$d' \
1183 ChangeLog.tmp >$(CHANGELOG_N).tmp
1184 new_commit_line=`grep '$(new_commit_regexp)' ChangeLog.tmp` && \
1185 sed 's/$(new_commit_regexp).*/'"$$new_commit_line/" \
1186 $(CHANGELOG_N) >>$(CHANGELOG_N).tmp
1187 rm ChangeLog.tmp
1188 mv $(CHANGELOG_N).tmp $(CHANGELOG_N)
1190 change-history: change-history-nocommit
1191 $(MAKE) $@-commit
1193 # If 'make change-history' fails because the newest ChangeLog history
1194 # file contains invalid text, fix the file by hand and then run
1195 # 'make change-history-commit'.
1196 change-history-commit:
1197 git commit -m'; make $@' $(CHANGELOG_N) $(emacslog)
1199 .PHONY: check-declare
1201 check-declare:
1202 @if [ ! -f $(srcdir)/src/emacs ]; then \
1203 echo "You must build Emacs to use this command"; \
1204 exit 1; \
1206 $(MAKE) -C lisp $@
1207 $(MAKE) -C test $@
1209 .PHONY: gitmerge
1211 GITMERGE_EMACS = ./src/emacs${EXEEXT}
1212 GITMERGE_NMIN = 10
1214 gitmerge:
1215 ${GITMERGE_EMACS} -batch --no-site-file --no-site-lisp \
1216 -l ${srcdir}/admin/gitmerge.el \
1217 --eval '(setq gitmerge-minimum-missing ${GITMERGE_NMIN})' -f gitmerge