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