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