Add 2011 to FSF/AIST copyright years.
[bpt/emacs.git] / src / Makefile.in
index 29a4881..e92f2bb 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for GNU Emacs.
 # Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
-#               2003, 2004, 2005, 2006, 2007, 2008
+#               2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #               Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
@@ -63,6 +63,13 @@ M_FILE = ${srcdir}/@machfile@
 S_FILE = ${srcdir}/@opsysfile@
 config_h = config.h $(M_FILE) $(S_FILE)
 
+bootstrap_exe = ../src/bootstrap-emacs${EXEEXT}
+
+OTHER_FILES = @OTHER_FILES@
+
+# Only used by amdx86-64 and ibms390x GNU/Linux.
+CRT_DIR=@CRT_DIR@
+
 # ========================== start of cpp stuff =======================
 /* From here on, comments must be done in C syntax.  */
 
@@ -75,6 +82,10 @@ SHELL=/bin/sh
 #define NOT_C_CODE
 #include "config.h"
 
+#ifdef AUTO_DEPEND
+DEPFLAGS = -MMD -MF deps/$*.d
+#endif
+
 /* Do not let the file name mktime.c get messed up.  */
 #ifdef mktime
 #undef mktime
@@ -112,6 +123,12 @@ SHELL=/bin/sh
 #endif
 #endif
 
+/* Under GNUstep, putting libc on the link line causes problems. */
+#ifdef NS_IMPL_GNUSTEP
+#undef LIB_STANDARD
+#define LIB_STANDARD
+#endif
+
 /* Unless inhibited or changed, use -lg to link for debugging.  */
 #ifndef LIBS_DEBUG
 #define LIBS_DEBUG -lg
@@ -194,16 +211,6 @@ SHELL=/bin/sh
 #define LD_SWITCH_X_DEFAULT
 #endif
 
-/* These can be passed in from config.h to define special load and
-   compile switches needed by individual sites */
-#ifndef LD_SWITCH_SITE
-#define LD_SWITCH_SITE
-#endif
-
-#ifndef C_SWITCH_SITE
-#define C_SWITCH_SITE
-#endif
-
 #ifndef ORDINARY_LINK
 
 #ifndef CRT0_COMPILE
@@ -229,12 +236,26 @@ STARTFILES = START_FILES
 #endif /* not ORDINARY_LINK */
 
 
+#ifdef NS_IMPL_GNUSTEP
+/* Pull in stuff from GNUstep-make. */
+FOUNDATION_LIB=gnu
+GUI_LIB=gnu
+include @GNUSTEP_MAKEFILES@/Additional/base.make
+include @GNUSTEP_MAKEFILES@/Additional/gui.make
+shared=no
+#endif
+
 #ifdef HAVE_DBUS
 DBUS_CFLAGS = @DBUS_CFLAGS@
 DBUS_LIBS = @DBUS_LIBS@
 DBUS_OBJ = dbusbind.o
 #endif
 
+#ifdef HAVE_GCONF
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+#endif
+
 /* DO NOT use -R.  There is a special hack described in lastfile.c
    which is used instead.  Some initialized data areas are modified
    at initial startup, then labeled as part of the text area when
@@ -248,9 +269,20 @@ DBUS_OBJ = dbusbind.o
 
 /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
    since it may have -I options that should override those two.  */
-ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@
+ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS}
+ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@
+
+.SUFFIXES: .m
 .c.o:
+#ifdef AUTO_DEPEND
+       @-test -d deps || mkdir deps
+#endif
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
+.m.o:
+#ifdef AUTO_DEPEND
+       @-test -d deps || mkdir deps
+#endif
+       $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
 
 #ifndef LIBX11_SYSTEM
 #define LIBX11_SYSTEM
@@ -260,14 +292,10 @@ ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHIN
 #define LIB_X11_LIB -lX11
 #endif
 
-/* xmenu.c should not be compiled on OSX.  */
-#ifndef HAVE_CARBON
-XMENU_OBJ = xmenu.o
-#endif
-
 #ifdef HAVE_X_WINDOWS
-
-XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o
+XMENU_OBJ = xmenu.o
+XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o \
+      xsettings.o xgselect.o
 
 #ifdef HAVE_MENUS
 
@@ -396,7 +424,6 @@ LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) LIBTIFF LIBJPEG LIBPNG LIBGIF LIBXPM L
 #else /* not HAVE_X11 */
 LIBX= $(LIBXMENU) LD_SWITCH_X_SITE
 #endif /* not HAVE_X11 */
-#else /* not HAVE_X_WINDOWS */
 #endif /* not HAVE_X_WINDOWS */
 
 #if HAVE_GPM
@@ -479,7 +506,7 @@ LD=ld
 /* Flags to pass to LD only for temacs.  */
 /* Do not split this line with a backslash.  That can cause trouble with
    some cpps.  */
-TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE
+TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS
 
 /* A macro which other sections of Makefile can redefine to munge the
    flags before they are passed to LD.  This is helpful if you have
@@ -495,15 +522,15 @@ TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_S
 #define UNEXEC unexec.o
 #endif
 
-INTERVAL_SRC = intervals.h composite.h
+INTERVALS_H = dispextern.h intervals.h composite.h
 
 GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
 
 #ifdef MSDOS
 #ifdef HAVE_X_WINDOWS
-MSDOS_OBJ = dosfns.o msdos.o
+MSDOS_OBJ = dosfns.o msdos.o xmenu.o
 #else
-MSDOS_OBJ = dosfns.o msdos.o w16select.o
+MSDOS_OBJ = dosfns.o msdos.o w16select.o xmenu.o
 #endif
 #endif
 
@@ -511,12 +538,15 @@ MSDOS_OBJ = dosfns.o msdos.o w16select.o
 CYGWIN_OBJ = sheap.o
 #endif
 
-#ifdef HAVE_CARBON
-mac = ../mac/
-MAC_OBJ = mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o fringe.o image.o mactoolbox.o
-emacsapp = $(PWD)/$(mac)Emacs.app/
-emacsappsrc = ${srcdir}/../mac/Emacs.app/
-#endif
+#ifdef HAVE_NS
+ns_appdir=@ns_appdir@/
+ns_appbindir=@ns_appbindir@/
+ns_appresdir=@ns_appresdir@/
+ns_appsrc=@ns_appsrc@
+/* Object files for NeXTstep */
+NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
+       fontset.o fringe.o image.o
+#endif  /* HAVE_NS */
 
 #ifdef HAVE_WINDOW_SYSTEM
 #ifdef HAVE_X_WINDOWS
@@ -545,14 +575,15 @@ obj=    dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
        process.o callproc.o \
        region-cache.o sound.o atimer.o \
        doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \
-       $(MSDOS_OBJ) $(MAC_OBJ) $(CYGWIN_OBJ) $(FONT_DRIVERS)
+       $(MSDOS_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_DRIVERS)
 
 /* Object files used on some machine or other.
    These go in the DOC file on all machines
    in case they are needed there.  */
 SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
   xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-  mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \
+  fontset.o dbusbind.o \
+  nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
   w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
   w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
 
@@ -616,16 +647,10 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
 #endif
 #endif
 
-#ifdef VMS
-#define VMS_SUPPORT ${lispsource}vmsproc.elc ${lispsource}vms-patch.elc
-#else
-#define VMS_SUPPORT
-#endif
-
 #ifdef MSDOS
 #define MSDOS_SUPPORT ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \
  ${lispsource}dos-fns.elc ${lispsource}dos-w32.elc ${lispsource}dos-vars.elc \
- ${lispsource}international/ccl.elc ${lispsource}international/codepage.elc
+ ${lispsource}term/internal.elc ${lispsource}term/pc-win.elc
 
 #else
 #define MSDOS_SUPPORT
@@ -635,7 +660,9 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
 #ifdef HAVE_X_WINDOWS
 #define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \
  ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
- ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc
+ ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc \
+ ${lispsource}term/common-win.elc ${lispsource}term/x-win.elc \
+ ${lispsource}font-setting.elc
 #else
 #define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \
  ${lispsource}international/fontset.elc ${lispsource}dnd.elc \
@@ -648,7 +675,8 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
 #ifdef WINDOWSNT
 #define WINNT_SUPPORT ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \
   ${lispsource}dos-w32.elc ${lispsource}w32-vars.elc \
-  ${lispsource}w32-fns.elc
+  ${lispsource}w32-fns.elc ${lispsource}term/common-win.elc \
+  ${lispsource}term/w32-win.elc
 #else
 #define WINNT_SUPPORT
 #endif
@@ -659,17 +687,24 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
 #define TOOLTIP_SUPPORT
 #endif
 
-/* List of Lisp files loaded into the dumped Emacs.  It is arranged
-   like this because it is easier to generate it semi-mechanically from
-   loadup.el this way.
+#ifdef HAVE_NS
+#define NS_SUPPORT ${lispsource}emacs-lisp/easymenu.elc \
+  ${lispsource}term/ns-win.elc
+#else
+#define NS_SUPPORT
+#endif
+
+/* This is the platform-specific list of Lisp files loaded into the
+   dumped Emacs.  It is arranged like this because it is easier to generate
+   it semi-mechanically from loadup.el this way.
 
    Note that this list should not include lisp files which might not
    be present, like site-load.el and site-init.el; this makefile
    expects them all to be either present or buildable.
 
-   Files which are loaded unconditionally should be in shortlisp as well.
-   Files included conditionally here should be included (unconditionally)
-   in SOME_MACHINE_LISP.  */
+   Files which are loaded unconditionally (i.e., on all platforms) should
+   also be in shortlisp.  Files which are loaded conditionally (i.e., only
+   on some platforms) should instead be in SOME_MACHINE_LISP.  */
 
 /* Place loaddefs.el first, so it gets generated first, since it is on
    the critical path (relevant in parallel compilations).  */
@@ -704,14 +739,14 @@ lisp= \
        ${lispsource}emacs-lisp/map-ynp.elc \
        ${lispsource}menu-bar.elc \
        ${lispsource}international/mule.elc \
-       ${lispsource}international/mule-conf.el \
+       ${lispsource}international/mule-conf.elc \
        ${lispsource}international/mule-cmds.elc \
        ${lispsource}international/characters.elc \
        ${lispsource}international/charprop.el \
        ${lispsource}case-table.elc \
-       ${lispsource}language/chinese.el \
-       ${lispsource}language/cyrillic.el \
-       ${lispsource}language/indian.el \
+       ${lispsource}language/chinese.elc \
+       ${lispsource}language/cyrillic.elc \
+       ${lispsource}language/indian.elc \
        ${lispsource}language/sinhala.el \
        ${lispsource}language/english.el \
        ${lispsource}language/ethiopic.elc \
@@ -728,7 +763,7 @@ lisp= \
        ${lispsource}language/tai-viet.el \
        ${lispsource}language/thai.el \
        ${lispsource}language/tibetan.elc \
-       ${lispsource}language/vietnamese.el \
+       ${lispsource}language/vietnamese.elc \
        ${lispsource}language/misc-lang.el \
        ${lispsource}language/utf-8-lang.el \
        ${lispsource}language/georgian.el \
@@ -756,18 +791,19 @@ lisp= \
        ${lispsource}ediff-hook.elc \
        ${lispsource}epa-hook.elc \
        TOOLTIP_SUPPORT \
-       VMS_SUPPORT \
        MSDOS_SUPPORT \
        WINNT_SUPPORT \
        WINDOW_SUPPORT \
+       NS_SUPPORT \
        ${lispsource}widget.elc \
        ${lispsource}window.elc \
        ${lispsource}version.el
 
-/* These are relative file names for the Lisp files
-   that are loaded unconditionally.  This is used in make-docfile.
-   It need not contain the files that are loaded conditionally
-   because SOME_MACHINE_LISP has those.  */
+/* List of relative names for those files from $lisp that are loaded
+   unconditionally (i.e. on all platforms).  Files from $lisp that
+   are only loaded on some platforms should instead be placed in
+   SOME_MACHINE_LISP.  The only reason this variable exists is to prevent
+   the make-docfile command-line getting too long for some systems.  */
 shortlisp= \
        ../lisp/loaddefs.el \
        ../lisp/abbrev.elc \
@@ -796,13 +832,13 @@ shortlisp= \
        ../lisp/emacs-lisp/map-ynp.elc \
        ../lisp/env.elc \
        ../lisp/international/mule.elc \
-       ../lisp/international/mule-conf.el \
+       ../lisp/international/mule-conf.elc \
        ../lisp/international/mule-cmds.elc \
        ../lisp/international/characters.elc \
        ../lisp/case-table.elc \
-       ../lisp/language/chinese.el \
-       ../lisp/language/cyrillic.el \
-       ../lisp/language/indian.el \
+       ../lisp/language/chinese.elc \
+       ../lisp/language/cyrillic.elc \
+       ../lisp/language/indian.elc \
        ../lisp/language/sinhala.el \
        ../lisp/language/english.el \
        ../lisp/language/ethiopic.elc \
@@ -819,7 +855,7 @@ shortlisp= \
        ../lisp/language/tai-viet.el \
        ../lisp/language/thai.el \
        ../lisp/language/tibetan.elc \
-       ../lisp/language/vietnamese.el \
+       ../lisp/language/vietnamese.elc \
        ../lisp/language/misc-lang.el \
        ../lisp/language/utf-8-lang.el \
        ../lisp/language/georgian.el \
@@ -851,66 +887,57 @@ shortlisp= \
        ../lisp/window.elc \
        ../lisp/version.el
 
-/* Lisp files that may or may not be used.
-   We must unconditionally put them in the DOC file.
-   We use ../lisp/ to start the file names
-   to reduce the size of the argument list for make-docfile
-   for the sake of systems which can''t handle large ones.  */
+/* Like $shortlisp, but includes only those files from $lisp that are loaded
+   conditionally (i.e., only on some platforms).  */
 SOME_MACHINE_LISP = ../lisp/mouse.elc \
   ../lisp/select.elc ../lisp/scroll-bar.elc \
-  VMS_SUPPORT \
   ../lisp/ls-lisp.elc ../lisp/dos-fns.elc \
   ../lisp/w32-fns.elc ../lisp/dos-w32.elc \
   ../lisp/disp-table.elc ../lisp/dos-vars.elc \
   ../lisp/tooltip.elc ../lisp/image.elc \
   ../lisp/fringe.elc ../lisp/dnd.elc \
   ../lisp/mwheel.elc ../lisp/tool-bar.elc \
-  ../lisp/x-dnd.elc \
+  ../lisp/x-dnd.elc ../lisp/font-setting.elc \
   ../lisp/international/ccl.elc \
-  ../lisp/international/codepage.elc \
   ../lisp/international/fontset.elc \
   ../lisp/mouse.elc \
-  ../lisp/term/x-win.elc
+  ../lisp/term/common-win.elc \
+  ../lisp/term/x-win.elc \
+  ../lisp/term/pc-win.elc ../lisp/term/internal.elc \
+  ../lisp/term/ns-win.elc ../lisp/term/w32-win.elc \
+  ../lisp/emacs-lisp/easymenu.elc
 
 /* Construct full set of libraries to be linked.
    Note that SunOS needs -lm to come before -lc; otherwise, you get
    duplicated symbols.  If the standard libraries were compiled
    with GCC, we might need gnulib again after them.  */
+
 LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) $(DBUS_LIBS) \
    LIBGPM LIBRESOLV LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
-   LIBS_DEBUG $(GETLOADAVG_LIBS) \
+   LIBS_DEBUG $(GETLOADAVG_LIBS) ${GCONF_LIBS} \
    @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
    $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)
 
-/* Enable recompilation of certain other files depending on system type.  */
-
-#ifndef OTHER_FILES
-#define OTHER_FILES
-#endif
-
-#ifndef OBJECTS_MACHINE
-#define OBJECTS_MACHINE
-#endif
-
 #ifdef HAVE_SHM
 RUN_TEMACS = `/bin/pwd`/temacs -nl
 #else
 RUN_TEMACS = `/bin/pwd`/temacs
 #endif
 
-all: emacs${EXEEXT} OTHER_FILES
+all: emacs${EXEEXT} $(OTHER_FILES)
 
-emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} ${SOME_MACHINE_LISP}
+emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
 #ifdef CANNOT_DUMP
        rm -f emacs${EXEEXT}
        ln temacs${EXEEXT} emacs${EXEEXT}
+       -EMACSLOADPATH=${lispsource} ./emacs -q -batch -f list-load-path-shadows
 #else
        LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
        @: This new Emacs is as functional and more efficient then
        @: bootstrap-emacs, so let us replace it.
        -ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}
-#endif /* ! defined (CANNOT_DUMP) */
        -./emacs -q -batch -f list-load-path-shadows
+#endif /* ! defined (CANNOT_DUMP) */
 
 /* We run make-docfile twice because the command line may get too long
    on some systems.  */
@@ -933,17 +960,26 @@ ${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${lisp} ${SOME_MACHINE_LISP}
 ${libsrc}make-docfile${EXEEXT}:
        cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile${EXEEXT}
 
-temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
-       echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
+buildobj.h: Makefile
+       echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
+
+temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
+#ifdef NS_IMPL_GNUSTEP
+       $(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
+       -L@GNUSTEP_SYSTEM_LIBRARIES@ -lgnustep-gui -lgnustep-base \
+       -lobjc $(CONFIG_SYSTEM_LIBS) -lpthread ) -o temacs \
+       ${obj} ${otherobj} ${LIBES}
+#else
        $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
     -o temacs ${STARTFILES} ${obj} ${otherobj}  \
-    OBJECTS_MACHINE ${LIBES}
+    ${LIBES}
+#endif
 
 /* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE
    often contain options that have to do with using Emacs''s crt0,
    which are only good with temacs.  */
-prefix-args${EXEEXT}: prefix-args.c $(config_h)
-       $(CC) $(ALL_CFLAGS) $(LDFLAGS) ${srcdir}/prefix-args.c -o prefix-args
+prefix-args${EXEEXT}: prefix-args.o $(config_h)
+       $(CC) $(LDFLAGS) prefix-args.o -o prefix-args
 
 #if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (USE_GTK)
 
@@ -960,7 +996,6 @@ stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU)
    so we can use $(...) to substitute their values within "...".  */
 C_SWITCH_MACHINE_1 = C_SWITCH_MACHINE
 C_SWITCH_SYSTEM_1 = C_SWITCH_SYSTEM
-C_SWITCH_SITE_1 = C_SWITCH_SITE
 C_SWITCH_X_SITE_1 = C_SWITCH_X_SITE
 C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE
 C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM
@@ -974,7 +1009,6 @@ really-lwlib:
     "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
     "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
     "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \
-    "C_SWITCH_SITE=$(C_SWITCH_SITE_1)" \
     "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
     "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
        @true  /* make -t should not create really-lwlib.  */
@@ -988,7 +1022,6 @@ really-oldXMenu:
     "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
     "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
     "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \
-    "C_SWITCH_SITE=$(C_SWITCH_SITE_1)" \
     "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
     "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
        @true  /* make -t should not create really-oldXMenu.  */
@@ -1011,279 +1044,290 @@ stamp-oldxmenu:
        @echo "Please run the `configure' script again."
        exit 1
 
-/* Nearly all the following files depend on lisp.h,
-   but it is not included as a dependency because
-   it is so often changed in ways that do not require any recompilation
-   and so rarely changed in ways that do require any.  */
+ecrt0.o: ecrt0.c $(config_h)
+#ifdef AUTO_DEPEND
+       @-test -d deps || mkdir deps
+#endif
+       CRT0_COMPILE ${srcdir}/ecrt0.c
+doc.o: buildobj.h
+
+#ifndef AUTO_DEPEND
 
-abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h character.h \
      syntax.h $(config_h)
+atimer.o: atimer.c atimer.h syssignal.h systime.h lisp.h blockinput.h \
+ $(config_h)
 buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
-   dispextern.h $(INTERVAL_SRC) blockinput.h atimer.h systime.h character.h \
-   $(config_h)
+   $(INTERVALS_H) blockinput.h atimer.h systime.h character.h \
+   indent.h keyboard.h coding.h keymap.h frame.h lisp.h $(config_h)
 callint.o: callint.c window.h commands.h buffer.h keymap.h \
-   keyboard.h dispextern.h $(config_h)
-callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \
+   keyboard.h dispextern.h systime.h coding.h composite.h lisp.h $(config_h)
+callproc.o: callproc.c epaths.h buffer.h commands.h lisp.h $(config_h) \
        process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
-        composite.h w32.h blockinput.h atimer.h systime.h frame.h termhooks.h
+        composite.h w32.h blockinput.h atimer.h systime.h frame.h termhooks.h \
+        buffer.h
 casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
-   composite.h \
-       charset.h keymap.h $(config_h)
-casetab.o: casetab.c buffer.h $(config_h)
+   composite.h keymap.h lisp.h $(config_h)
+casetab.o: casetab.c buffer.h character.h lisp.h $(config_h)
 category.o: category.c category.h buffer.h charset.h keymap.h  \
-       character.h $(config_h)
-ccl.o: ccl.c ccl.h charset.h character.h coding.h $(config_h)
+       character.h lisp.h $(config_h)
+ccl.o: ccl.c ccl.h charset.h character.h coding.h composite.h lisp.h $(config_h)
 character.o: character.c character.h buffer.h charset.h composite.h disptab.h \
-   $(config.h)
+   lisp.h $(config_h)
 charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \
-   disptab.h $(config_h)
-chartab.o: charset.h character.h $(config.h)
-coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h intervals.h composite.h \
-       window.h dispextern.h frame.h termhooks.h $(config_h)
-cm.o: cm.c frame.h cm.h termhooks.h termchar.h $(config_h)
-cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h $(config_h) \
-       msdos.h dispextern.h keyboard.h keymap.h
+   disptab.h lisp.h $(config_h)
+chartab.o: charset.h character.h ccl.h lisp.h $(config_h)
+coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \
+       window.h dispextern.h frame.h termhooks.h lisp.h $(config_h)
+cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h lisp.h $(config_h)
+cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h $(config_h) \
+       msdos.h dispextern.h keyboard.h keymap.h systime.h coding.h frame.h \
+        composite.h
 pre-crt0.o: pre-crt0.c
-ecrt0.o: ecrt0.c $(config_h)
-       CRT0_COMPILE ${srcdir}/ecrt0.c
-dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \
-   coding.h regex.h systime.h blockinput.h atimer.h
-dispnew.o: dispnew.c systime.h commands.h process.h frame.h \
-   window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
-   disptab.h indent.h intervals.h \
-   xterm.h blockinput.h atimer.h character.h msdos.h composite.h keyboard.h \
-   $(config_h)
-doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h keymap.h character.h
-doprnt.o: doprnt.c character.h $(config_h)
+dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h)
+dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \
+   coding.h regex.h systime.h blockinput.h atimer.h composite.h
+dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \
+   window.h buffer.h termchar.h termopts.h termhooks.h cm.h \
+   disptab.h indent.h $(INTERVALS_H) \
+   xterm.h blockinput.h atimer.h character.h msdos.h keyboard.h \
+   syssignal.h lisp.h $(config_h)
+doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h \
+   character.h systime.h coding.h composite.h
+doprnt.o: doprnt.c character.h lisp.h $(config_h)
 dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
    msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
-   $(config_h)
-editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
-   coding.h dispextern.h frame.h blockinput.h atimer.h $(config_h)
+   lisp.h $(config_h)
+editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
+   coding.h frame.h blockinput.h atimer.h lisp.h $(config_h)
 emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
-   termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \
-   window.h dispextern.h keyboard.h keymap.h
-fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
-   coding.h msdos.h dispextern.h blockinput.h atimer.h $(config_h)
-filelock.o: filelock.c buffer.h character.h charset.h coding.h systime.h \
-   epaths.h $(config_h)
-filemode.o: filemode.c  $(config_h)
+   termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \
+   window.h dispextern.h keyboard.h keymap.h frame.h coding.h
+fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
+   coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h commands.h
+filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \
+   lisp.h $(config_h)
+filemode.o: filemode.c $(config_h)
 frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
-   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h \
-   msdos.h dosfns.h dispextern.h w32term.h macterm.h termchar.h $(config_h)
-fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h $(config_h)
+   blockinput.h atimer.h systime.h buffer.h character.h fontset.h font.h    \
+   msdos.h dosfns.h dispextern.h w32term.h termchar.h coding.h composite.h \
+   lisp.h $(config_h) termhooks.h ccl.h
+fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h \
+   blockinput.h atimer.h systime.h lisp.h $(config_h)
 font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
-   font.h $(config_h)
-ftfont.o: dispextern.h frame.h character.h charset.h font.h $(config_h)
-fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h character.h \
-   charset.h frame.h keyboard.h termhooks.h font.h $(config_h)
+   font.h lisp.h $(config_h) buffer.h composite.h fontset.h xterm.h
+ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \
+   lisp.h $(config_h) blockinput.h atimer.h systime.h coding.h fontset.h \
+   ccl.h ftfont.h
+fontset.o: fontset.c fontset.h ccl.h buffer.h character.h \
+   charset.h frame.h keyboard.h termhooks.h font.h lisp.h $(config_h) \
+   blockinput.h atimer.h systime.h coding.h $(INTERVALS_H) window.h xterm.h
 getloadavg.o: getloadavg.c $(config_h)
+gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h lisp.h $(config_h) \
+  blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
+  charset.h coding.h syssignal.h dispextern.h composite.h
 image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
-   systime.h xterm.h w32term.h w32gui.h macterm.h macgui.h font.h \
-   $(config_h)
-indent.o: indent.c frame.h window.h indent.h buffer.h $(config_h) termchar.h \
-   termopts.h disptab.h region-cache.h character.h category.h composite.h \
-   dispextern.h keyboard.h
-insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h character.h \
-   dispextern.h atimer.h systime.h region-cache.h $(config_h)
+   systime.h xterm.h w32term.h w32gui.h font.h epaths.h character.h coding.h \
+   nsterm.h nsgui.h lisp.h $(config_h) composite.h termhooks.h ccl.h
+indent.o: indent.c frame.h window.h indent.h buffer.h lisp.h $(config_h) termchar.h \
+   termopts.h disptab.h region-cache.h character.h category.h \
+   keyboard.h systime.h coding.h $(INTERVALS_H)
+insdel.o: insdel.c window.h buffer.h $(INTERVALS_H) blockinput.h character.h \
+   dispextern.h atimer.h systime.h region-cache.h lisp.h $(config_h)
 keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
    commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
-   systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
-   atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h)
+   systime.h syntax.h $(INTERVALS_H) blockinput.h atimer.h composite.h \
+   xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h coding.h \
+   lisp.h $(config_h)
 keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
-   atimer.h systime.h puresize.h character.h intervals.h keymap.h window.h \
-   $(config_h)
-lastfile.o: lastfile.c  $(config_h)
+   atimer.h systime.h puresize.h character.h charset.h $(INTERVALS_H) keymap.h window.h \
+   coding.h frame.h lisp.h $(config_h)
+lastfile.o: lastfile.c $(config_h)
 macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
-       dispextern.h $(config_h)
-malloc.o: malloc.c $(config_h)
+       dispextern.h lisp.h $(config_h) systime.h coding.h composite.h
 gmalloc.o: gmalloc.c $(config_h)
-ralloc.o: ralloc.c $(config_h)
-vm-limit.o: vm-limit.c mem-limits.h $(config_h)
-marker.o: marker.c buffer.h character.h $(config_h)
+ralloc.o: ralloc.c lisp.h $(config_h)
+vm-limit.o: vm-limit.c mem-limits.h lisp.h $(config_h)
+marker.o: marker.c buffer.h character.h lisp.h $(config_h)
 md5.o: md5.c md5.h $(config_h)
-minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \
-   buffer.h commands.h character.h msdos.h $(INTERVAL_SRC) keymap.h \
-   termhooks.h $(config_h)
+minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \
+   buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \
+   termhooks.h lisp.h $(config_h) coding.h
 mktime.o: mktime.c $(config_h)
 msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
    termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
-   keyboard.h intervals.h buffer.h commands.h blockinput.h atimer.h $(config_h)
+   keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h lisp.h $(config_h)
+nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
+  dispextern.h nsgui.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \
+  atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h)
+nsfont.o: nsterm.h dispextern.h frame.h lisp.h lisp.h $(config_h)
+nsimage.o: nsimage.m nsterm.h lisp.h $(config_h)
+nsmenu.o: nsmenu.m termhooks.h frame.h window.h dispextern.h \
+  nsgui.h keyboard.h blockinput.h atimer.h systime.h buffer.h \
+  nsterm.h lisp.h $(config_h)
+nsterm.o: nsterm.m blockinput.h atimer.h systime.h syssignal.h nsterm.h \
+  nsgui.h frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h \
+  termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
+  $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
+nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
 process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
    commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
    blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
-   keyboard.h $(config_h)
-regex.o: regex.c syntax.h buffer.h $(config_h) regex.h category.h character.h \
-   charset.h
-region-cache.o: region-cache.c buffer.h region-cache.h $(config_h)
+   keyboard.h lisp.h $(config_h) character.h xgselect.h sysselect.h
+regex.o: regex.c syntax.h buffer.h lisp.h $(config_h) regex.h category.h character.h
+region-cache.o: region-cache.c buffer.h region-cache.h lisp.h $(config_h)
 scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
-   termhooks.h $(config_h)
+   termhooks.h lisp.h $(config_h) systime.h coding.h composite.h window.h
 search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
    blockinput.h atimer.h systime.h category.h character.h charset.h \
-   composite.h $(INTERVAL_SRC) \
-   $(config_h)
+   $(INTERVALS_H) \
+   lisp.h $(config_h)
+sound.o: sound.c dispextern.h syssignal.h lisp.h $(config_h) atimer.h systime.h
 strftime.o: strftime.c $(config_h)
 syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
-   composite.h keymap.h regex.h $(INTERVAL_SRC) $(config_h)
+   keymap.h regex.h $(INTERVALS_H) lisp.h $(config_h)
 sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
-   process.h dispextern.h termhooks.h termchar.h termopts.h \
-   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h $(config_h)
-term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
-   disptab.h dispextern.h keyboard.h character.h charset.h coding.h ccl.h \
-   msdos.h window.h keymap.h blockinput.h atimer.h systime.h
-termcap.o: termcap.c $(config_h)
+   process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \
+   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h $(config_h) \
+   composite.h
+term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) cm.h frame.h \
+   disptab.h keyboard.h character.h charset.h coding.h ccl.h xterm.h \
+   msdos.h window.h keymap.h blockinput.h atimer.h systime.h systty.h \
+   syssignal.h $(INTERVALS_H) buffer.h
+termcap.o: termcap.c lisp.h $(config_h)
 terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
-   keyboard.h $(config_h)
-terminfo.o: terminfo.c $(config_h)
-tparam.o: tparam.c $(config_h)
-undo.o: undo.c buffer.h commands.h window.h $(config_h)
-unexaix.o: unexaix.c $(config_h)
+   keyboard.h lisp.h $(config_h) dispextern.h composite.h systime.h
+terminfo.o: terminfo.c lisp.h $(config_h)
+tparam.o: tparam.c lisp.h $(config_h)
+undo.o: undo.c buffer.h commands.h window.h dispextern.h lisp.h $(config_h)
+unexaix.o: unexaix.c lisp.h $(config_h)
 unexalpha.o: unexalpha.c $(config_h)
-unexcw.o: unexcw.c $(config_h)
-unexec.o: unexec.c $(config_h)
+unexcw.o: unexcw.c lisp.h $(config_h)
+unexec.o: unexec.c lisp.h $(config_h)
 unexelf.o: unexelf.c $(config_h)
 unexhp9k800.o: unexhp9k800.c $(config_h)
 unexmacosx.o: unexmacosx.c $(config_h)
-unexmips.o: unexmips.c $(config_h)
-unexnext.o: unexnext.c $(config_h)
-unexsol.o: unexsol.c $(config_h)
+unexsol.o: unexsol.c lisp.h $(config_h)
 unexw32.o: unexw32.c $(config_h)
 w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
-   msdos.h buffer.h charset.h coding.h composite.h $(config_h)
+   msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h)
 widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
-   $(srcdir)/../lwlib/lwlib.h $(config_h)
+   $(srcdir)/../lwlib/lwlib.h lisp.h $(config_h)
 window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
-   disptab.h keyboard.h dispextern.h msdos.h composite.h \
-   keymap.h blockinput.h atimer.h systime.h $(INTERVAL_SRC) \
-   xterm.h w32term.h macterm.h $(config_h)
+   disptab.h keyboard.h msdos.h coding.h termhooks.h \
+   keymap.h blockinput.h atimer.h systime.h $(INTERVALS_H) \
+   xterm.h w32term.h nsterm.h lisp.h $(config_h)
 xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
    coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h     \
-   charset.h $(config_h) keyboard.h $(INTERVAL_SRC) region-cache.h xterm.h    \
-   w32term.h macterm.h msdos.h composite.h fontset.h blockinput.h atimer.h    \
-   systime.h keymap.h font.h
+   charset.h lisp.h $(config_h) keyboard.h $(INTERVALS_H) region-cache.h xterm.h    \
+   w32term.h nsterm.h msdos.h composite.h fontset.h ccl.h \
+   blockinput.h atimer.h systime.h keymap.h font.h
 xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h  \
    window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h        \
-   systime.h keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC)  \
-   termchar.h termhooks.h font.h $(config_h)
+   systime.h keyboard.h fontset.h w32term.h nsterm.h coding.h ccl.h \
+   $(INTERVALS_H) termchar.h termhooks.h font.h lisp.h $(config_h)
 xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
    $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
-   character.h charset.h coding.h gtkutil.h $(config_h) termhooks.h \
-   fontset.h termchar.h font.h
+   character.h charset.h coding.h gtkutil.h lisp.h $(config_h) termhooks.h \
+   fontset.h termchar.h font.h xsettings.h $(INTERVALS_H) ccl.h
 xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h $(config_h)
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
 xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h $(config_h)
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h ftfont.h
 ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
-   font.h $(config_h)
+   font.h lisp.h $(config_h) atimer.h systime.h fontset.h ccl.h
 menu.o: menu.c lisp.h keyboard.h keymap.h frame.h termhooks.h blockinput.h \
-   dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h $(config_h)
+   dispextern.h $(srcdir)/../lwlib/lwlib.h xterm.h gtkutil.h menu.h \
+   lisp.h $(config_h) systime.h coding.h composite.h window.h atimer.h
 xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
    charset.h keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h \
-   systime.h gtkutil.h msdos.h coding.h $(config_h)
+   systime.h gtkutil.h msdos.h coding.h menu.h lisp.h $(config_h) composite.h \
+   keymap.h sysselect.h
 xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
    dispextern.h frame.h disptab.h blockinput.h atimer.h systime.h syssignal.h \
    keyboard.h emacs-icon.h character.h charset.h ccl.h fontset.h composite.h \
-   coding.h process.h gtkutil.h font.h fontset.h $(config_h)
+   coding.h process.h gtkutil.h font.h fontset.h lisp.h $(config_h) \
+   xsettings.h intervals.h keymap.h xgselect.h sysselect.h
 xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
-  buffer.h atimer.h systime.h termhooks.h $(config_h)
-xrdb.o: xrdb.c $(config_h) epaths.h
-xsmfns.o: xsmfns.c $(config_h) systime.h sysselect.h termhooks.h xterm.h \
-  lisp.h termopts.h
-gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h $(config_h) \
-  blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
-  charset.h coding.h
-dbusbind.o: dbusbind.c termhooks.h $(config_h)
-
-hftctl.o: hftctl.c $(config_h)
-sound.o: sound.c dispextern.h $(config_h)
-atimer.o: atimer.c atimer.h systime.h $(config_h)
-
+  buffer.h atimer.h systime.h termhooks.h lisp.h $(config_h) keyboard.h \
+  coding.h composite.h
+xgselect.o: xgselect.h systime.h sysselect.h lisp.h $(config_h)
+xrdb.o: xrdb.c lisp.h $(config_h) epaths.h
+xsmfns.o: xsmfns.c lisp.h $(config_h) systime.h sysselect.h termhooks.h xterm.h \
+  lisp.h termopts.h frame.h dispextern.h
+xsettings.o: xterm.h xsettings.h lisp.h frame.h termhooks.h $(config_h) \
+  dispextern.h keyboard.h systime.h coding.h composite.h blockinput.h atimer.h \
+  termopts.h
 /* The files of Lisp proper */
 
-alloc.o: alloc.c process.h frame.h window.h buffer.h  puresize.h syssignal.h keyboard.h \
blockinput.h atimer.h systime.h character.h dispextern.h $(config_h) \
- $(INTERVAL_SRC)
+alloc.o: alloc.c process.h frame.h window.h buffer.h  puresize.h syssignal.h \
keyboard.h blockinput.h atimer.h systime.h character.h lisp.h $(config_h) \
+ $(INTERVALS_H) termhooks.h
 bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
-  frame.h xterm.h $(config_h)
+  frame.h xterm.h lisp.h $(config_h)
 data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \
-   termhooks.h $(config_h)
+   termhooks.h systime.h coding.h composite.h dispextern.h font.h ccl.h \
+   lisp.h $(config_h)
 eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
-  dispextern.h $(config_h)
-floatfns.o: floatfns.c $(config_h)
-fns.o: fns.c commands.h $(config_h) frame.h buffer.h character.h keyboard.h \
- keymap.h frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h \
- blockinput.h atimer.h systime.h xterm.h termhooks.h
+  dispextern.h lisp.h $(config_h) coding.h composite.h xterm.h
+floatfns.o: floatfns.c syssignal.h lisp.h $(config_h)
+fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h keyboard.h \
+ keymap.h window.h dispextern.h $(INTERVALS_H) coding.h md5.h \
+ blockinput.h atimer.h systime.h xterm.h
 print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
-   $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \
-   blockinput.h atimer.h systime.h font.h
+   lisp.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \
+   blockinput.h atimer.h systime.h font.h charset.h coding.h ccl.h
 lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
- charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
+ charset.h lisp.h $(config_h) $(INTERVALS_H) termhooks.h coding.h msdos.h \
+ systime.h frame.h blockinput.h atimer.h
 
 /* Text properties support */
-textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \
-       $(config_h)
-intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \
-       keymap.h $(config_h)
-composite.o: composite.c buffer.h  character.h $(INTERVAL_SRC) $(config_h)
+composite.o: composite.c buffer.h character.h coding.h font.h ccl.h \
+        frame.h termhooks.h $(INTERVALS_H) window.h lisp.h $(config_h)
+intervals.o: intervals.c buffer.h $(INTERVALS_H) keyboard.h puresize.h \
+       keymap.h lisp.h $(config_h) systime.h coding.h
+textprop.o: textprop.c buffer.h window.h $(INTERVALS_H) \
+       lisp.h $(config_h)
+
+#endif /* ! AUTO_DEPEND */
 
 /* System-specific programs to be made.
-   OTHER_FILES and OBJECTS_MACHINE
+   OTHER_FILES
    select which of these should be compiled.  */
 
-#ifdef HAVE_CARBON
-buffer.o callint.o cmds.o dispnew.o editfns.o fileio.o frame.o \
-  fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \
-  scroll.o sysdep.o term.o terminal.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \
-  xterm.o xselect.o sound.o: macgui.h
-mac.o: mac.c process.h sysselect.h blockinput.h atimer.h systime.h charset.h \
-  coding.h ccl.h $(config_h)
-macfns.o: macfns.c charset.h macterm.h macgui.h frame.h window.h buffer.h \
-  dispextern.h macgui.h fontset.h $(INTERVAL_SRC) keyboard.h blockinput.h \
-  atimer.h systime.h epaths.h termhooks.h coding.h $(config_h)
-macmenu.o: macmenu.c termhooks.h frame.h window.h dispextern.h macgui.h \
-  keyboard.h blockinput.h atimer.h systime.h buffer.h macterm.h $(config_h)
-macterm.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \
-  frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h termopts.h \
-  termchar.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \
-  process.h coding.h $(config_h)
-macselect.o: blockinput.h atimer.h systime.h macterm.h macgui.h frame.h \
-  keymap.h $(config_h)
-mactoolbox.o: blockinput.h atimer.h systime.h macterm.h macgui.h frame.h \
-  charset.h coding.h ccl.h dispextern.h fontset.h termhooks.h buffer.h \
-  window.h keyboard.h $(config_h)
-
-${emacsapp}Contents/Resources/English.lproj:
-       mkdir -p $@
-
-ifneq (${emacsapp},${emacsappsrc})
-${emacsapp}Contents/Info.plist: ${emacsappsrc}Contents/Info.plist
-       cp $< $@
-${emacsapp}Contents/PkgInfo: ${emacsappsrc}Contents/PkgInfo
-       cp $< $@
-${emacsapp}Contents/Resources/Emacs.icns: ${emacsappsrc}Contents/Resources/Emacs.icns
-       mkdir -p ${emacsapp}Contents/Resources
-       cp $< $@
-${emacsapp}Contents/Resources/English.lproj/InfoPlist.strings: ${emacsappsrc}Contents/Resources/English.lproj/InfoPlist.strings
-       cp $< $@
-endif
-
-macosx-bundle: ${emacsapp}Contents/Resources/English.lproj \
-       ${emacsapp}Contents/Info.plist ${emacsapp}Contents/PkgInfo \
-       ${emacsapp}Contents/Resources/Emacs.icns \
-       ${emacsapp}Contents/Resources/English.lproj/InfoPlist.strings
-macosx-app: macosx-bundle ${emacsapp}Contents/MacOS/Emacs
-${emacsapp}Contents/MacOS/Emacs: emacs${EXEEXT}
-       mkdir -p ${emacsapp}Contents/MacOS/;
-       cd ${emacsapp}Contents/MacOS/; cp ../../../../src/emacs${EXEEXT} Emacs${EXEEXT}
-#endif
+#ifdef HAVE_NS
+/* In fact, every .o file depends directly or indirectly on dispextern.h
+   and hence nsgui.h under NS.  But the ones that actually use stuff there
+   are more limited.  */
+dispnew.o font.o fontset.o frame.o fringe.o image.o keyboard.o menu.o \
+   window.o xdisp.o xfaces.o: nsgui.h
+
+${ns_appdir}: ${ns_appsrc}
+       rm -fr ${ns_appdir}
+       mkdir -p ${ns_appdir}
+       ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; tar xf - )
+       ( cd ${ns_appdir} ; for subdir in `find . -type d ! -name CVS -print` ; do \
+               chmod a+rx $${subdir} ; \
+               rm -rf $${subdir}/CVS ; \
+               rm -f  $${subdir}/.cvsignore ; done ; )
+
+${ns_appbindir}Emacs: emacs${EXEEXT}
+       mkdir -p ${ns_appbindir}
+       cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
+
+ns-app: ${ns_appdir} ${ns_appbindir}Emacs
+
+#endif /* HAVE_NS */
 
 mostlyclean:
        rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
        rm -f ../etc/DOC
        rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT}
-       rm -f buildobj.lst
+       rm -f buildobj.h
 clean: mostlyclean
        rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
+       -rm -rf deps
+#ifdef HAVE_NS
+       rm -fr ${ns_appdir}
+#endif
 /* bootstrap-clean is used to clean up just before a bootstrap.
    It should remove all files generated during a compilation/bootstrap,
    but not things like config.status or TAGS.  */
@@ -1310,8 +1354,8 @@ extraclean: distclean
 /* Arrange to make a tags table TAGS-LISP for ../lisp,
    plus TAGS for the C files, which includes ../lisp/TAGS by reference.  */
 
-ctagsfiles1 = [xyzXYZ]*.[hc]
-ctagsfiles2 = [a-wA-W]*.[hc]
+ctagsfiles1 = [xyzXYZ]*.[hcm]
+ctagsfiles2 = [a-wA-W]*.[hcm]
 
 TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2)
        ../lib-src/etags --include=TAGS-LISP --include=${lwlibdir}/TAGS \
@@ -1358,13 +1402,13 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS
    With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)"  */
 .el.elc:
        @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \
-                            THEFILE=$< EMACS=../src/bootstrap-emacs${EXEEXT}
+                            THEFILE=$< EMACS=${bootstrap_exe}
 
 /* Since the .el.elc rule cannot specify an extra dependency, we do it here.  */
 ${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS)
 
 ${lispsource}loaddefs.el: $(BOOTSTRAPEMACS)
-       cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=../src/bootstrap-emacs${EXEEXT}
+       cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe}
 
 /* Dump an Emacs executable named bootstrap-emacs containing the
    files from loadup.el in source form.  */
@@ -1372,10 +1416,15 @@ ${lispsource}loaddefs.el: $(BOOTSTRAPEMACS)
 bootstrap-emacs${EXEEXT}: temacs${EXEEXT}
        cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
 #ifdef CANNOT_DUMP
-       ln temacs${EXEEXT} bootstrap-emacs${EXEEXT}
+       ln -f temacs${EXEEXT} bootstrap-emacs${EXEEXT}
 #else
        $(RUN_TEMACS) --batch --load loadup bootstrap
        mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}
 #endif /* ! defined (CANNOT_DUMP) */
        @: Compile some files earlier to speed up further compilation.
-       cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=../src/bootstrap-emacs${EXEEXT}
+       cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe}
+
+#ifdef AUTO_DEPEND
+ALLOBJS=$(STARTFILES) ${obj} ${otherobj} prefix-args.o
+-include $(ALLOBJS:%.o=deps/%.d)
+#endif