* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
[bpt/emacs.git] / src / Makefile.in
index baf41d4..cba9dff 100644 (file)
@@ -5,10 +5,10 @@
 
 # This file is part of GNU Emacs.
 
-# GNU Emacs is free software; you can redistribute it and/or modify
+# 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 3, or (at your option)
-# any later version.
+# the Free Software Foundation, either version 3 of the License, 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
@@ -16,9 +16,7 @@
 # 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., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 
 # Note that this file is edited by msdos/sed1v2.inp for MSDOS.  That
@@ -53,16 +51,12 @@ version=@version@
 # LIBS = @LIBS@
 LIBOBJS = @LIBOBJS@
 
-# On Xenix and the IBM RS6000, double-dot gets screwed up.
-dot = .
-dotdot = ${dot}${dot}
-lispsource = ${srcdir}/$(dot)$(dot)/lisp/
-admindir = $(srcdir)/$(dot)$(dot)/admin/
-libsrc = $(dot)$(dot)/lib-src/
-etc = $(dot)$(dot)/etc/
-oldXMenudir = $(dot)$(dot)/oldXMenu/
-lwlibdir = $(dot)$(dot)/lwlib/
-lispdir = $(dot)$(dot)/lisp/
+lispsource = ${srcdir}/../lisp/
+libsrc = ../lib-src/
+etc = ../etc/
+oldXMenudir = ../oldXMenu/
+lwlibdir = ../lwlib/
+lispdir = ../lisp/
 
 # Configuration files for .o files to depend on.
 M_FILE = ${srcdir}/@machfile@
@@ -78,7 +72,6 @@ C_SWITCH_SYSTEM=
 SHELL=/bin/sh
 
 #define THIS_IS_MAKEFILE
-#define NO_SHORTNAMES
 #define NOT_C_CODE
 #include "config.h"
 
@@ -100,11 +93,6 @@ SHELL=/bin/sh
    do not let it interfere with this file.  */
 #undef register
 
-/* On some systems we may not be able to use the system make command. */
-#ifdef MAKE_COMMAND
-MAKE = MAKE_COMMAND
-#endif
-
 /* GNU libc requires ORDINARY_LINK so that its own crt0 is used.
    GNU/Linux is an exception because it uses a funny variant of GNU libc.  */
 #ifdef __GNU_LIBRARY__
@@ -124,6 +112,12 @@ MAKE = MAKE_COMMAND
 #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
@@ -241,18 +235,13 @@ STARTFILES = START_FILES
 #endif /* not ORDINARY_LINK */
 
 
-#if HAVE_GTK
-#define USE_GTK
-TOOLKIT_DEFINES = -DUSE_GTK
-#endif
-
-#ifdef USE_X_TOOLKIT
-#define USE_@X_TOOLKIT_TYPE@
-TOOLKIT_DEFINES = -DUSE_@X_TOOLKIT_TYPE@
-#else
-#ifndef USE_GTK
-TOOLKIT_DEFINES =
-#endif
+#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
@@ -274,9 +263,12 @@ 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 $(TOOLKIT_DEFINES) $(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_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@
+.SUFFIXES: .m
 .c.o:
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
+.m.o:
+       $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) GNU_OBJC_CFLAGS $<
 
 #ifndef LIBX11_SYSTEM
 #define LIBX11_SYSTEM
@@ -286,13 +278,8 @@ ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcd
 #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
-
+XMENU_OBJ = xmenu.o
 XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o
 
 #ifdef HAVE_MENUS
@@ -323,29 +310,23 @@ LIBXMENU=
 #endif /* not HAVE_MENUS */
 
 #ifdef USE_X_TOOLKIT
-#define @X_TOOLKIT_TYPE@
-#if defined (LUCID) || defined (ATHENA)
-#if HAVE_XAW3D
-LIBW= -lXaw3d
-#else
-LIBW= -lXaw
-#endif
-#endif
-#ifdef MOTIF
-#if defined (HAVE_MOTIF_2_1) && defined (HAVE_LIBXP)
-#define LIB_MOTIF_EXTRA -lXp
-#else
-#define LIB_MOTIF_EXTRA
-#endif
-#ifdef LIB_MOTIF
-LIBW= LIB_MOTIF LIB_MOTIF_EXTRA
-#else
-LIBW= -lXm LIB_MOTIF_EXTRA
-#endif
-#endif
-#ifdef OPEN_LOOK
-LIBW= -lXol
-#endif
+# define @X_TOOLKIT_TYPE@
+# if HAVE_XAW3D
+LUCID_LIBW= -lXaw3d
+# else
+LUCID_LIBW= -lXaw
+# endif
+# if defined (HAVE_MOTIF_2_1) && defined (HAVE_LIBXP)
+#  define LIB_MOTIF_EXTRA -lXp
+# else
+#  define LIB_MOTIF_EXTRA
+# endif
+# ifdef LIB_MOTIF
+MOTIF_LIBW= LIB_MOTIF LIB_MOTIF_EXTRA
+# else
+MOTIF_LIBW= -lXm LIB_MOTIF_EXTRA
+# endif
+LIBW=$(@X_TOOLKIT_TYPE@_LIBW)
 
 #ifdef HAVE_X11XTR6
 #ifdef NEED_LIBW
@@ -359,14 +340,7 @@ LIBXTR6 = -lSM -lICE
 #define LIBXMU -lXmu
 #endif
 
-#ifdef LIBXT_STATIC
-/* We assume the config files have defined STATIC_OPTION
-   since that might depend on the operating system.
-   (Do not forget you need different definitions with and without __GNUC__.)  */
-LIBXT= STATIC_OPTION $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext DYNAMIC_OPTION
-#else /* not LIBXT_STATIC */
 LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext
-#endif /* not LIBXT_STATIC */
 
 #else /* not USE_X_TOOLKIT */
 
@@ -464,8 +438,6 @@ RSVG_CFLAGS= @RSVG_CFLAGS@
 /* Fix linking if compiled with GCC.  */
 #ifdef __GNUC__
 
-#if __GNUC__ > 1
-
 #ifdef LINKER
 #define LINKER_WAS_SPECIFIED
 #endif
@@ -501,13 +473,6 @@ GNULIB_VAR = LIB_GCC
 #define YMF_PASS_LDFLAGS(flags) flags
 #endif
 
-#else /* __GNUC__ < 2 */
-
-#ifndef LIB_GCC
-#define LIB_GCC /usr/local/lib/gcc-gnulib
-#endif /* not LIB_GCC */
-GNULIB_VAR = `if [ -f LIB_GCC ] ; then echo LIB_GCC; else echo; fi`
-#endif /* __GNUC__ < 2 */
 #else /* not __GNUC__ */
 GNULIB_VAR =
 
@@ -542,9 +507,6 @@ TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_S
 #ifndef UNEXEC
 #define UNEXEC unexec.o
 #endif
-#ifndef UNEXEC_SRC
-#define UNEXEC_SRC unexec.c
-#endif
 
 INTERVAL_SRC = intervals.h composite.h
 
@@ -563,34 +525,41 @@ CYGWIN_OBJ = sheap.o
 #endif
 
 #ifdef HAVE_CARBON
-mac = $(dot)$(dot)/mac/
-MAC_OBJ = mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o fringe.o image.o
+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
+/* Object files for NeXTstep */
+NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
+       fontset.o fringe.o image.o
+emacsapp = $(PWD)/../nextstep/build/Emacs.app/
+#ifdef NS_IMPL_GNUSTEP
+emacsappsrc = ${srcdir}/../nextstep/GNUstep/Emacs.base
+emacsbindir = $(emacsapp)
+#else
+emacsappsrc = ${srcdir}/../nextstep/Cocoa/Emacs.base
+emacsbindir = $(emacsapp)/Contents/MacOS/
+#endif  /* NS_IMPL_GNUSTEP */
+#endif  /* HAVE_NS */
+
 #ifdef HAVE_WINDOW_SYSTEM
-FONTSRC = font.h
-#ifdef USE_FONT_BACKEND
 #ifdef HAVE_X_WINDOWS
 #if defined (HAVE_XFT)
-FONTOBJ = font.o xfont.o ftfont.o xftfont.o ftxfont.o
+FONT_DRIVERS = xfont.o ftfont.o xftfont.o ftxfont.o
 #elif defined (HAVE_FREETYPE)
-FONTOBJ = font.o xfont.o ftfont.o ftxfont.o
+FONT_DRIVERS = xfont.o ftfont.o ftxfont.o
 #else /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
-FONTOBJ = font.o xfont.o
+FONT_DRIVERS = xfont.o
 #endif /* ! defined (HAVE_XFT) && ! defined (HAVE_FREETYPE) */
-#else /* ! HAVE_X_WINDOWS */
-FONTOBJ = font.o
-#endif /* ! HAVE_X_WINDOWS */
-#else  /* ! USE_FONT_BACKEND */
-FONTOBJ = font.o
-#endif /* ! USE_FONT_BACKEND */
+#endif /* HAVE_X_WINDOWS */
 #endif /* HAVE_WINDOW_SYSTEM */
 
 /* lastfile must follow all files
    whose initialized data areas should be dumped as pure by dump-emacs.  */
-obj=    dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
+obj=    dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
        charset.o coding.o category.o ccl.o character.o chartab.o \
        cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
        emacs.o keyboard.o macros.o keymap.o sysdep.o \
@@ -598,12 +567,12 @@ obj=    dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
        minibuf.o fileio.o dired.o filemode.o \
        cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
        alloc.o data.o doc.o editfns.o callint.o \
-       eval.o floatfns.o fns.o print.o lread.o \
+       eval.o floatfns.o fns.o font.o print.o lread.o \
        syntax.o UNEXEC bytecode.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) $(FONTOBJ)
+       $(MSDOS_OBJ) $(MAC_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_DRIVERS)
 
 /* Object files used on some machine or other.
    These go in the DOC file on all machines
@@ -611,8 +580,9 @@ obj=    dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
 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 \
-  w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
-  w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONTOBJ)
+  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)
 
 
 #ifdef TERMINFO
@@ -729,7 +699,11 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(widgetobj) $(LIBOBJS)
    Files included conditionally here should be included (unconditionally)
    in SOME_MACHINE_LISP.  */
 
+/* Place loaddefs.el first, so it gets generated first, since it is on
+   the critical path (relevant in parallel compilations).  */
+
 lisp= \
+       ${lispsource}loaddefs.el \
        ${lispsource}abbrev.elc \
        ${lispsource}buff-menu.elc \
        ${lispsource}button.elc \
@@ -754,7 +728,6 @@ lisp= \
        ${lispsource}isearch.elc \
        ${lispsource}rfn-eshadow.elc \
        ${lispsource}loadup.el \
-       ${lispsource}loaddefs.el \
        ${lispsource}bindings.elc \
        ${lispsource}emacs-lisp/map-ynp.elc \
        ${lispsource}menu-bar.elc \
@@ -767,10 +740,7 @@ lisp= \
        ${lispsource}language/chinese.el \
        ${lispsource}language/cyrillic.el \
        ${lispsource}language/indian.el \
-       ${lispsource}language/devanagari.el \
-       ${lispsource}language/kannada.el \
-       ${lispsource}language/malayalam.el \
-       ${lispsource}language/tamil.el \
+       ${lispsource}language/sinhala.el \
        ${lispsource}language/english.el \
        ${lispsource}language/ethiopic.elc \
        ${lispsource}language/european.elc \
@@ -796,6 +766,7 @@ lisp= \
        ${lispsource}register.elc \
        ${lispsource}replace.elc \
        ${lispsource}simple.elc \
+       ${lispsource}minibuffer.elc \
        ${lispsource}startup.elc \
        ${lispsource}subr.elc \
        ${lispsource}term/tty-colors.elc \
@@ -811,6 +782,7 @@ lisp= \
        ${lispsource}jka-cmpr-hook.elc \
        ${lispsource}vc-hooks.elc \
        ${lispsource}ediff-hook.elc \
+       ${lispsource}epa-hook.elc \
        TOOLTIP_SUPPORT \
        VMS_SUPPORT \
        MSDOS_SUPPORT \
@@ -825,6 +797,7 @@ lisp= \
    It need not contain the files that are loaded conditionally
    because SOME_MACHINE_LISP has those.  */
 shortlisp= \
+       ../lisp/loaddefs.el \
        ../lisp/abbrev.elc \
        ../lisp/buff-menu.elc \
        ../lisp/button.elc \
@@ -847,7 +820,6 @@ shortlisp= \
        ../lisp/isearch.elc \
        ../lisp/rfn-eshadow.elc \
        ../lisp/loadup.el \
-       ../lisp/loaddefs.el \
        ../lisp/bindings.elc \
        ../lisp/emacs-lisp/map-ynp.elc \
        ../lisp/env.elc \
@@ -859,10 +831,7 @@ shortlisp= \
        ../lisp/language/chinese.el \
        ../lisp/language/cyrillic.el \
        ../lisp/language/indian.el \
-       ../lisp/language/devanagari.el \
-       ../lisp/language/kannada.el \
-       ../lisp/language/malayalam.el \
-       ../lisp/language/tamil.el \
+       ../lisp/language/sinhala.el \
        ../lisp/language/english.el \
        ../lisp/language/ethiopic.elc \
        ../lisp/language/european.elc \
@@ -889,6 +858,7 @@ shortlisp= \
        ../lisp/register.elc \
        ../lisp/replace.elc \
        ../lisp/simple.elc \
+       ../lisp/minibuffer.elc \
        ../lisp/startup.elc \
        ../lisp/subr.elc \
        ../lisp/term/tty-colors.elc \
@@ -904,6 +874,7 @@ shortlisp= \
        ../lisp/vc-hooks.elc \
        ../lisp/jka-cmpr-hook.elc \
        ../lisp/ediff-hook.elc \
+       ../lisp/epa-hook.elc \
        ../lisp/widget.elc \
        ../lisp/window.elc \
        ../lisp/version.el
@@ -913,26 +884,29 @@ shortlisp= \
    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.  */
-SOME_MACHINE_LISP = ${dotdot}/lisp/mouse.elc \
-  ${dotdot}/lisp/select.elc ${dotdot}/lisp/scroll-bar.elc \
+SOME_MACHINE_LISP = ../lisp/mouse.elc \
+  ../lisp/select.elc ../lisp/scroll-bar.elc \
   VMS_SUPPORT \
-  ${dotdot}/lisp/ls-lisp.elc ${dotdot}/lisp/dos-fns.elc \
-  ${dotdot}/lisp/w32-fns.elc ${dotdot}/lisp/dos-w32.elc \
-  ${dotdot}/lisp/disp-table.elc ${dotdot}/lisp/dos-vars.elc \
-  ${dotdot}/lisp/tooltip.elc ${dotdot}/lisp/image.elc \
-  ${dotdot}/lisp/fringe.elc ${dotdot}/lisp/dnd.elc \
-  ${dotdot}/lisp/mwheel.elc ${dotdot}/lisp/tool-bar.elc \
-  ${dotdot}/lisp/x-dnd.elc \
-  ${dotdot}/lisp/international/ccl.elc \
-  ${dotdot}/lisp/international/codepage.elc \
-  ${dotdot}/lisp/international/fontset.elc \
-  ${dotdot}/lisp/mouse.elc \
-  ${dotdot}/lisp/term/x-win.elc
+  ../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/international/ccl.elc \
+  ../lisp/international/codepage.elc \
+  ../lisp/international/fontset.elc \
+  ../lisp/mouse.elc \
+  ../lisp/term/x-win.elc \
+  ../lisp/term/ns-win.elc \
+  ../lisp/ns-carbon-compat.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) \
@@ -957,14 +931,20 @@ RUN_TEMACS = `/bin/pwd`/temacs
 
 all: emacs${EXEEXT} OTHER_FILES
 
-emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
+emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} ${SOME_MACHINE_LISP}
 #ifdef CANNOT_DUMP
        rm -f emacs${EXEEXT}
        ln temacs${EXEEXT} emacs${EXEEXT}
 #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) */
+/* XXX: not working under NS currently due to path shenanigans.. */
+#ifndef HAVE_NS
        -./emacs -q -batch -f list-load-path-shadows
+#endif
 
 /* We run make-docfile twice because the command line may get too long
    on some systems.  */
@@ -974,7 +954,12 @@ emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
    for the first time, this prevents any variation between configurations
    in the contents of the DOC file.
    Likewise for ${SOME_MACHINE_LISP}.  */
-${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${shortlisp} ${SOME_MACHINE_LISP}
+/* Most of this Makefile refers to Lisp files via ${lispsource}, so
+   we also use ${lisp} rather than ${shortlisp} for the dependency since
+   the Makefile uses string equality to decide when we talk about identical
+   files.  Apparently we pass ${shortlisp} rather than ${lisp} to make-docfile
+   only in order to reduce the command line length.  --Stef  */
+${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${lisp} ${SOME_MACHINE_LISP}
        -rm -f ${etc}DOC
        ${libsrc}make-docfile -d ${srcdir} ${SOME_MACHINE_OBJECTS} ${obj} > ${etc}DOC
        ${libsrc}make-docfile -a ${etc}DOC -d ${srcdir} ${SOME_MACHINE_LISP} ${shortlisp}
@@ -982,21 +967,15 @@ ${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${shortlisp} ${SOME_MACHINE_LIS
 ${libsrc}make-docfile${EXEEXT}:
        cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile${EXEEXT}
 
-#ifdef HAVE_UNIDATA
-UNIDATA=${admindir}unidata/UnicodeData.txt
-
-${lispsource}international/charprop.el: temacs${EXEEXT} ${UNIDATA}
-       RUNEMACS="$(RUN_TEMACS)"; \
-       cd ${admindir}unidata; \
-       $(MAKE) $(MFLAGS) \
-         RUNEMACS="$${RUNEMACS}" DSTDIR=${lispsource}international
-#endif
-
 temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
        echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
+#ifdef NS_IMPL_GNUSTEP
+       $(CC) -rdynamic YMF_PASS_LDFLAGS (${TEMACS_LDFLAGS}) -o temacs ${obj} ${otherobj} OBJECTS_MACHINE ${LIBES}
+#else
        $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
     -o temacs ${STARTFILES} ${obj} ${otherobj}  \
     OBJECTS_MACHINE ${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,
@@ -1004,7 +983,7 @@ temacs${EXEEXT}: $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJ
 prefix-args${EXEEXT}: prefix-args.c $(config_h)
        $(CC) $(ALL_CFLAGS) $(LDFLAGS) ${srcdir}/prefix-args.c -o prefix-args
 
-#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (HAVE_GTK)
+#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (USE_GTK)
 
 /* We use stamp-xmenu with these two deps
    to both ensure that lwlib gets remade based on its dependencies
@@ -1053,12 +1032,12 @@ really-oldXMenu:
        @true  /* make -t should not create really-oldXMenu.  */
 .PHONY: really-oldXMenu
 #endif /* not USE_X_TOOLKIT */
-#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
+#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */
 
 /* We don''t really need this, but satisfy the dependency.  */
 stamp-oldxmenu:
        touch stamp-oldxmenu
-#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */
+#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! USE_GTK) */
 
 ../config.status:: epaths.in
        @echo "The file epaths.h needs to be set up from epaths.in."
@@ -1128,17 +1107,18 @@ filelock.o: filelock.c buffer.h character.h charset.h coding.h systime.h \
    epaths.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 \
+   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)
 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 $(FONTSRC) $(config_h)
+   charset.h frame.h keyboard.h termhooks.h font.h $(config_h)
 getloadavg.o: getloadavg.c $(config_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 $(config_h)
+   systime.h xterm.h w32term.h w32gui.h macterm.h macgui.h font.h \
+   nsterm.h nsgui.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
@@ -1147,7 +1127,8 @@ insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h character.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)
+   atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h nsterm.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)
@@ -1195,10 +1176,17 @@ terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.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)
-/* This hack is to discard any space that cpp might put at the beginning
-   of UNEXEC when substituting it in.  */
-UNEXEC_ALIAS=UNEXEC
-$(UNEXEC_ALIAS): UNEXEC_SRC $(config_h)
+unexaix.o: unexaix.c $(config_h)
+unexalpha.o: unexalpha.c $(config_h)
+unexcw.o: unexcw.c $(config_h)
+unexec.o: unexec.c $(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)
+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)
 widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
@@ -1206,33 +1194,36 @@ widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.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)
+   xterm.h w32term.h macterm.h nsterm.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 $(FONTSRC)
+   w32term.h macterm.h nsterm.h msdos.h composite.h fontset.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 $(FONTSRC) $(config_h)
+   systime.h keyboard.h fontset.h w32term.h macterm.h nsterm.h $(INTERVAL_SRC) \
+   termchar.h termhooks.h font.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 $(FONTSRC)
+   fontset.h termchar.h font.h
 xfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
    font.h $(config_h)
 xftfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
    font.h $(config_h)
 ftxfont.o: dispextern.h xterm.h frame.h blockinput.h character.h charset.h \
    font.h $(config_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 menu.h \
+   $(config_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 $(config_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 gnu.h character.h charset.h ccl.h fontset.h composite.h \
-   coding.h process.h gtkutil.h $(FONTSRC) $(config_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)
 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
@@ -1264,7 +1255,7 @@ fns.o: fns.c commands.h $(config_h) frame.h buffer.h character.h keyboard.h \
  blockinput.h atimer.h systime.h xterm.h termhooks.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
+   blockinput.h atimer.h systime.h font.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
 
@@ -1293,10 +1284,13 @@ 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 gnu.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \
+  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 $@
@@ -1321,30 +1315,69 @@ 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
+#endif /* HAVE_CARBON */
+
+#ifdef HAVE_NS
+abbrev.o 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 widget.o window.o xdisp.o xfaces.o xfns.o \
+  xterm.o xselect.o sound.o: nsgui.h
+nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
+  dispextern.h nsgui.h fontset.h $(INTERVAL_SRC) keyboard.h blockinput.h \
+  atimer.h systime.h epaths.h termhooks.h coding.h systime.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 $(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 \
+  $(INTERVAL_SRC) process.h coding.h $(config_h)
+nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h $(config_h)
+nsimage.o: nsimage.m nsterm.h
+nsfont.o: nsterm.h dispextern.h frame.h lisp.h $(config_h)
+
+${emacsapp}: ${emacsappsrc}
+       mkdir -p ${emacsapp}
+       ( cd ${emacsappsrc} ; tar cfh - . ) | ( cd ${emacsapp} ; tar xf - )
+
+${emacsbindir}Emacs: emacs${EXEEXT}
+       mkdir -p ${emacsbindir}
+       cp -f emacs${EXEEXT} ${emacsbindir}Emacs
+
+ns-app: ${emacsapp} ${emacsbindir}Emacs
+
+#endif /* HAVE_NS */
 
-bootstrapclean:
-       rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT}
 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
 clean: mostlyclean
-       rm -f emacs-*${EXEEXT} emacs${EXEEXT}
+       rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
+#ifdef NS_IMPL_GNUSTEP
+       rm -f *.d
+#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.  */
+bootstrap-clean: clean
+       rm -f epaths.h config.h Makefile.c config.stamp stamp-oldxmenu ../etc/DOC-*
+       if test -f ./.gdbinit; then \
+         mv ./.gdbinit ./.gdbinit.save; \
+         if test -f "${srcdir}/.gdbinit"; then rm -f ./.gdbinit.save; \
+         else mv ./.gdbinit.save ./.gdbinit; fi; \
+       fi
 /**/# This is used in making a distribution.
 /**/# Do not use it on development directories!
-distclean: clean
-       rm -f epaths.h config.h Makefile Makefile.c config.stamp stamp-oldxmenu ../etc/DOC-*
-       mv ./.gdbinit ./.gdbinit.save
-       if test -f "${srcdir}/.gdbinit"; then rm -f ./.gdbinit.save; \
-       else mv ./.gdbinit.save ./.gdbinit; fi
+distclean: bootstrap-clean
+       rm -f Makefile
 maintainer-clean: distclean
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
        rm -f TAGS
 versionclean:
-       -rm -f emacs${EXEEXT} emacs-* ../etc/DOC*
+       -rm -f emacs${EXEEXT} emacs-*.*.*${EXEEXT} ../etc/DOC*
 extraclean: distclean
        -rm -f *~ \#* m/?*~ s/?*~
 
@@ -1370,16 +1403,53 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS
 
 
 /* Bootstrapping.  */
-
-bootstrap: bootstrap-emacs${EXEEXT}
+/* Bootstrapping right is difficult because of the circular dependencies.
+   Furthermore, we have to deal with the fact that many compilation targets
+   such as loaddefs.el or *.elc can typically be produced by any old
+   Emacs executable, so we would like to avoid rebuilding them whenever
+   we build a new Emacs executable.
+   To solve the circularity, we use 2 different Emacs executables,
+   "emacs" is the main target and "bootstrap-emacs" is the one used
+   to build the *.elc and loaddefs.el files.
+   To solve the freshness issue, we used to use a third file "witness-emacs"
+   which was used to witness the fact that there is a bootstrap-emacs
+   executable, and then have dependencies on witness-emacs rather than
+   bootstrap-emacs, but that lead to problems in parallel builds (because
+   witness-emacs needed to be free from dependencies (to avoid rebuilding
+   it), so it was compiled in parallel, leading typically to having 2
+   processes dumping bootstrap-emacs at the same time).
+   So instead, we replace the witness-emacs dependencies by conditional
+   bootstrap-dependencies (via ${BOOTSTRAPEMACS}).  Of course, since we do
+   not want to rely on GNU Make features, we have to rely on an external
+   script to do the conditional part of the dependency
+   (i.e. see the ${SUBDIR} rule ../Makefile.in).  */
+
+.SUFFIXES: .elc .el
+
+/* These suffix rules do not allow additional dependencies, sadly, so
+   instead of adding a $(BOOTSTRAPEMACS) dependency here, we add it
+   separately below.
+   With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)"  */
+.el.elc:
+       @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \
+                            THEFILE=$< EMACS=../src/bootstrap-emacs${EXEEXT}
+
+/* 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}
 
 /* Dump an Emacs executable named bootstrap-emacs containing the
    files from loadup.el in source form.  */
 
-bootstrap-emacs${EXEEXT}: temacs${EXEEXT} ${lispsource}international/charprop.el
+bootstrap-emacs${EXEEXT}: temacs${EXEEXT}
+       cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
 #ifdef CANNOT_DUMP
        ln 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}