* files.el (basic-save-buffer): If file-precious-flag is set, and
[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 # make all to compile and build Emacs.
6 # make install to install it.
7 # make install.sysv to install on system V. Note that on system V you
8 # must change mandir to /usr/local/man/man1.
9 # make install.xenix to install on Xenix.
10 # make install.aix to install on AIX.
11 # make TAGS to update tags tables.
12 #
13 # make clean or make mostlyclean
14 # Delete all files from the current directory that are normally
15 # created by building the program. Don't delete the files that
16 # record the configuration. Also preserve files that could be made
17 # by building, but normally aren't because the distribution comes
18 # with them.
19 #
20 # Delete `.dvi' files here if they are not part of the distribution.
21 #
22 # make distclean
23 # Delete all files from the current directory that are created by
24 # configuring or building the program. If you have unpacked the
25 # source and built the program without creating any other files,
26 # `make distclean' should leave only the files that were in the
27 # distribution.
28 #
29 # make realclean
30 # Delete everything from the current directory that can be
31 # reconstructed with this Makefile. This typically includes
32 # everything deleted by distclean, plus more: C source files
33 # produced by Bison, tags tables, info files, and so on.
34 #
35 # make extraclean
36 # Still more severe - delete backup and autosave files, too.
37
38 SHELL = /bin/sh
39 MAKE = make # BSD doesn't have it as a default.
40
41 # ==================== Things `configure' Might Edit ====================
42
43 CC=cc
44 CONFIG_CFLAGS=-g
45
46 ### These help us choose version- and architecture-specific directories
47 ### to install files in.
48
49 ### This should be the number of the Emacs version we're building,
50 ### like `18.59' or `19.0'.
51 version=version-not-set
52
53 ### This should be the name of the configuration we're building Emacs
54 ### for, like `mips-dec-ultrix' or `sparc-sun-sunos'.
55 configname=configuration-name-not-set
56
57 # ==================== Where To Install Things ====================
58
59 # The default location for installation. Everything is placed in
60 # subdirectories of this directory. The default values for many of
61 # the variables below are expressed in terms of this one, so you may
62 # not need to change them.
63 prefix=/usr/local
64
65 # Like `prefix', but used for architecture-specific files.
66 exec_prefix=${prefix}
67
68 # Where to install Emacs and other binaries that people will want to
69 # run directly (like etags).
70 bindir=${exec_prefix}/bin
71
72 # Where to install architecture-independent data files. ${lispdir}
73 # and ${etcdir} are subdirectories of this.
74 datadir=${prefix}/lib
75
76 # Where to install and expect the files that Emacs modifies as it
77 # runs. These files are all architecture-independent. Right now, the
78 # only such data is the locking directory; ${lockdir} is a
79 # subdirectory of this.
80 statedir=${prefix}/lib
81
82 # Where to install and expect executable files to be run by Emacs
83 # rather than directly by users, and other architecture-dependent
84 # data. ${archlibdir} is a subdirectory of this.
85 libdir=${exec_prefix}/lib
86
87 # Where to install Emacs's man pages, and what extension they should have.
88 mandir=${prefix}/man/man1
89 manext=.1
90
91 # Where to install and expect the info files describing Emacs. In the
92 # past, this defaulted to a subdirectory of ${prefix}/lib/emacs, but
93 # since there are now many packages documented with the texinfo
94 # system, it is inappropriate to imply that it is part of Emacs.
95 infodir=${prefix}/info
96
97 # Where to find the source code - setting this to anything but
98 # . doesn't work yet. The source code for Emacs's C kernel is
99 # expected to be in ${srcdir}/src, and the source code for Emacs's
100 # utility programs is expected to be in ${srcdir}/lib-src. This is
101 # set by the configure script's `--srcdir' option.
102 srcdir=.
103
104 # ==================== Emacs-specific directories ====================
105
106 # These variables hold the values Emacs will actually use. They are
107 # based on the values of the standard Make variables above.
108
109 # Where to install the elisp files distributed with Emacs. This
110 # includes the Emacs version, so that the lisp files for different
111 # versions of Emacs will install themselves in separate directories.
112 lispdir=${datadir}/emacs/${version}/lisp
113
114 # Where to install the elisp files which are distributed with Emacs
115 # but not maintained by the FSF. This includes the Emacs version, so
116 # that the lisp files for different versions of Emacs will install
117 # themselves in separate directories.
118 externallispdir=${datadir}/emacs/${version}/external-lisp
119
120 # Directories Emacs should search for elisp files specific to this
121 # site (i.e. customizations), before consulting ${lispdir}. This
122 # should be a colon-separated list of directories.
123 locallisppath=${datadir}/emacs/site-lisp
124
125 # Where Emacs will search to find its elisp files. Before changing
126 # this, check to see if your purpose wouldn't better be served by
127 # changing locallisppath. This should be a colon-separated list of
128 # directories.
129 lisppath=${locallisppath}:${lispdir}
130
131 # Where Emacs will search for its elisp files while building. This is
132 # only used during the process of compiling Emacs, to help Emacs find
133 # its lisp files before they've been installed in their final
134 # location. It's usually identical to lisppath, except that the entry
135 # for the directory containing the installed lisp files has been
136 # replaced with ../lisp. This should be a colon-separated list of
137 # directories.
138 buildlisppath=../lisp
139
140 # Where to install the other architecture-independent data files
141 # distributed with Emacs (like the tutorial, the cookie recipes and
142 # the Zippy database). This path usually contains the Emacs version
143 # number, so the data files for multiple versions of Emacs may be
144 # installed at once.
145 etcdir=${datadir}/emacs/${version}/etc
146
147 # Where to create and expect the locking directory, where the Emacs
148 # locking code keeps track of which files are currently being edited.
149 lockdir=${statedir}/emacs/lock
150
151 # Where to put executables to be run by Emacs rather than the user.
152 # This path usually includes the Emacs version and configuration name,
153 # so that multiple configurations for multiple versions of Emacs may
154 # be installed at once.
155 archlibdir=${libdir}/emacs/${version}/${configname}
156
157 # ==================== Utility Programs for the Build ====================
158
159 # Allow the user to specify the install program.
160 INSTALL = install
161 INSTALLFLAGS = -c
162 INSTALL_PROGRAM = ${INSTALL}
163 INSTALL_DATA = ${INSTALL}
164
165 # ============================= Targets ==============================
166
167 # Flags passed down to subdirectory makefiles.
168 MFLAGS =
169
170 CFLAGS=${CONFIG_CFLAGS}
171
172 # Subdirectories to make recursively. `lisp' is not included
173 # because the compiled lisp files are part of the distribution
174 # and you cannot remake them without installing Emacs first.
175 SUBDIR = lib-src src
176
177 # The makefiles of the directories in $SUBDIR.
178 SUBDIR_MAKEFILES = lib-src/Makefile src/Makefile
179
180 # Subdirectories to install, and where they'll go.
181 # lib-src's makefile knows how to install it, so we don't do that here.
182 # When installing the info files, we need to do special things to
183 # avoid nuking an existing dir file, so we don't do that here;
184 # instead, we have written out explicit code in the `install' targets.
185 COPYDIR = etc ${srcdir}/lisp ${srcdir}/external-lisp
186 COPYDESTS = ${etcdir} ${lispdir} ${externallispdir}
187
188 all: src/paths.h ${SUBDIR}
189
190 removenullpaths=sed -e 's/^://' -e 's/:$$//' -e 's/::/:/'
191
192 # We force the rebuilding of src/paths.h because the user might give
193 # make different values for the various directories. Since we use
194 # move-if-change, src/paths.h only actually changes if the user did
195 # something notable, so the only unnecessary work we do is in building
196 # src/paths.h.tmp, which isn't much.
197 # Note that sed is not in /bin on 386bsd.
198 src/paths.h: Makefile ${srcdir}/src/paths.h.in FRC
199 lisppath=`echo ${lisppath} | ${removenullpaths}` ; \
200 buildlisppath=`echo ${buildlisppath} | ${removenullpaths}` ; \
201 sed < ${srcdir}/src/paths.h.in > src/paths.h.tmp \
202 -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "'$${lisppath}'";' \
203 -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'$${buildlisppath}'";' \
204 -e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";' \
205 -e 's;\(#.*PATH_DATA\).*$$;\1 "${etcdir}";' \
206 -e 's;\(#.*PATH_LOCK\).*$$;\1 "${lockdir}/";'
207 ${srcdir}/move-if-change src/paths.h.tmp src/paths.h
208
209 src: lib-src
210
211 .RECURSIVE: ${SUBDIR}
212
213 ${SUBDIR}: ${SUBDIR_MAKEFILES} FRC
214 cd $@; $(MAKE) all ${MFLAGS} \
215 CC='${CC}' CONFIG_CFLAGS='${CONFIG_CFLAGS}' \
216 srcdir='${srcdir}/$@' libdir='${libdir}'
217
218 ## We build the makefiles for the subdirectories here so that we can
219 ## edit the values for the path variables into them. This means that
220 ## when the user has built them from this makefile once, they will use
221 ## the right default values for the path variables.
222 lib-src/Makefile: ${srcdir}/lib-src/Makefile.in Makefile
223 echo "Producing \`lib-src/Makefile' from \`${srcdir}/lib-src/Makefile.in'."
224 rm -f lib-src/Makefile.tmp
225 (echo "# This file is generated from \`${srcdir}/lib-src/Makefile.in'." ; \
226 echo "# If you are thinking about editing it, you should seriously consider" ; \
227 echo "# running \`make lib-src/Makefile' at the top of the" ; \
228 echo "# Emacs build tree instead, or editing" ; \
229 echo "# \`${srcdir}/lib-src/Makefile.in' itself." ; \
230 /bin/sed < ${srcdir}/lib-src/Makefile.in \
231 -e 's|^\(version *=\).*$$|\1'"${version}"'|' \
232 -e 's|^\(configname *=\).*$$|\1'"${configname}"'|' \
233 -e 's|^\(prefix *=\).*$$|\1'"${prefix}"'|' \
234 -e 's|^\(exec_prefix *=\).*$$|\1'"${exec_prefix}"'|' \
235 -e 's|^\(libdir *=\).*$$|\1'"${libdir}"'|' \
236 -e 's|^\(srcdir *=\).*$$|\1'"${srcdir}"'|' \
237 -e 's|^\(archlibdir *=\).*$$|\1'"${archlibdir}"'|' \
238 -e 's|^CC *=.*$$|CC='"${CC}"'|' \
239 -e 's|^CONFIG_CFLAGS *=.*$$|CONFIG_CFLAGS='"${CONFIG_CFLAGS}"'|' \
240 -e 's|^LOADLIBES *=.*$$|LOADLIBES='"${libsrc_libs}"'|' \
241 -e '/^# DIST: /d') > lib-src/Makefile.tmp
242 ${srcdir}/move-if-change lib-src/Makefile.tmp lib-src/Makefile
243 chmod -w lib-src/Makefile
244
245 src/Makefile: ${srcdir}/src/Makefile.in Makefile
246 echo "Producing \`src/Makefile' from \`${srcdir}/src/Makefile.in'."
247 rm -f src/Makefile.tmp
248 (echo "# This file is generated from \`${srcdir}/src/Makefile.in'." ; \
249 echo "# If you are thinking about editing it, you should seriously consider" ; \
250 echo "# running \`make src/Makefile' at the top of the" ; \
251 echo "# Emacs build tree instead, or editing" ; \
252 echo "# \`${srcdir}/src/Makefile.in' itself." ; \
253 /bin/sed < ${srcdir}/src/Makefile.in \
254 -e 's|^\(srcdir *=\).*$$|\1'"${srcdir}"'|' \
255 -e 's|^CC *=.*$$|CC='"${CC}"'|' \
256 -e 's|^CONFIG_CFLAGS *=.*$$|CONFIG_CFLAGS='"${CONFIG_CFLAGS}"'|' \
257 -e '/^# DIST: /d') > src/Makefile.tmp
258 ${srcdir}/move-if-change src/Makefile.tmp src/Makefile
259 chmod -w src/Makefile
260
261 oldXMenu/Makefile: ${srcdir}/oldXMenu/Makefile Makefile
262 echo "Producing \`src/Makefile' from \`${srcdir}/src/Makefile.in'."
263 rm -f src/Makefile.tmp
264 cp "${srcdir}"/oldXMenu/Makefile oldXMenu/Makefile
265
266
267 Makefile:
268 ./config.status
269
270 # ==================== Installation ====================
271
272 ## If we let lib-src do its own installation, that means we
273 ## don't have to duplicate the list of utilities to install in
274 ## this Makefile as well.
275 install: all mkdir
276 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
277 -set ${COPYDESTS} ; \
278 for dir in ${COPYDIR} ; do \
279 dest=$$1 ; shift ; \
280 if [ `(cd $${dir}; /bin/pwd)` != `(cd $${dest}; /bin/pwd)` ]; then \
281 (cd $${dir}; tar cf - . ) | (cd $${dest}; umask 0; tar xf - ) ; \
282 for subdir in `find $${dest} -type d ! -name RCS -print` ; do \
283 rm -rf $${subdir}/RCS ; \
284 rm -rf $${subdir}/CVS ; \
285 rm -f $${subdir}/\#* ; \
286 rm -f $${subdir}/*~ ; \
287 done ; \
288 fi ; \
289 done
290 -(cd info ; \
291 if [ ! -f ${infodir}/dir ]; then \
292 ${INSTALL_DATA} ${INSTALLFLAGS} -m 444 ./dir ${infodir}/dir ; \
293 fi ; \
294 if [ "`echo *.info*`" != "*.info*" ]; then \
295 for f in *.info* ; do \
296 ${INSTALL_DATA} ${INSTALLFLAGS} -m 444 $$f ${infodir}/$$f ; \
297 done ; \
298 fi)
299 for page in emacs etags ctags ; do \
300 ${INSTALL_DATA} ${INSTALLFLAGS} -m 444 etc/$${page}.1 \
301 ${mandir}/$${page}${manext} ; \
302 done
303 ${INSTALL_PROGRAM} ${INSTALLFLAGS} -m 1755 src/emacs \
304 ${bindir}/emacs-${version}
305 -rm -f ${bindir}/emacs
306 ln ${bindir}/emacs-${version} ${bindir}/emacs
307
308 ## If we let lib-src do its own installation, that means we
309 ## don't have to duplicate the list of utilities to install in
310 ## this Makefile as well.
311 install.sysv: all mkdir
312 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
313 -set ${COPYDESTS} ; \
314 for dir in ${COPYDIR} ; do \
315 dest=$$1 ; shift ; \
316 if [ `/bin/pwd`/$${dir} != `(cd $${dest}; /bin/pwd)` ] ; then \
317 (cd $${dir}; find . -print | cpio -pdum $${dest} ) ; \
318 for subdir in `find $${dest} -type d ! -name RCS -print` ; do \
319 rm -rf $${subdir}/RCS ; \
320 rm -rf $${subdir}/CVS ; \
321 rm -f $${subdir}/\#* ; \
322 rm -f $${subdir}/*~ ; \
323 done ; \
324 fi ; \
325 done
326 -(cd info ; \
327 if [ ! -f ${infodir}/dir ]; then \
328 cpset ./dir ${infodir} 444 bin bin ; \
329 fi ; \
330 if [ "`echo *.info*`" != "*.info*" ]; then \
331 for f in *.info* ; do \
332 cpset $$f ${infodir} 444 bin bin ; \
333 done ; \
334 fi)
335 -for page in emacs etags ctags ; do \
336 cpset etc/$${page}.1 ${mandir}/$${page}${manext} 444 bin bin ; \
337 done
338 -/bin/rm -f ${bindir}/emacs
339 -cpset src/emacs ${bindir}/emacs-${version} 1755 bin bin
340 -ln ${bindir}/emacs-${version} ${bindir}/emacs
341
342 ## If we let lib-src do its own installation, that means we
343 ## don't have to duplicate the list of utilities to install in
344 ## this Makefile as well.
345 install.xenix: all mkdir
346 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
347 -set ${COPYDESTS} ; \
348 for dir in ${COPYDIR} ; do \
349 dest=$$1 ; shift ; \
350 if [ `/bin/pwd`/$${dir} != `(cd $${dest}; /bin/pwd)` ] ; then \
351 (cd $${dir}; tar cf - . ) | (cd $${dest}; umask 0; tar xpf - ) ; \
352 for subdir in `find $${dest} -type d ! -name RCS -print` ; do \
353 rm -rf $${subdir}/RCS ; \
354 rm -rf $${subdir}/CVS ; \
355 rm -f $${subdir}/\#* ; \
356 rm -f $${subdir}/*~ ; \
357 done ; \
358 fi ; \
359 done
360 -(cd info ; \
361 if [ ! -f ${infodir}/dir ]; then \
362 cp ./dir ${infodir} ; \
363 chmod 444 ${infodir}/dir ; \
364 fi ; \
365 if [ "`echo *.info*`" != "*.info*" ]; then \
366 for f in *.info* ; do \
367 cp $$f ${infodir} ; \
368 chmod 444 ${infodir}/$$f ; \
369 done ; \
370 fi)
371 for page in emacs etags ctags ; do \
372 cp etc/$${page}.1 ${mandir}/$${page}${manext} ; \
373 chmod 444 ${mandir}/$${page}${manext} ; \
374 done
375 -mv -f ${bindir}/emacs ${bindir}/emacs.old
376 cp src/emacs ${bindir}/emacs-${version}
377 ln ${bindir}/emacs-${version} ${bindir}/emacs
378 chmod 1755 ${bindir}/emacs
379 -rm -f ${bindir}/emacs.old
380
381 ## If we let lib-src do its own installation, that means we
382 ## don't have to duplicate the list of utilities to install in
383 ## this Makefile as well.
384 install.aix: all mkdir
385 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
386 -set ${COPYDESTS} ; \
387 for dir in ${COPYDIR} ; do \
388 dest=$$1 ; shift ; \
389 if [ `/bin/pwd`/$${dir} != `(cd $${dest}; /bin/pwd)` ] ; then \
390 (cd $${dir}; tar cf - . ) | (cd $${dest}; umask 0; tar xBf - ) ; \
391 for subdir in `find $${dest} -type d ! -name RCS -print` ; do \
392 rm -rf $${subdir}/RCS ; \
393 rm -rf $${subdir}/CVS ; \
394 rm -f $${subdir}/\#* ; \
395 rm -f $${subdir}/*~ ; \
396 done ; \
397 fi ; \
398 done
399 -(cd info ; \
400 if [ ! -f ${infodir}/dir ]; then \
401 ${INSTALL_DATA} ${INSTALLFLAGS} -M 444 -f ${infodir} ./dir ; \
402 fi ; \
403 if [ "`echo *.info*`" != "*.info*" ]; then \
404 for f in *.info* ; do \
405 ${INSTALL_DATA} ${INSTALLFLAGS} -M 444 -f ${infodir} $$f ; \
406 done ; \
407 fi)
408 ${INSTALL_PROGRAM} ${INSTALLFLAGS} -M 1755 -f ${bindir} src/emacs
409 mv ${bindir}/emacs ${bindir}/emacs-${version}
410 for page in emacs etags ctags ; do \
411 ${INSTALL_DATA} ${INSTALLFLAGS} -M 444 -f ${mandir} etc/$${page}.1 ;\
412 done
413 -rm -f ${bindir}/emacs
414 ln ${bindir}/emacs-${version} ${bindir}/emacs
415
416 ### Build all the directories we're going to install Emacs in. Since
417 ### we may be creating several layers of directories (for example,
418 ### /usr/local/lib/emacs/19.0/mips-dec-ultrix4.2), we use make-path
419 ### instead of mkdir. Not all systems' mkdirs have the `-p' flag.
420 mkdir: FRC
421 ./lib-src/make-path ${COPYDESTS} ${lockdir}
422 chmod 777 ${COPYDESTS} ${lockdir}
423
424 FRC:
425
426
427 # ==================== Cleaning up and miscellanea ====================
428
429 ### `clean'
430 ### Delete all files from the current directory that are normally
431 ### created by building the program. Don't delete the files that
432 ### record the configuration. Also preserve files that could be made
433 ### by building, but normally aren't because the distribution comes
434 ### with them.
435 ### `mostlyclean'
436 ### Like `clean', but may refrain from deleting a few files that
437 ### people normally don't want to recompile. For example, the
438 ### `mostlyclean' target for GCC does not delete `libgcc.a', because
439 ### recompiling it is rarely necessary and takes a lot of time.
440 ###
441 clean mostlyclean:
442 cd src; $(MAKE) clean
443 cd lib-src; $(MAKE) clean
444 cd oldXMenu; $(MAKE) clean
445 if [ `(cd ${etcdir} ; /bin/pwd` != `(cd etc; /bin/pwd)` ] ; then \
446 cd etc; $(MAKE) clean; \
447 else true; \
448 fi
449
450 ### `distclean'
451 ### Delete all files from the current directory that are created by
452 ### configuring or building the program. This should leave only the
453 ### files that would be in the distribution.
454 distclean:
455 for i in ${SUBDIR}; do (cd $$i; $(MAKE) ${MFLAGS} distclean); done
456 -(cd lock; rm *)
457 -rm config.status config-tmp-*
458
459 ### `realclean'
460 ### Delete everything from the current directory that can be
461 ### reconstructed with this makefile. This typically includes
462 ### everything deleted by distclean, plus more: C source files
463 ### produced by Bison, tags tables, info files, and so on.
464 realclean:
465 for i in ${SUBDIR}; do (cd $$i; $(MAKE) ${MFLAGS} realclean); done
466 (cd lock; rm *)
467 rm config.status
468
469 ### This doesn't actually appear in the coding standards, but Karl
470 ### says GCC supports it, and that's where the configuration part of
471 ### the coding standards seem to come from. It's like distclean, but
472 ### it deletes backup and autosave files too.
473 extraclean:
474 for i in ${SUBDIR}; do (cd $$i; $(MAKE) ${MFLAGS} extraclean); done
475 -(cd lock; rm *)
476 -rm config.status config-tmp-*
477 -rm -f *~ \#*
478
479
480 TAGS tags: lib-src
481 (cd ${srcdir} ; lib-src/etags --output=./src/TAGS \
482 src/*.[ch] lisp/*.el lisp/term/*.el)
483
484 check:
485 @echo "We don't have any tests for GNU Emacs yet."
486
487 dist:
488 cd ${srcdir}; make-dist