Makefile.in 27.6 KB
Newer Older
Jim Blandy's avatar
Jim Blandy committed
1 2 3
# DIST: This is the distribution Makefile for Emacs.  configure can
# DIST: make most of the changes to this file you might want, so try
# DIST: that first.
Jim Blandy's avatar
Jim Blandy committed
4

Gerd Moellmann's avatar
Gerd Moellmann committed
5
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
6
#  2000, 2001, 2002 Free Software Foundation, Inc.
Gerd Moellmann's avatar
Gerd Moellmann committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

# This file is part of GNU Emacs.

# GNU Emacs is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

Jim Blandy's avatar
Jim Blandy committed
25 26
# make all	to compile and build Emacs.
# make install	to install it.
27
# make TAGS	to update tags tables.
Jim Blandy's avatar
Jim Blandy committed
28
#
29 30
# make clean  or  make mostlyclean
#      Delete all files from the current directory that are normally
31
#      created by building the program.	 Don't delete the files that
32 33 34 35 36
#      record the configuration.  Also preserve files that could be made
#      by building, but normally aren't because the distribution comes
#      with them.
#
#      Delete `.dvi' files here if they are not part of the distribution.
37
#
38 39 40 41 42 43
# make distclean
#      Delete all files from the current directory that are created by
#      configuring or building the program.  If you have unpacked the
#      source and built the program without creating any other files,
#      `make distclean' should leave only the files that were in the
#      distribution.
44
#
45
# make maintainer-clean
46 47 48 49 50 51 52
#      Delete everything from the current directory that can be
#      reconstructed with this Makefile.  This typically includes
#      everything deleted by distclean, plus more: C source files
#      produced by Bison, tags tables, info files, and so on.
#
# make extraclean
#      Still more severe - delete backup and autosave files, too.
Jim Blandy's avatar
Jim Blandy committed
53 54

SHELL = /bin/sh
55 56 57

# If Make doesn't predefine MAKE, set it here.
@SET_MAKE@
Jim Blandy's avatar
Jim Blandy committed
58

59
# ==================== Things `configure' Might Edit ====================
Jim Blandy's avatar
Jim Blandy committed
60

61
CC=@CC@
62
CPP=@CPP@
63
C_SWITCH_SYSTEM=@c_switch_system@
64
ALLOCA=@ALLOCA@
65 66
LN_S=@LN_S@
CFLAGS=@CFLAGS@
67
LDFLAGS=@LDFLAGS@
68
CPPFLAGS=@CPPFLAGS@
69
C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
Jim Blandy's avatar
Jim Blandy committed
70
LD_SWITCH_X_SITE=@LD_SWITCH_X_SITE@
Jim Blandy's avatar
Jim Blandy committed
71
YACC=@YACC@
72 73 74 75 76 77

### These help us choose version- and architecture-specific directories
### to install files in.

### This should be the number of the Emacs version we're building,
### like `18.59' or `19.0'.
78
version=@version@
79 80 81

### This should be the name of the configuration we're building Emacs
### for, like `mips-dec-ultrix' or `sparc-sun-sunos'.
82 83
configuration=@configuration@

84 85
# ==================== Where To Install Things ====================

Jim Blandy's avatar
Jim Blandy committed
86
# The default location for installation.  Everything is placed in
87 88
# subdirectories of this directory.  The default values for many of
# the variables below are expressed in terms of this one, so you may
89 90
# not need to change them.  This defaults to /usr/local.
prefix=@prefix@
Jim Blandy's avatar
Jim Blandy committed
91

92
# Like `prefix', but used for architecture-specific files.
93
exec_prefix=@exec_prefix@
94

Jim Blandy's avatar
Jim Blandy committed
95 96
# Where to install Emacs and other binaries that people will want to
# run directly (like etags).
97
bindir=@bindir@
Jim Blandy's avatar
Jim Blandy committed
98

99
# Where to install architecture-independent data files.	 ${lispdir}
100
# and ${etcdir} are subdirectories of this.
101
datadir=@datadir@
102 103

# Where to install and expect the files that Emacs modifies as it
104 105
# runs.  These files are all architecture-independent.
# Right now, this is not used.
106
sharedstatedir=@sharedstatedir@
107 108 109

# Where to install and expect executable files to be run by Emacs
# rather than directly by users, and other architecture-dependent
110
# data.	 ${archlibdir} is a subdirectory of this.
111
libexecdir=@libexecdir@
112 113

# Where to install Emacs's man pages, and what extension they should have.
114
mandir=@mandir@
115
manext=.1
116
man1dir=$(mandir)/man1
117 118 119 120 121

# Where to install and expect the info files describing Emacs.	In the
# past, this defaulted to a subdirectory of ${prefix}/lib/emacs, but
# since there are now many packages documented with the texinfo
# system, it is inappropriate to imply that it is part of Emacs.
122
infodir=@infodir@
Jim Blandy's avatar
Jim Blandy committed
123

124 125 126
# Directory for local state files for all programs.
localstatedir=@localstatedir@

127 128 129
# Where to look for bitmap files.
bitmapdir=@bitmapdir@

130
# Where to find the source code.  The source code for Emacs's C kernel is
131 132 133
# expected to be in ${srcdir}/src, and the source code for Emacs's
# utility programs is expected to be in ${srcdir}/lib-src.  This is
# set by the configure script's `--srcdir' option.
Richard M. Stallman's avatar
Richard M. Stallman committed
134 135

# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
136
srcdir=@srcdir@
Jim Blandy's avatar
Jim Blandy committed
137

Roland McGrath's avatar
Roland McGrath committed
138 139 140
# Tell make where to find source files; this is needed for the makefiles.
VPATH=@srcdir@

141 142 143
# Where to find the application default.
x_default_search_path=@x_default_search_path@

144 145 146
# Location to install Emacs.app on Mac OS X
carbon_appdir=@carbon_appdir@

147 148
# ==================== Emacs-specific directories ====================

149 150 151
# These variables hold the values Emacs will actually use.  They are
# based on the values of the standard Make variables above.

152 153 154 155 156
# Where to install the lisp files distributed with
# Emacs.  This includes the Emacs version, so that the
# lisp files for different versions of Emacs will install
# themselves in separate directories.
lispdir=@lispdir@
157

158 159 160 161 162
# Directories Emacs should search for lisp files specific
# to this site (i.e. customizations), before consulting
# ${lispdir}.  This should be a colon-separated list of
# directories.
locallisppath=@locallisppath@
163 164 165 166

# Where Emacs will search to find its lisp files.  Before
# changing this, check to see if your purpose wouldn't
# better be served by changing locallisppath.  This
Jim Blandy's avatar
Jim Blandy committed
167
# should be a colon-separated list of directories.
168
lisppath=@lisppath@
Jim Blandy's avatar
Jim Blandy committed
169

170 171 172 173
# Where Emacs will search for its lisp files while
# building.  This is only used during the process of
# compiling Emacs, to help Emacs find its lisp files
# before they've been installed in their final location.
174
# It's usually identical to lisppath, except that
Richard M. Stallman's avatar
Richard M. Stallman committed
175
# it does not include locallisppath, and the
176 177 178
# entry for the directory containing the installed lisp
# files has been replaced with ../lisp.  This should be a
# colon-separated list of directories.
179
buildlisppath=${srcdir}/lisp
Jim Blandy's avatar
Jim Blandy committed
180

181 182 183 184 185 186 187 188 189 190 191 192 193 194
# Where to install the other architecture-independent
# data files distributed with Emacs (like the tutorial,
# the cookie recipes and the Zippy database). This path
# usually contains the Emacs version number, so the data
# files for multiple versions of Emacs may be installed
# at once.
etcdir=@etcdir@

# Where to put executables to be run by Emacs rather than
# the user.  This path usually includes the Emacs version
# and configuration name, so that multiple configurations
# for multiple versions of Emacs may be installed at
# once.
archlibdir=@archlibdir@
195

196 197 198
# Where to put the docstring file.
docdir=@docdir@

199 200 201
# Where to install Emacs game score files.
gamedir=@gamedir@

Jim Blandy's avatar
Jim Blandy committed
202 203 204
# ==================== Utility Programs for the Build ====================

# Allow the user to specify the install program.
205
INSTALL = @INSTALL@
206 207
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
208
INSTALL_INFO = @INSTALL_INFO@
209 210
# By default, we uphold the dignity of our programs.
INSTALL_STRIP =
Jim Blandy's avatar
Jim Blandy committed
211 212

# ============================= Targets ==============================
Jim Blandy's avatar
Jim Blandy committed
213

214 215 216
# Program name transformation.
TRANSFORM = @program_transform_name@

217
# What emacs should be called when installed.
Juanma Barranquero's avatar
Juanma Barranquero committed
218 219
EMACS = `echo emacs@EXEEXT@ | sed '$(TRANSFORM)'`
EMACSFULL = `echo emacs-${version}@EXEEXT@ | sed '$(TRANSFORM)'`
220

Jim Blandy's avatar
Jim Blandy committed
221
# Subdirectories to make recursively.  `lisp' is not included
222
# because the compiled lisp files are part of the distribution.
Gerd Moellmann's avatar
Gerd Moellmann committed
223 224
# leim is not included because it needs special handling.
SUBDIR = lib-src src
Jim Blandy's avatar
Jim Blandy committed
225

226
# The makefiles of the directories in $SUBDIR.
227
SUBDIR_MAKEFILES = lib-src/Makefile man/Makefile lispref/Makefile lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile
228

229 230
# Subdirectories to install, and where they'll go.
# lib-src's makefile knows how to install it, so we don't do that here.
Kenichi Handa's avatar
Kenichi Handa committed
231
# leim's makefile also knows how to install it, so we don't do that here.
232 233 234
# When installing the info files, we need to do special things to
# avoid nuking an existing dir file, so we don't do that here;
# instead, we have written out explicit code in the `install' targets.
235 236
COPYDIR = ${srcdir}/etc ${srcdir}/lisp
COPYDESTS = ${etcdir} ${lispdir}
Jim Blandy's avatar
Jim Blandy committed
237

Andreas Schwab's avatar
Andreas Schwab committed
238
# Set to FRC to force running autoconf and autoheader
239
MAINT =
Andreas Schwab's avatar
Andreas Schwab committed
240

241
all: ${SUBDIR} leim
Jim Blandy's avatar
Jim Blandy committed
242

243
removenullpaths=sed -e 's/^://g' -e 's/:$$//g' -e 's/::/:/g'
Jim Blandy's avatar
Jim Blandy committed
244

245 246
# Generate epaths.h from epaths.in.  This target is invoked by `configure'.
epaths-force: FRC
247 248
	@(lisppath=`echo ${lisppath} | ${removenullpaths}` ;		\
	  buildlisppath=`echo ${buildlisppath} | ${removenullpaths}` ;	\
249
	  x_default_search_path=`echo ${x_default_search_path}`; \
250
	  gamedir=`echo ${gamedir}`; \
251
	  sed < ${srcdir}/src/epaths.in > epaths.h.$$$$		\
252 253 254 255 256
	  -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "'$${lisppath}'";'	\
	  -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'$${buildlisppath}'";' \
	  -e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";'		\
	  -e 's;\(#.*PATH_INFO\).*$$;\1 "${infodir}";'			\
	  -e 's;\(#.*PATH_DATA\).*$$;\1 "${etcdir}";'			\
257
	  -e 's;\(#.*PATH_BITMAPS\).*$$;\1 "${bitmapdir}";'		\
258
	  -e 's;\(#.*PATH_X_DEFAULTS\).*$$;\1 "${x_default_search_path}";' \
259
	  -e 's;\(#.*PATH_GAME\).*$$;\1 "${gamedir}";' \
Richard M. Stallman's avatar
Richard M. Stallman committed
260
	  -e 's;\(#.*PATH_DOC\).*$$;\1 "${docdir}";') &&		\
261
	${srcdir}/move-if-change epaths.h.$$$$ src/epaths.h
262

263
# For parallel make, src should be build before leim.
Gerd Moellmann's avatar
Gerd Moellmann committed
264 265 266 267 268 269 270
# "export PARALLEL=0" is for SGI's Make, to prevent it from
# running more than 1 process in the leim directory, especially for
# the $TIT files there.
leim:   src ${SUBDIR_MAKEFILES} FRC
	(export PARALLEL; PARALLEL=0; cd $@; $(MAKE) all $(MFLAGS) \
	  CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
	  LDFLAGS='${LDFLAGS}' MAKE='${MAKE}')
271

272
src:	lib-src FRC
273

274
lib-src: FRC src/config.stamp
Jim Blandy's avatar
Jim Blandy committed
275

Gerd Moellmann's avatar
Gerd Moellmann committed
276
.RECURSIVE: ${SUBDIR} leim
Jim Blandy's avatar
Jim Blandy committed
277

278
${SUBDIR}: maybe_bootstrap ${SUBDIR_MAKEFILES} FRC
279
	cd $@; $(MAKE) all $(MFLAGS) \
280 281
	  CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
	  LDFLAGS='${LDFLAGS}' MAKE='${MAKE}'
282

283
blessmail: ${SUBDIR_MAKEFILES} src FRC
284 285
	cd lib-src; $(MAKE) maybe-blessmail $(MFLAGS) \
	  MAKE='${MAKE}' archlibdir='$(archlibdir)'
286

287
Makefile: $(srcdir)/Makefile.in config.status
288 289
	./config.status

290
config.status: ${srcdir}/configure
291 292
	./config.status --recheck

Andreas Schwab's avatar
Andreas Schwab committed
293
${srcdir}/configure: $(MAINT)
294 295
	cd ${srcdir} && autoconf

296 297
$(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in
	@true
Andreas Schwab's avatar
Andreas Schwab committed
298
$(srcdir)/src/stamp-h.in: $(MAINT)
299 300 301 302
	cd ${srcdir} && autoheader
	rm -f $(srcdir)/src/stamp-h.in
	echo timestamp > $(srcdir)/src/stamp-h.in

303
src/Makefile: $(srcdir)/src/Makefile.in config.status
304 305
	./config.status

306
src/config.stamp: $(srcdir)/src/config.in config.status
307
	./config.status
308
	touch src/config.stamp
309

310
lib-src/Makefile: $(srcdir)/lib-src/Makefile.in config.status
311 312
	./config.status

313
man/Makefile: $(srcdir)/man/Makefile.in config.status
314 315
	./config.status

316 317 318
lispref/Makefile: $(srcdir)/lispref/Makefile.in config.status
	./config.status

319 320 321
lispintro/Makefile: $(srcdir)/lispintro/Makefile.in config.status
	./config.status

322
oldXMenu/Makefile: $(srcdir)/oldXMenu/Makefile.in config.status
323 324
	./config.status

325
lwlib/Makefile: $(srcdir)/lwlib/Makefile.in config.status
326 327
	./config.status

328
leim/Makefile: $(srcdir)/leim/Makefile.in config.status
Kenichi Handa's avatar
Kenichi Handa committed
329 330
	./config.status

331 332
# ==================== Installation ====================

Jim Blandy's avatar
Jim Blandy committed
333 334 335
## If we let lib-src do its own installation, that means we
## don't have to duplicate the list of utilities to install in
## this Makefile as well.
336

337 338 339
## On AIX, use tar xBf.
## On Xenix, use tar xpf.

340
.PHONY: install mkdir
341

342 343 344 345 346
## We delete each directory in ${COPYDESTS} before we copy into it;
## that way, we can reinstall over directories that have been put in
## place with their files read-only (perhaps because they are checked
## into RCS).  In order to make this safe, we make sure that the
## source exists and is distinct from the destination.
347 348
### We do install-arch-indep first because
### the executable needs the Lisp files and DOC file to work properly.
Karl Heuer's avatar
Karl Heuer committed
349
install: all install-arch-indep install-arch-dep install-leim blessmail
350
	@true
351

352
### Install the executables that were compiled specifically for this machine.
353 354 355
### It would be nice to do something for a parallel make
### to ensure that install-arch-indep finishes before this starts.
install-arch-dep: mkdir
356
	(cd lib-src; \
357
	  $(MAKE) install $(MFLAGS) prefix=${prefix} \
358
	    exec_prefix=${exec_prefix} bindir=${bindir} \
359 360
	    libexecdir=${libexecdir} archlibdir=${archlibdir} \
	    INSTALL_STRIP=${INSTALL_STRIP})
Juanma Barranquero's avatar
Juanma Barranquero committed
361
	${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs@EXEEXT@ ${bindir}/$(EMACSFULL)
362
	-chmod 1755  ${bindir}/$(EMACSFULL)
363
	rm -f ${bindir}/$(EMACS)
364
	-ln ${bindir}/$(EMACSFULL) ${bindir}/$(EMACS)
365
	-unset CDPATH; \
366
	for f in `cd lib-src && echo fns-*.el`; do \
367 368 369
	  if test -r lib-src/$$f ; then \
	    ${INSTALL_DATA} lib-src/$$f ${archlibdir}/$$f; \
	  else true; fi ; \
370
	done
371 372 373 374 375 376
	if test "${carbon_appdir}" != ""; then \
	  umask 022; mkdir -p ${carbon_appdir}/Emacs.app; \
	  (cd mac/Emacs.app; tar -chf - . ) | \
		(cd ${carbon_appdir}/Emacs.app; umask 022; tar -xvf - \
			&& cat > /dev/null) || exit 1; \
	fi
377

378 379 380
### Install the files that are machine-independent.
### Most of them come straight from the distribution;
### the exception is the DOC-* files, which are copied
Kenichi Handa's avatar
Kenichi Handa committed
381
## from the build directory.
382

Kenichi Handa's avatar
Kenichi Handa committed
383 384
## Note that we copy DOC* and then delete DOC
## as a workaround for a bug in tar on Ultrix 4.2.
385 386 387

## If people complain about the h flag in tar command, take that out.
## That flag is also used in leim/Makefile.in
388
install-arch-indep: mkdir info
Jim Blandy's avatar
Jim Blandy committed
389
	-set ${COPYDESTS} ; \
390
	unset CDPATH; \
391 392 393 394 395 396
	for dir in ${COPYDIR} ; do \
	  if [ `(cd $$1 && /bin/pwd)` != `(cd $${dir} && /bin/pwd)` ] ; then \
	    rm -rf $$1 ; \
	  fi ; \
	  shift ; \
	done
397
	-set ${COPYDESTS} ; \
398 399
	mkdir ${COPYDESTS} ; \
	chmod ugo+rx ${COPYDESTS} ; \
400
	unset CDPATH; \
401 402 403 404 405
	for dir in ${COPYDIR} ; do \
	  dest=$$1 ; shift ; \
	  [ -d $${dir} ] \
	  && [ `(cd $${dir} && /bin/pwd)` != `(cd $${dest} && /bin/pwd)` ] \
	  && (echo "Copying $${dir} to $${dest}..." ; \
406
	      (cd $${dir}; tar -chf - . ) \
407 408
		| (cd $${dest}; umask 022; \
                   tar -xvf - && cat > /dev/null) || exit 1; \
Juanma Barranquero's avatar
Juanma Barranquero committed
409
	      find $${dest} -exec chown $${LOGNAME:-$$USERNAME} {} ';' ;\
410
	      for subdir in `find $${dest} -type d ! -name RCS ! -name CVS -print` ; do \
411
		chmod a+rx $${subdir} ; \
412 413
		rm -rf $${subdir}/RCS ; \
		rm -rf $${subdir}/CVS ; \
414
		rm -f  $${subdir}/.cvsignore ; \
415 416 417 418 419 420 421 422 423
		rm -f  $${subdir}/\#* ; \
		rm -f  $${subdir}/.\#* ; \
		rm -f  $${subdir}/*~ ; \
		rm -f  $${subdir}/*.orig ; \
		rm -f  $${subdir}/[mM]akefile* ; \
		rm -f  $${subdir}/ChangeLog* ; \
		rm -f  $${subdir}/dired.todo ; \
	      done) ; \
	done
424
	-rm -f ${lispdir}/subdirs.el
425
	$(srcdir)/update-subdirs ${lispdir}
426 427 428 429 430
	if [ -f ${datadir}/emacs/${version}/site-lisp/subdirs.el ]; \
	then true; \
	else \
	  (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
	   echo "    (normal-top-level-add-subdirs-to-load-path))") \
431
	    > ${datadir}/emacs/${version}/site-lisp/subdirs.el; \
432
	fi
433
	chmod a+r ${datadir}/emacs/${version}/site-lisp/subdirs.el
434
	-if [ -f ${datadir}/emacs/site-lisp/subdirs.el ]; \
435 436 437 438
	then true; \
	else \
	  (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
	   echo "    (normal-top-level-add-subdirs-to-load-path))") \
439
	    > ${datadir}/emacs/site-lisp/subdirs.el; \
440
	fi
441
	-chmod a+r ${datadir}/emacs/site-lisp/subdirs.el
442
	-unset CDPATH; \
443 444
	if [ `(cd ./etc; /bin/pwd)` != `(cd ${docdir}; /bin/pwd)` ]; \
	then \
Karl Heuer's avatar
Karl Heuer committed
445
	   echo "Copying etc/DOC-* to ${docdir} ..." ; \
446
	   (cd ./etc; tar -chf - DOC*) \
447
	     |(cd ${docdir}; umask 022; tar -xvf - && cat > /dev/null) || exit 1; \
Juanma Barranquero's avatar
Juanma Barranquero committed
448
	   (cd $(docdir); chown $${LOGNAME:-$$USERNAME} DOC*; chmod a+r DOC*; \
449
	    if test "`echo DOC-*`" != "DOC-*"; then rm DOC; fi); \
450
	else true; fi
451
	-unset CDPATH; \
452 453
	if [ -r ./lisp ] \
	   && [ -r ./lisp/simple.el ] \
454 455
	   && [ x`(cd ./lisp; /bin/pwd)` != x`(cd ${lispdir}; /bin/pwd)` ] \
	   && [ x`(cd ${srcdir}/lisp; /bin/pwd)` != x`(cd ./lisp; /bin/pwd)` ]; \
456 457
	then \
	   echo "Copying lisp/*.el and lisp/*.elc to ${lispdir} ..." ; \
458
	   (cd lisp; tar -chf - *.el *.elc) \
459
	     |(cd ${lispdir}; umask 022; tar -xvf - && cat > /dev/null) || exit 1; \
Juanma Barranquero's avatar
Juanma Barranquero committed
460
	   (cd ${lispdir}; find . -exec chown $${LOGNAME:-$$USERNAME} {} ';') ; \
461
	else true; fi
462
	-unset CDPATH; \
463
	thisdir=`/bin/pwd`; \
464
	if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \
465
	then \
466
	  (cd ${infodir};  \
467 468 469 470 471
	   if [ -f dir ]; then true; \
	   else	\
	     (cd $${thisdir}; \
	      ${INSTALL_DATA} ${srcdir}/info/dir ${infodir}/dir; \
	      chmod a+r ${infodir}/dir); \
472
	   fi; \
473
	   cd ${srcdir}/info ; \
474
	   for f in ada-mode* autotype* calc* ccmode* cl* dired-x* ebrowse* ediff* efaq* eintr* elisp* emacs* eshell* eudc* forms* gnus* idlwave* info* message* mh-e* pcl-cvs* reftex* sc* speedbar* tramp* vip* widget* woman*; do \
475 476
	     (cd $${thisdir}; \
	      ${INSTALL_DATA} ${srcdir}/info/$$f ${infodir}/$$f; \
477
	      chmod a+r ${infodir}/$$f); \
Richard M. Stallman's avatar
Richard M. Stallman committed
478
	   done); \
479
	else true; fi
480 481
	-unset CDPATH; \
	thisdir=`/bin/pwd`; \
482 483
	if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \
	then \
484
	  for f in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq elisp eintr emacs emacs-mime eshell eudc forms gnus idlwave info message mh-e pcl-cvs reftex sc speedbar tramp vip viper widget woman; do \
485
	    (cd $${thisdir}; \
486
	     ${INSTALL_INFO} --info-dir=${infodir} ${infodir}/$$f); \
487 488
	  done; \
	else true; fi
489
	-chmod -R a+r ${datadir}/emacs ${COPYDESTS} ${infodir}
490 491
	thisdir=`/bin/pwd`; \
	cd ${srcdir}/etc; \
492
	for page in emacs emacsclient etags ctags ; do \
493 494 495
	  (cd $${thisdir}; \
	   ${INSTALL_DATA} ${srcdir}/etc/$${page}.1 ${man1dir}/$${page}${manext}; \
	   chmod a+r ${man1dir}/$${page}${manext}); \
496
	done
Jim Blandy's avatar
Jim Blandy committed
497

Kenichi Handa's avatar
Kenichi Handa committed
498 499 500 501
### Install LEIM files.  Although they are machine-independent, we
### have separate target here instead of including it in
### `install-arch-indep'.  People who extracted LEIM files after they
### insalled Emacs itself can install only LEIM files by this target.
502
install-leim: leim/Makefile mkdir
503
	cd leim; $(MAKE) install
Kenichi Handa's avatar
Kenichi Handa committed
504

505 506
### Build Emacs and install it, stripping binaries while installing them.
install-strip:
507
	$(MAKE) INSTALL_STRIP=-s install
508

509
### Build all the directories we're going to install Emacs in.	Since
510
### we may be creating several layers of directories (for example,
511
### /usr/local/lib/emacs/19.0/mips-dec-ultrix4.2), we use mkinstalldirs
512
### instead of mkdir.  Not all systems' mkdir programs have the `-p' flag.
Richard M. Stallman's avatar
Richard M. Stallman committed
513
mkdir: FRC
514 515 516 517
	if [ -d ${datadir} ]; then true; else \
	  $(srcdir)/mkinstalldirs ${datadir}; \
	  chmod a+r ${datadir};\
	fi
518
	$(srcdir)/mkinstalldirs ${COPYDESTS} ${infodir} ${man1dir} \
519
	  ${bindir} ${docdir} ${libexecdir} \
520 521
	  ${datadir}/emacs/site-lisp \
	  ${datadir}/emacs/${version}/site-lisp \
522
	  `echo ${locallisppath} | sed 's/:/ /g'`
Jim Blandy's avatar
Jim Blandy committed
523

524 525 526
### Delete all the installed files that the `install' target would
### create (but not the noninstalled files such as `make all' would
### create).
527 528
###
### Don't delete the lisp and etc directories if they're in the source tree.
529
uninstall:
530
	(cd lib-src; 					\
531
	 $(MAKE) $(MFLAGS) uninstall			\
532
	    prefix=${prefix} exec_prefix=${exec_prefix}	\
533
	    bindir=${bindir} libexecdir=${libexecdir} archlibdir=${archlibdir})
534
	-unset CDPATH; \
535
	for dir in ${lispdir} ${etcdir} ; do 		\
536
	  if [ -d $${dir} ]; then			\
537 538
	    case `(cd $${dir} ; /bin/pwd)` in		\
	      `(cd ${srcdir} ; /bin/pwd)`* ) ;;		\
539 540 541 542 543 544 545 546
	      * ) rm -rf $${dir} ;;			\
	    esac ;					\
	    case $${dir} in				\
	      ${datadir}/emacs/${version}/* )		\
	        rm -rf ${datadir}/emacs/${version}	\
	      ;;					\
	    esac ;					\
	  fi ;						\
547
	done
548
	(cd ${archlibdir} && rm -f fns-*)
549
	-rm -rf ${libexecdir}/emacs/${version}
550
	(cd ${infodir} && rm -f cl* ada-mode* autotype* calc* ccmode* ebrowse* efaq* eintr elisp* eshell* eudc* idlwave* message* pcl-cvs* reftex* speedbar* tramp* widget* woman* dired-x* ediff* emacs* forms* gnus* info* mh-e* sc* vip*)
551
	(cd ${man1dir}  && rm -f emacs${manext} emacsclient${manext} etags${manext} ctags${manext})
552
	(cd ${bindir}  && rm -f $(EMACSFULL) $(EMACS))
553 554


Richard M. Stallman's avatar
Richard M. Stallman committed
555
FRC:
556 557 558

# ==================== Cleaning up and miscellanea ====================

559
.PHONY: mostlyclean clean distclean maintainer-clean extraclean
560

561
### `mostlyclean'
562 563 564 565
###      Like `clean', but may refrain from deleting a few files that people
###      normally don't want to recompile.  For example, the `mostlyclean'
###      target for GCC does not delete `libgcc.a', because recompiling it
###      is rarely necessary and takes a lot of time.
Richard M. Stallman's avatar
Richard M. Stallman committed
566
mostlyclean: FRC
567 568
	(cd src;      $(MAKE) $(MFLAGS) mostlyclean)
	(cd oldXMenu; $(MAKE) $(MFLAGS) mostlyclean)
569
	(cd lwlib;    $(MAKE) $(MFLAGS) mostlyclean)
570
	(cd lib-src;  $(MAKE) $(MFLAGS) mostlyclean)
571
	-(cd man &&   $(MAKE) $(MFLAGS) mostlyclean)
572
	-(cd lispref &&   $(MAKE) $(MFLAGS) mostlyclean)
573
	-(cd lispintro &&   $(MAKE) $(MFLAGS) mostlyclean)
574
	(cd leim;     $(MAKE) $(MFLAGS) mostlyclean)
575 576 577 578 579 580 581

### `clean'
###      Delete all files from the current directory that are normally
###      created by building the program.  Don't delete the files that
###      record the configuration.  Also preserve files that could be made
###      by building, but normally aren't because the distribution comes
###      with them.
582
###
583
###      Delete `.dvi' files here if they are not part of the distribution.
Richard M. Stallman's avatar
Richard M. Stallman committed
584
clean: FRC
585 586
	(cd src;      $(MAKE) $(MFLAGS) clean)
	(cd oldXMenu; $(MAKE) $(MFLAGS) clean)
587
	(cd lwlib;    $(MAKE) $(MFLAGS) clean)
588
	(cd lib-src;  $(MAKE) $(MFLAGS) clean)
589
	-(cd man &&   $(MAKE) $(MFLAGS) clean)
590
	-(cd lispref &&   $(MAKE) $(MFLAGS) clean)
591
	-(cd lispintro &&   $(MAKE) $(MFLAGS) clean)
592
	(cd leim;     $(MAKE) $(MFLAGS) clean)
Jim Blandy's avatar
Jim Blandy committed
593

594
### `distclean'
595 596 597 598 599 600
###      Delete all files from the current directory that are created by
###      configuring or building the program.  If you have unpacked the
###      source and built the program without creating any other files,
###      `make distclean' should leave only the files that were in the
###      distribution.
top_distclean=\
601
	rm -f config.status config.cache config.log ; \
602
	rm -f Makefile ${SUBDIR_MAKEFILES} ; \
603
	if [ -d lock ] ; then (cd lock && (rm -f * || true)); else true; fi
Richard M. Stallman's avatar
Richard M. Stallman committed
604
distclean: FRC
605 606
	(cd src;      $(MAKE) $(MFLAGS) distclean)
	(cd oldXMenu; $(MAKE) $(MFLAGS) distclean)
607
	(cd lwlib;    $(MAKE) $(MFLAGS) distclean)
608
	(cd lib-src;  $(MAKE) $(MFLAGS) distclean)
609
	(cd man &&    $(MAKE) $(MFLAGS) distclean)
610
	(cd lispref &&    $(MAKE) $(MFLAGS) distclean)
611
	(cd lispintro &&    $(MAKE) $(MFLAGS) distclean)
612
	(cd leim;     $(MAKE) $(MFLAGS) distclean)
613
	(cd lisp;     $(MAKE) $(MFLAGS) distclean)
614
	${top_distclean}
Jim Blandy's avatar
Jim Blandy committed
615

616
### `maintainer-clean'
617 618 619 620
###      Delete everything from the current directory that can be
###      reconstructed with this Makefile.  This typically includes
###      everything deleted by distclean, plus more: C source files
###      produced by Bison, tags tables, info files, and so on.
621
###
622
###      One exception, however: `make maintainer-clean' should not delete
623
###      `configure' even if `configure' can be remade using a rule in the
624
###      Makefile.  More generally, `make maintainer-clean' should not delete
625 626
###      anything that needs to exist in order to run `configure' and then
###      begin to build the program.
627 628 629 630 631 632
maintainer-clean: FRC
	(cd src;      $(MAKE) $(MFLAGS) maintainer-clean)
	(cd oldXMenu; $(MAKE) $(MFLAGS) maintainer-clean)
	(cd lwlib;    $(MAKE) $(MFLAGS) maintainer-clean)
	(cd lib-src;  $(MAKE) $(MFLAGS) maintainer-clean)
	-(cd man &&   $(MAKE) $(MFLAGS) maintainer-clean)
633
	-(cd lispref &&   $(MAKE) $(MFLAGS) maintainer-clean)
634
	-(cd lispintro &&   $(MAKE) $(MFLAGS) maintainer-clean)
635
	(cd leim;     $(MAKE) $(MFLAGS) maintainer-clean)
636
	${top_distclean}
Jim Blandy's avatar
Jim Blandy committed
637

638 639 640 641 642
### This doesn't actually appear in the coding standards, but Karl
### says GCC supports it, and that's where the configuration part of
### the coding standards seem to come from.  It's like distclean, but
### it deletes backup and autosave files too.
extraclean:
Gerd Moellmann's avatar
Gerd Moellmann committed
643
	for i in ${SUBDIR} leim; do (cd $$i; $(MAKE) $(MFLAGS) extraclean); done
644
	${top_distclean}
645
	-rm -f config-tmp-*
646 647
	-rm -f *~ \#*

648 649 650 651 652 653 654 655 656 657
### Unlocking and relocking.  The idea of these productions is to reduce
### hassles when installing an incremental tar of Emacs.  Do `make unlock'
### before unlocking the file to take the write locks off all sources so
### that tar xvof will overwrite them without fuss.  Then do `make relock'
### afterward so that VC mode will know which files should be checked in
### if you want to mung them.
###
### Note: it's no disaster if these productions miss a file or two; tar
### and VC will swiftly let you know if this happens, and it is easily
### corrected.
658
SOURCES = ChangeLog FTP INSTALL Makefile.in \
659
	README configure make-dist move-if-change
660

661 662
.PHONY: unlock relock

663
unlock:
664
	chmod u+w $(SOURCES)
665
	-(cd elisp; chmod u+w Makefile README *.texi)
666 667 668
	(cd etc; $(MAKE) $(MFLAGS) unlock)
	(cd lib-src; $(MAKE) $(MFLAGS) unlock)
	(cd lisp; $(MAKE) $(MFLAGS) unlock)
669 670
	(cd lisp/term; chmod u+w README *.el)
	(cd man; chmod u+w *texi* ChangeLog split-man)
671
	(cd lispref; chmod u+w *texi* ChangeLog)
672
	(cd lispintro; chmod u+w *texi* ChangeLog)
673
	(cd oldXMenu; chmod u+w *.[ch] Makefile README)
674
	(cd lwlib; chmod u+w *.[ch] Makefile README)
675
	(cd src; $(MAKE) $(MFLAGS) unlock)
676 677

relock:
678
	chmod u-w $(SOURCES)
679
	-(cd elisp; chmod u-w Makefile README *.texi)
680 681 682
	(cd etc; $(MAKE) $(MFLAGS) relock)
	(cd lib-src; $(MAKE) $(MFLAGS) relock)
	(cd lisp; $(MAKE) $(MFLAGS) relock)
683 684
	(cd lisp/term; chmod u+w README *.el)
	(cd man; chmod u+w *texi* ChangeLog split-man)
685
	(cd lispref; chmod u+w *texi* ChangeLog)
686
	(cd lispintro; chmod u+w *texi* ChangeLog)
687
	(cd oldXMenu; chmod u+w *.[ch] Makefile README)
688
	(cd lwlib; chmod u+w *.[ch] Makefile README)
689
	(cd src; $(MAKE) $(MFLAGS) relock)
690

691 692
# The src subdir knows how to do the right thing
# even when the build directory and source dir are different.
Gerd Moellmann's avatar
Gerd Moellmann committed
693
TAGS tags: lib-src src
694
	cd src; $(MAKE) tags
Jim Blandy's avatar
Jim Blandy committed
695 696 697

check:
	@echo "We don't have any tests for GNU Emacs yet."
Jim Blandy's avatar
Jim Blandy committed
698 699

dist:
Gerd Moellmann's avatar
Gerd Moellmann committed
700
	cd ${srcdir}; ./make-dist
701

702
.PHONY: info dvi dist check html
703
force-info:
704 705 706
# Note that man/Makefile knows how to
# put the info files in $(srcdir),
# so we can do ok running make in the build dir.
707
info: force-info
708
	(cd man; $(MAKE) $(MFLAGS) info)
709
	(cd lispref; $(MAKE) $(MFLAGS) info)
710
	(cd lispintro; $(MAKE) $(MFLAGS) info)
711
dvi:
712
	(cd man; $(MAKE) $(MFLAGS) dvi)
713
	(cd lispref; $(MAKE) $(MFLAGS) elisp.dvi)
714
	(cd lispintro; $(MAKE) $(MFLAGS) emacs-lisp-intro.dvi)
Gerd Moellmann's avatar
Gerd Moellmann committed
715 716 717 718 719 720 721 722

#### Bootstrapping.

### This is meant for Emacs maintainers only.  It first cleans the
### lisp subdirectory, removing all compiled Lisp files.  Then a
### special emacs executable is built from Lisp sources, which is then
### used to compile Lisp files.  The last step is a "normal" make.

723
.PHONY: bootstrap
724 725 726
.PHONY: maybe_bootstrap

maybe_bootstrap:
727
	@bar="`echo $(srcdir)/lisp/*.elc`"; \
728
	if [ \( "$$bar" = '$(srcdir)/lisp/*.elc' \) -o \( "$$bar" = '' \) ]; then \
729 730 731
	  echo "Your tree does not include the compiled Lisp files."; \
	  echo "You need to do \`make bootstrap' to build Emacs."; \
	  echo "Emacs now requires Texinfo version 4.2."; \
732
	  exit 1;\
733
	fi
734

735
bootstrap: bootstrap-clean-before info FRC
Gerd Moellmann's avatar
Gerd Moellmann committed
736
	(cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean)
737
	(cd src; $(MAKE) $(MFLAGS) bootstrap)
Juanma Barranquero's avatar
Juanma Barranquero committed
738
	(cd lisp; $(MAKE) $(MFLAGS) bootstrap EMACS=../src/bootstrap-emacs@EXEEXT@)
739 740
	(cd src; $(MAKE) $(MFLAGS) mostlyclean)
	$(MAKE) $(MFLAGS) all
741
	(cd lisp; $(MAKE) $(MFLAGS) bootstrap-after)
742

743 744 745 746 747 748 749 750 751 752 753
### Used for `bootstrap' to avoid deleting existing dumped Emacs executables.
bootstrap-clean-before: FRC
	(cd src;      $(MAKE) $(MFLAGS) mostlyclean)
	(cd oldXMenu; $(MAKE) $(MFLAGS) clean)
	(cd lwlib;    $(MAKE) $(MFLAGS) clean)
	(cd lib-src;  $(MAKE) $(MFLAGS) clean)
	-(cd man &&   $(MAKE) $(MFLAGS) clean)
	-(cd lispref &&   $(MAKE) $(MFLAGS) clean)
	-(cd lispintro &&   $(MAKE) $(MFLAGS) clean)
	(cd leim;     $(MAKE) $(MFLAGS) clean)