/* Makefile for GNU Emacs.
   Copyright (C) 1985, 1987, 1988, 1990, 1992 Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.  No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing.  Refer to the GNU Emacs General Public
License for full details.

Everyone is granted permission to copy, modify and redistribute
GNU Emacs, but only under the conditions described in the
GNU Emacs General Public License.   A copy of this license is
supposed to have been given to you along with GNU Emacs so you
can know your rights and responsibilities.  It should be in a
file named COPYING.  Among other things, the copyright notice
and this notice must be preserved on all copies.  */

COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) -c

dot = .
/* on Xenix, replace double-dot below with $(dot)$(dot) */
lispdir = ${I_DIR_PREFIX}../lisp/
etcdir = ../etc/
/* etcDOC = ${I_DIR_PREFIX}${etcdir}DOC */
etcDOC = ${etcdir}DOC
libdir = ../lib/

/* #define SOURCE_BROWSER */
#define NO_SHORTNAMES
#define THIS_IS_YMAKEFILE
#define NOT_C_CODE
#include "config.h"

#ifdef I18N3
modir = ${libdir}LC_MESSAGES/C/msgs/
#endif

#ifdef USE_GCC
CC=gcc
#else
#ifdef USE_LCC
# define LIB_STANDARD
LCC = lcc
/*LCC = cadlcc -XBAA*/
# define LCCFLAGS -Xa -wucp -XW'[Oo]ld style func dcl' \
		  $(EMACS_ENERGIZE_CONNECT)
# if 1
CC = ${LCC} LCCFLAGS
# else
CC = ${LCC} LCCFLAGS -XH -iuniverse.h
# endif
#endif
#endif

/* On some machines #define register is done in config;
   don't let it interfere with this file.  */
#undef register

#ifndef LIB_GCC
#define LIB_GCC
#endif

/* Some machines don't find the standard C libraries in the usual place.  */
#ifndef LIB_STANDARD
#define LIB_STANDARD -lc
#endif

/* Unless inhibited or changed, use -lg to link for debugging.  */
#ifndef LIBS_DEBUG
#define LIBS_DEBUG -lg
#endif

/* Some s- files define this to request special libraries.  */
#ifndef LIBS_SYSTEM
#define LIBS_SYSTEM
#endif

/* Some m- files define this to request special libraries.  */
#ifndef LIBS_MACHINE
#define LIBS_MACHINE
#endif

#ifndef LIB_MATH
# define LIB_MATH -lm
#endif

/* Some s- files define this to request special switches in ld.  */
#ifndef LD_SWITCH_SYSTEM
#if defined(COFF_ENCAPSULATE) || (defined (BSD) && !defined (COFF))
# ifndef USE_GCC
#  define LD_SWITCH_SYSTEM -X
# else
#  define LD_SWITCH_SYSTEM
# endif
#else
#define LD_SWITCH_SYSTEM
#endif /* COFF, or not BSD */
#endif

/* Some m- files define this to request special switches in ld.  */
#ifndef LD_SWITCH_MACHINE
#define LD_SWITCH_MACHINE
#endif

/* Some m- files define this to request special switches in cc.  */
#ifndef C_SWITCH_MACHINE
#define C_SWITCH_MACHINE
#endif

/* Some s- files define this to request special switches in cc.  */
#ifndef C_SWITCH_SYSTEM
#define C_SWITCH_SYSTEM
#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 START_FILES
#ifdef NO_REMAP
#ifdef COFF_ENCAPSULATE
#define START_FILES pre-crt0.o /usr/local/lib/gcc-crt0.o
#else
#define START_FILES pre-crt0.o /lib/crt0.o
#endif
#else /* not NO_REMAP */
#define START_FILES crt0.o
#endif /* not NO_REMAP */
#endif /* have START_FILES */
STARTFILES = START_FILES

/* Unless inhibited or changed, use -g to compile for debugging.  */
#ifndef C_DEBUG_SWITCH
# ifdef SOURCE_BROWSER
#  define C_DEBUG_SWITCH -g -xs
# else
#  define C_DEBUG_SWITCH -g
# endif
#endif

/* If user wants to optimize, this is how.  */
#ifndef C_OPTIMIZE_SWITCH
#define C_OPTIMIZE_SWITCH -O
#endif

/* cc switches needed to make `asm' keyword work.
   Nothing special needed on most machines.  */
#ifndef C_SWITCH_ASM
#define C_SWITCH_ASM
#endif

/* Specify address for ld to start loading at,
   if requested by configuration.  */

#ifdef LD_TEXT_START_ADDR
STARTFLAGS = -T LD_TEXT_START_ADDR -e __start
#endif

#ifdef COFF_ENCAPSULATE
LD=$(CC) -nostdlib
#else /* !COFF_ENCAPSULATE */
#ifdef LD_CMD
LD=LD_CMD
#else /* !LD_CMD */
#if defined(USE_GCC) && defined(__GNUC__) && (__GNUC__ >= 2)
LD=$(CC) -nostdlib
#undef LIB_GCC
#define LIB_GCC -lgcc
#else /* !GNUC >= 2 */
#ifdef AIX
LD=cc
#else  /* !AIX */
LD=ld
#endif /* !AIX */
#endif /* !GNUC >= 2 */
#endif /* !LD_CMD */
#endif /* !COFF_ENCAPSULATE */

ILD=/cadillac1/code/bin.sun4/ild

PURIFY=/usr/local/purify/purify

/* Figure out whether the system cpp can handle long names.
   Do it by testing it right now.
   If it loses, arrange to use the GNU cpp.  */

#define LONGNAMEBBBFOOX
#ifdef LONGNAMEBBBARFOOX
/* Installed cpp fails to distinguish those names!  */
/* Arrange to compile the GNU cpp later on */
#define NEED_CPP
/* Cause cc to invoke the cpp that comes with Emacs,
   which will be in a file named localcpp.  */
MYCPPFLAG= -Blocal 
/* LOCALCPP is the local one or nothing.
   CPP is the local one or the standardone.  */
LOCALCPP= localcpp
#endif /* NEED_CPP */

#ifdef SHORTNAMES
SHORT= shortnames
#endif /* SHORTNAMES */

/* 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
   Emacs is dumped for the first time, and never changed again. */

/* You may replace C_DEBUG_SWITCH with C_OPTIMIZE_SWITCH
   if you don't believe in debugging. */

/* -Demacs is needed to make some files produce the
   correct version for use in Emacs.  */

#ifdef USE_SOUND
# ifdef sparc
#  ifdef USG
#   define SOUND_CFLAGS   -I/usr/demo/SOUND/include
#   define SOUND_LIBS   -L/usr/demo/SOUND/lib -laudio
#   define SOUND_OBJS   play.o
#  else /* !USG */
#   define SOUND_CFLAGS	-I/usr/demo/SOUND
#   define SOUND_LIBS	-L/usr/demo/SOUND -laudio
#   define SOUND_OBJS	play.o
#  endif /* !USG */
# else /* ! sparc */
#  ifdef sgi
#   define SOUND_CFLAGS
#   define SOUND_LIBS	-laudio
#   define SOUND_OBJS	sgiplay.o
#  else /* ! sgi */
#   ifdef hp9000s800
#    ifdef USE_GCC
      /* due to some braindead HP include files, -traditional is necessary */
#    define SOUND_CFLAGS -traditional -Dconst= -Dvolatile= -I/usr/audio/examples
#    else /* ! USE_GCC */
#     define SOUND_CFLAGS   +e -I/usr/audio/examples 
#    endif /* USE_GCC */
#    define SOUND_LIBS	-lAlib	
#    define SOUND_OBJS	hpplay.o
#   else /* ! hp9000s800 */
  ERROR!!  USE_SOUND can only be defined on SparcStation, SGI, or hp9000s800
#   endif /* ! hp9000s800 */
#  endif /* ! sgi */
# endif /* ! sparc */
#else /* ! USE_SOUND */
# define SOUND_CFLAGS
# define SOUND_LIBS
# define SOUND_OBJS
#endif /* ! USE_SOUND */

#ifdef ENERGIZE
CONN_DIR=../connection
# define ENERGIZE_INCLUDES -I${I_DIR_PREFIX}${CONN_DIR}
# define ENERGIZE_LDFLAGS -L${CONN_DIR}
# define ENERGIZE_LIBS -lenergize
#else /* !ENERGIZE */
# define ENERGIZE_INCLUDES
# define ENERGIZE_LDFLAGS
# define ENERGIZE_LIBS
#endif /* !ENERGIZE */


CFLAGS= C_DEBUG_SWITCH C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE \
	-Demacs $(MYCPPFLAG) $(LIBX11_INCLUDES) 

LDFLAGS= LD_SWITCH_SYSTEM LD_SWITCH_MACHINE LD_SWITCH_SITE \
	-L. $(LIBX11_LDFLAGS) ENERGIZE_LDFLAGS 

#ifndef LIBX11_MACHINE
#define LIBX11_MACHINE
#endif

#ifndef LIBX11_SYSTEM
#define LIBX11_SYSTEM
#endif

#ifdef HAVE_X_WINDOWS
XOBJ= xterm.o xfns.o xselect.o xutils.o event-Xt.o menubar.o xgccache.o \
      xobjs.o scrollbar.o

LWLIBDIR = ../lwlib

LIBX11_LDFLAGS = -L$(LWLIBDIR)
LIBX11_INCLUDES = -I$(LWLIBDIR)

#ifdef HAVE_XPM
XPM_LIBS = -lXpm
#endif /* !HAVE_XPM */

#ifdef LWLIB_USES_MOTIF
TOOLKIT_LIBS = -lXm
#else /* ! LWLIB_USES_MOTIF */
#ifdef LWLIB_USES_OLIT
TOOLKIT_LIBS = -lXol
#else /* ! LWLIB_USES_OLIT */
TOOLKIT_LIBS = -lXaw
#endif /* ! LWLIB_USES_OLIT */
#endif /* ! LWLIB_USES_MOTIF */

LIBX11_LIBS = -llw $(TOOLKIT_LIBS) $(XPM_LIBS) -lXext -lXt

LIBX=  $(LIBX11_LIBS) -lXmu -lX11 LIBX11_MACHINE LIBX11_SYSTEM

#endif /* HAVE_X_WINDOWS */

/* Allow config.h to specify a replacement file for unexec.c.  */
#ifndef UNEXEC
#define UNEXEC unexec.o
#endif

#ifdef ENERGIZE
# ifdef EMACS_BTL
   BTLDIR=../btl
#  define BTLOBJS cadillac-btl.o cadillac-btl-process.o cadillac-btl-asm.o \
		  cadillac-btl-emacs.o
# else
#  define BTLOBJS
# endif /* BTL */
# if defined(FREE_CHECKING) || defined(DEBUG_INPUT_BLOCKING) || defined(DEBUG_GCPRO)
#  define FREECHECKOBJS free-hook.o
# else  /* !FREE */
#  define FREECHECKOBJS
# endif /* !FREE */
# define ENERGIZE_OBJS editorside.o FREECHECKOBJS
#else /* !ENERGIZE */
# define ENERGIZE_OBJS
# define BTLOBJS
#endif /* !ENERGIZE */

#ifdef NEED_REALPATH
#define REALPATH_OBJS realpath.o
#else
#define REALPATH_OBJS
#endif

#ifdef TOOLTALK
# define TOOLTALK_OBJS tooltalk.o
  /* -lsocket -lnsl -lintl -ldl are already included from s-solaris2.h */
# define LIB_TOOLTALK -ltt -lce
#else /* !TOOLTALK */
# define TOOLTALK_OBJS
# define LIB_TOOLTALK
#endif /* !TOOLTALK */

#ifdef SPARCWORKS
# define SPARCWORKS_OBJS sparcworks.o
  /* Remove -ufind_run_directory, -lxview, -lolgx when tcm fixes it. */
# define LIB_SPARCWORKS -ufind_run_directory -lswtt -lswint
#else
# define SPARCWORKS_OBJS
# define LIB_SPARCWORKS 
#endif

#if (defined(LIB_INTL) && (!(defined(I18N3) || defined(I18N4))))
  /* this should be defined by s- files, but we should not use it unless
     I18N3 or I18N4 are defined. */
# undef LIB_INTL
#endif

#ifndef LIB_INTL
# define LIB_INTL
#endif

#ifdef MOCKLISP_SUPPORT
# define MOCKLISPOBJS mocklisp.o
#else
# define MOCKLISPOBJS
#endif

#ifdef DRAGNDROP
# define DRAGNDROP_OBJS xtfunc.o dragndrop.o opaque.o
#else
# define DRAGNDROP_OBJS
#endif

/* lastfile must follow all files whose initialized data areas should
   be dumped as pure by dump-emacs.
 */
/* scroll.o removed for now because it isn't being used at all. */
obj=    dispnew.o screen.o xdisp.o window.o \
	events.o event-alloc.o event-stream.o \
	term.o cm.o $(XOBJ) SOUND_OBJS \
	emacs.o keyboard.o macros.o keymap.o sysdep.o \
	buffer.o filelock.o insdel.o marker.o \
	minibuf.o fileio.o dired.o filemode.o \
	cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
	pure.o alloc.o data.o doc.o editfns.o callint.o intl.o \
	eval.o floatfns.o fns.o print.o lread.o symbols.o getloadavg.o \
	abbrev.o syntax.o font_lock.o UNEXEC MOCKLISPOBJS bytecode.o \
	process.o callproc.o elhash.o hash.o doprnt.o \
	extents.o REALPATH_OBJS ENERGIZE_OBJS \
	faces.o DRAGNDROP_OBJS TOOLTALK_OBJS SPARCWORKS_OBJS

#ifdef TERMINFO
/* Used to be -ltermcap here.  If your machine needs that,
   define LIBS_TERMCAP in the m- file.  */
#ifndef LIBS_TERMCAP
#define LIBS_TERMCAP -lcurses
#endif
termcapobj = terminfo.o
#else
#ifndef LIBS_TERMCAP
#define LIBS_TERMCAP
termcapobj = termcap.o tparam.o
#else
termcapobj = tparam.o
#endif
#endif

#undef alloca

#ifndef HAVE_ALLOCA
#define ALLOCA_OBJ alloca.o
#else
#define ALLOCA_OBJ
#endif /* No ALLOCA */

#ifndef SYSTEM_MALLOC
# ifdef OLD_GNU_MALLOC
mallocobj = malloc.o ALLOCA_OBJ
# else /* New GNU malloc */
#  ifdef REL_ALLOC
mallocobj = gmalloc.o ralloc.o vm-limit.o ALLOCA_OBJ
#  else /* !REL_ALLOC */
mallocobj = gmalloc.o vm-limit.o ALLOCA_OBJ
#  endif /* !REL_ALLOC */
# endif /* New GNU malloc */
#else /* !SYSTEM_MALLOC */
mallocobj = ALLOCA_OBJ
#endif /* !SYSTEM_MALLOC */

#ifdef HAVE_X_WINDOWS

# ifdef EXTERNAL_WIDGET
#  define EXTERNAL_WIDGET_OBJ EmacsShell.o
#  define OTHER_FILES libemacswidget.a libemacswidget.so.1
# else  /* !EXTERNAL_WIDGET */
#  define EXTERNAL_WIDGET_OBJ
# endif /* !EXTERNAL_WIDGET */

# define LIBX11_OBJ EmacsScreen.o EXTERNAL_WIDGET_OBJ
# define LWLIB_DEPS $(LWLIBDIR)/liblw.a

#else /* !X */
# define LIBX11_OBJ
# define LWLIB_DEPS
#endif

/* define otherobj as list of object files that make-docfile
   should not be told about.  */
otherobj= $(termcapobj) BTLOBJS lastfile.o $(mallocobj) LIBX11_OBJ
  
#ifdef LISP_FLOAT_TYPE
#define FLOAT_LISP ${lispdir}prim/float-sup.elc
#else
#define FLOAT_LISP
#endif

#ifdef HAVE_X_WINDOWS
/* lisp files that are preloaded if compiled with support for X Windows */
#define X11_LISP ${lispdir}prim/screen.elc ${lispdir}prim/menubar.elc \
                ${lispdir}x11/x-faces.elc \
                ${lispdir}x11/x-iso8859-1.elc ${lispdir}x11/x-mouse.elc \
                ${lispdir}prim/mouse.elc ${lispdir}prim/mode-motion.elc \
                ${lispdir}x11/xselect.elc
#else
#define X11_LISP
#endif

#ifdef ENERGIZE
/* Lisp files that are preloaded if compiled with support for Energize
 */
#define ENERGIZE_LISP ${lispdir}modes/c++-mode.elc ${lispdir}comint/gdb.elc \
                ${lispdir}comint/comint.elc ${lispdir}comint/shell.elc \
                ${lispdir}utils/ring.elc ${lispdir}packages/compile.elc \
                ${lispdir}modes/view-less.elc ${lispdir}emulators/evi.elc \
                ${lispdir}dired/dired.elc ${lispdir}dired/dired-x.elc \
                ${lispdir}dired/dired-lucid.elc ${lispdir}prim/userlock.elc \
                ${lispdir}energize/energize-init.elc \
                ${lispdir}energize/energize-mode.elc \
                ${lispdir}energize/energize-windows.elc \
                ${lispdir}energize/energize-menus.elc \
                ${lispdir}energize/energize-shell.elc \
                ${lispdir}energize/energize-visit-use.elc \
                ${lispdir}energize/energize-vi.elc \
                ${lispdir}energize/energize-font-lock.elc \
                ${lispdir}energize/energize-advice.elc
#else
#define ENERGIZE_LISP
#endif


#ifdef LISP_COMMAND_LOOP
#define CMDLOOP_LISP ${lispdir}prim/cmdloop1.elc
#else
#define CMDLOOP_LISP
#endif

/* List of Lisp files loaded into the dumped Emacs.
   Every file that is loaded from loadup.el must be enumerated
   here, or the functions won't have have docstrings.
   This is dumb, this list should be generated automatically.
   [Note: "version.el" is included in the doc separately, but is not listed 
    here because we don't want things to appear to be out-of-date just 
    because the version number has been incremented. -- D.N.G. 8/28/93]
 */
lisp=   ${lispdir}paths.el \
        ${lispdir}prim/loadup.el ${lispdir}prim/subr.elc \
        ${lispdir}prim/cmdloop.elc CMDLOOP_LISP \
        ${lispdir}prim/keymap.elc ${lispdir}prim/syntax.elc \
        ${lispdir}prim/minibuf.elc ${lispdir}prim/faces.elc \
        ${lispdir}prim/loaddefs.el ${lispdir}prim/keydefs.el \
        ${lispdir}prim/simple.elc ${lispdir}prim/help.elc \
        ${lispdir}prim/files.elc ${lispdir}prim/indent.elc \
        ${lispdir}prim/window.elc ${lispdir}prim/startup.elc \
        ${lispdir}prim/lisp.elc ${lispdir}prim/page.elc \
        ${lispdir}prim/register.elc ${lispdir}prim/iso8859-1.elc \
        ${lispdir}prim/paragraphs.elc ${lispdir}modes/lisp-mode.elc \
        ${lispdir}modes/text-mode.elc ${lispdir}prim/fill.elc \
        ${lispdir}modes/c-mode.elc ${lispdir}prim/isearch-mode.elc \
        ${lispdir}prim/replace.elc ${lispdir}modes/abbrev.elc \
        ${lispdir}packages/buff-menu.elc \
        ${lispdir}bytecomp/bytecomp-runtime.elc \
        ${lispdir}prim/itimer.elc FLOAT_LISP X11_LISP ENERGIZE_LISP

/* just to be sure the sh is used */
SHELL=/bin/sh

LIBES = SOUND_LIBS ENERGIZE_LIBS $(LIBX) \
	LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
	LIB_TOOLTALK LIB_SPARCWORKS LIB_INTL \
	LIBS_DEBUG LIB_GCC LIB_MATH LIB_STANDARD

/* Enable recompilation of certain other files depending on system type.  */

#ifndef OTHER_FILES
#define OTHER_FILES
#endif

/* Enable inclusion of object files in temacs depending on system type.  */
#ifndef OBJECTS_SYSTEM
#define OBJECTS_SYSTEM
#endif

#ifndef OBJECTS_MACHINE
#define OBJECTS_MACHINE
#endif

all: release OTHER_FILES

/* "make release" to build "xemacs" with an incremented version number;
   "make xemacs" to just build "xemacs" without incrementing the version. */

#ifdef I18N3
# define MOFILE ${modir}emacs.mo
#else
# define MOFILE
#endif

release: temacs ${lisp} ${etcDOC} MOFILE OTHER_FILES
	./temacs -batch -l inc-vers
	./temacs -batch -l loadup.el dump
	touch release

xemacs: temacs ${lisp} ${etcDOC} MOFILE OTHER_FILES
	./temacs -batch -l loadup.el dump

obj_src = $(obj:.o=.c)

${etcDOC}: ${etcdir}make-docfile $(obj_src) ${lisp}
	rm -f ${etcDOC}
	${etcdir}make-docfile ${obj_src} ${lispdir}version.el ${lisp} \
		> ${etcDOC}

#ifdef I18N3

# ifdef SPARCWORKS
otherlisp = ${lispdir}sunpro/spro-menubar.el
# else /* !SPARCWORKS */
otherlisp = 
# endif /* !SPARCWORKS */

# if defined(sparc) && !defined(USG)
   xgettext=		 /usr/openwin/bin/xgettext
   xgettext_args=	 -o emacs -m_X messages
   msgfmt=		 /usr/openwin/bin/msgfmt
# else
   xgettext=		 xgettext
   xgettext_args=	 -s -d emacs -M_X messages
   msgfmt=		 msgfmt
#endif

${modir}emacs.po: ${etcdir}make-msgfile ${etcdir}make-po ${obj} ${lisp}
	${etcdir}make-msgfile -o ${etcdir}messages ${obj} ${lisp} ${otherlisp}
	cd ${etcdir}; ${xgettext} ${xgettext_args}
	-cd ${modir}; rm -f emacs.po
	cd ${etcdir}; ./make-po -a ${modir}emacs.po DOC

${modir}emacs.mo: ${modir}emacs.po
	cd ${modir}; ${msgfmt} -o emacs.mo emacs.po

${etcdir}make-msgfile:
	cd ${etcdir}; ${MAKE} ${MFLAGS} make-msgfile

${etcdir}make-po:
	cd ${etcdir}; ${MAKE} ${MFLAGS} make-po

#endif /* I18N3 */

${etcdir}make-docfile:
	cd ${etcdir}; ${MAKE} ${MFLAGS} make-docfile

/* Some systems define this to cause parallel Make-ing.  */
#ifndef MAKE_PARALLEL
#define MAKE_PARALLEL
#endif

#define TEMACS_DEPS       MAKE_PARALLEL $(LOCALCPP) $(SHORT) $(STARTFILES) \
			  ${obj} ${otherobj} OBJECTS_SYSTEM OBJECTS_MACHINE \
			  LWLIB_DEPS

#define TEMACS_LINK_ARGS  ${STARTFLAGS} ${LDFLAGS} -o $@ \
			  ${STARTFILES} ${obj} ${otherobj} OBJECTS_SYSTEM \
			  OBJECTS_MACHINE ${LIBES}

temacs: TEMACS_DEPS
	$(LD)  TEMACS_LINK_ARGS

cemacs: TEMACS_DEPS
	$(LD) TEMACS_LINK_ARGS

puremacs: TEMACS_DEPS
	$(PURIFY) $(LD) TEMACS_LINK_ARGS

#ifdef EXTERNAL_WIDGET
EmacsWidget.o:
	$(COMPILE.c) -K pic EmacsWidget.c

libemacswidget.a: EmacsWidget.o
	ar r libemacswidget.a EmacsWidget.o

# ifdef USG5
libemacswidget.so.1: EmacsWidget.o
#  ifdef USE_GCC
	$(CC) -shared EmacsWidget.o -Xlinker -z -Xlinker text -o libemacswidget.so.1
#  else /* not USE_GCC */
	$(CC) -G EmacsWidget.o -z text -o libemacswidget.so.1
#  endif /* not USE_GCC */
# else /* not USG5 */
libemacswidget.so.1: EmacsWidget.o
	$(LD) -dc EmacsWidget.o -assert pure-text -o libemacswidget.so.1
# endif /* not USG5 */

#endif /* EXTERNAL_WIDGET */


#ifdef HAVE_X_WINDOWS
/* In a multi-architecture configuration, "lwlib" has already been made
   at the level above this, using "lwlib/makefile", not "lwlib/Makefile". */
# ifndef MULTI_OBJ_DIR
$(LWLIBDIR)/Makefile: $(LWLIBDIR)/Imakefile
	cd $(LWLIBDIR); if [ -f Makefile ]; then $(MAKE) Makefile;else xmkmf;fi

$(LWLIBDIR)/liblw.a: $(LWLIBDIR)/Makefile
	cd $(LWLIBDIR) ; $(MAKE) $(MFLAGS) all
# endif /* !MULTI_OBJ_DIR */
#endif /* HAVE_X_WINDOWS */

/* These are needed for C compilation, on the systems that need them */
#ifdef NEED_CPP
CPP = ./localcpp
localcpp:
	cd ${cppdir}; ${MAKE} ${MFLAGS} EMACS=-Demacs
	ln ${cppdir}cpp localcpp  /* Name where CFLAGS will refer to it */
/* cc appears to be cretinous and require all of these to exist
   if -B is specified -- we can't use one local pass and let the
   others be the standard ones.  What a loser.
   We can't even use ln, since they are probably
   on different disks.  */
	cp /lib/ccom localccom
	-cp /lib/optim localoptim
	-cp /lib/c2 localc2
	cp /bin/as localas
#else /* not NEED_CPP */
CPP = $(CC) -E
#endif /* need NEED_CPP */

#ifdef SHORTNAMES
shortnames:
	cd ${shortnamesdir}; ${MAKE} ${MFLAGS}
#endif /* SHORTNAMES */

/* these are more trouble than they're worth when using cvs
paths.h: paths.h-dist
	@sh -c "if test -r $@; then echo $? is newer than $@; exit 1;\
	  else exit 0; fi"
	cp $? $@

config.h: config.h-dist
	@sh -c "if test -r $@; then echo $? is newer than $@; exit 1;\
	  else exit 0; fi"
	cp $? $@
*/

/* Some machines have alloca built-in.
   They should define HAVE_ALLOCA, or may just let alloca.s
   be used but generate no code.
   Some have it written in assembler in alloca.s.
   Some use the C version in alloca.c (these define C_ALLOCA in config.h).
   */

#ifdef C_ALLOCA
alloca.o : alloca.c
#else
#ifndef HAVE_ALLOCA
alloca.o : alloca.s config.h
/* $(CPP) is cc -E, which may get confused by filenames
   that do not end in .c.  So copy file to a safe name.  */
	cp alloca.s allocatem.c
/* remove any ^L, blank lines, and preprocessor comments,
   since some assemblers barf on them */
	$(CPP) allocatem.c | \
	sed -e 's///' -e 's/^#.*//' | \
	sed -n -e '/^..*$$/p' > allocatem.s
	-rm -f alloca.o
/* Xenix, in particular, needs to run assembler via cc.  */
	cc -c allocatem.s
	mv allocatem.o alloca.o
	rm allocatem.s allocatem.c
#endif /* HAVE_ALLOCA */
#endif /* not C_ALLOCA */

#ifdef USE_LCC  /* lcc doesn't do asm() yet */
crt0.o: crt0.c
	gcc -c -g -Demacs $<

free-hook.o: free-hook.c
	gcc -c -g -Demacs $<
#endif /* USE_LCC */

#ifdef EMACS_BTL
BTL_INCLUDES=-I$(BTLDIR)
# define BTL_COMPILE \
	-DEMACS_BTL -D`lucid-arch` -I. $(BTL_INCLUDES) $(BTLDIR)/$(@:.o=.c)

cadillac-btl.o cadillac-btl-process.o cadillac-btl-emacs.o:
	$(CC) $(CFLAGS) -c BTL_COMPILE
# ifndef USE_LCC
cadillac-btl-asm.o:
	$(CC) $(CFLAGS) -c BTL_COMPILE
# else  /* lcc doesn't do asm() yet */
cadillac-btl-asm.o:
	gcc -O -g       -c BTL_COMPILE
# endif /* lcc */
#endif /* EMACS_BTL */

#ifdef ENERGIZE
editorside.o:
	$(CC) -c $(CFLAGS) ENERGIZE_INCLUDES $(BTL_INCLUDES) $(@:.o=.c)
#endif /* ENERGIZE */

#ifdef USE_SOUND
# ifdef sparc
play.o:
	$(CC) -c $(CFLAGS) SOUND_CFLAGS $(@:.o=.c)
# endif /* sparc */
# ifdef hp9000s800
hpplay.o:
	$(CC) -c $(CFLAGS) SOUND_CFLAGS $(@:.o=.c)
# endif /* hp9000s800 */
#endif /* USE_SOUND */

/* System-specific programs to be made.
   OTHER_FILES, OBJECTS_SYSTEM and OBJECTS_MACHINE
   select which of these should be compiled.  */

${etcdir}emacstool: ${etcdir}emacstool.c
	cd ${etcdir}; ${MAKE} ${MFLAGS} emacstool


/* Nearly all the following files depend on lisp.h, emacsfns.h, and lrecord.h,
   but they are not included as a dependency because they are so often changed
   in ways that do not require any recompilation and so rarely changed in ways
   that do require any.  */

/* Energize-generated dependencies */

EmacsShell.o: EmacsShell.h
EmacsShell.o: EmacsShellP.h
EmacsShell.o: config.h
EmacsScreen.o: EmacsScreen.h
EmacsScreen.o: EmacsScreenP.h
EmacsScreen.o: blockio.h
EmacsScreen.o: config.h
EmacsScreen.o: dispextern.h
EmacsScreen.o: screen.h
EmacsScreen.o: xobjs.h
EmacsScreen.o: xterm.h
abbrev.o: buffer.h
abbrev.o: bufslots.h
abbrev.o: commands.h
abbrev.o: config.h
abbrev.o: insdel.h
abbrev.o: window.h
alloc.o: backtrace.h
alloc.o: blockio.h
alloc.o: buffer.h
alloc.o: bufslots.h
alloc.o: bytecode.h
alloc.o: config.h
alloc.o: dispextern.h
alloc.o: elhash.h
alloc.o: events.h
alloc.o: extents.h
alloc.o: puresize.h
alloc.o: screen.h
alloc.o: window.h
alloc.o: xterm.h
buffer.o: blockio.h
buffer.o: buffer.h
buffer.o: bufslots.h
buffer.o: commands.h
buffer.o: config.h
buffer.o: dispextern.h
buffer.o: insdel.h
buffer.o: process.h
buffer.o: screen.h
buffer.o: symeval.h
buffer.o: syntax.h
buffer.o: sysdep.h
buffer.o: window.h
buffer.o: xobjs.h
buffer.o: xterm.h
bytecode.o: buffer.h
bytecode.o: bufslots.h
bytecode.o: config.h
bytecode.o: syntax.h
#ifdef EMACS_BTL
cadillac-btl.o: $(BTLDIR)/cadillac-btl.c
cadillac-btl.o: $(BTLDIR)/cadillac-btl.h
cadillac-btl.o: $(BTLDIR)/cadillac-btl-extern.h
cadillac-btl-asm.o: $(BTLDIR)/cadillac-btl-asm.c
cadillac-btl-asm.o: $(BTLDIR)/cadillac-btl.h
cadillac-btl-asm.o: $(BTLDIR)/cadillac-btl-extern.h
cadillac-btl-emacs.o: $(BTLDIR)/cadillac-btl-extern.h
cadillac-btl-process.o: $(BTLDIR)/cadillac-btl-process.c
cadillac-btl-process.o: $(BTLDIR)/cadillac-btl.h
cadillac-btl-process.o: $(BTLDIR)/cadillac-btl-extern.h
#endif /* EMACS_BTL */
callint.o: buffer.h
callint.o: bufslots.h
callint.o: bytecode.h
callint.o: commands.h
callint.o: config.h
callint.o: window.h
callproc.o: buffer.h
callproc.o: bufslots.h
callproc.o: commands.h
callproc.o: config.h
callproc.o: dispmisc.h
callproc.o: insdel.h
callproc.o: paths.h
callproc.o: process.h
callproc.o: sysdep.h
callproc.o: syssignal.h
casefiddle.o: buffer.h
casefiddle.o: bufslots.h
casefiddle.o: commands.h
casefiddle.o: config.h
casefiddle.o: insdel.h
casefiddle.o: syntax.h
casetab.o: buffer.h
casetab.o: bufslots.h
casetab.o: config.h
cm.o: cm.h
cm.o: config.h
cm.o: dispmisc.h
cm.o: termhooks.h
cmds.o: buffer.h
cmds.o: bufslots.h
cmds.o: commands.h
cmds.o: config.h
cmds.o: insdel.h
cmds.o: syntax.h
crt0.o: config.h
data.o: config.h
data.o: syssignal.h
dired.o: buffer.h
dired.o: bufslots.h
dired.o: commands.h
dired.o: config.h
dired.o: regex.h
dispnew.o: blockio.h
dispnew.o: buffer.h
dispnew.o: bufslots.h
dispnew.o: cm.h
dispnew.o: commands.h
dispnew.o: config.h
dispnew.o: dispextern.h
dispnew.o: dispmisc.h
dispnew.o: disptab.h
dispnew.o: extents.h
dispnew.o: indent.h
dispnew.o: screen.h
dispnew.o: sysdep.h
dispnew.o: termchar.h
dispnew.o: termopts.h
dispnew.o: window.h
dispnew.o: xobjs.h
dispnew.o: xterm.h
doc.o: buffer.h
doc.o: bufslots.h
doc.o: bytecode.h
doc.o: config.h
doc.o: insdel.h
doc.o: keymap.h
doprnt.o: config.h
editfns.o: buffer.h
editfns.o: bufslots.h
editfns.o: config.h
editfns.o: events.h
editfns.o: insdel.h
editfns.o: systime.h
editfns.o: window.h
#ifdef ENERGIZE
editorside.o: blockio.h
editorside.o: buffer.h
editorside.o: bufslots.h
#ifdef EMACS_BTL
editorside.o: $(BTLDIR)/cadillac-btl-extern.h
#endif
editorside.o: config.h
editorside.o: dispextern.h
editorside.o: editorside.h
editorside.o: events.h
editorside.o: extents.h
editorside.o: hash.h
editorside.o: insdel.h
editorside.o: $(LWLIBDIR)/lwlib.h
editorside.o: process.h
editorside.o: screen.h
editorside.o: window.h
editorside.o: xobjs.h
editorside.o: xterm.h
#endif
elhash.o: config.h
elhash.o: elhash.h
elhash.o: hash.h
emacs.o: commands.h
emacs.o: config.h
emacs.o: process.h
emacs.o: sysdep.h
emacs.o: syssignal.h
emacs.o: systty.h
eval.o: backtrace.h
eval.o: blockio.h
eval.o: bytecode.h
eval.o: commands.h
eval.o: config.h
event-Xt.o: EmacsScreen.h
event-Xt.o: EmacsScreenP.h
event-Xt.o: blockio.h
event-Xt.o: config.h
event-Xt.o: dispextern.h
event-Xt.o: events.h
event-Xt.o: $(LWLIBDIR)/lwlib.h
event-Xt.o: process.h
event-Xt.o: screen.h
event-Xt.o: xterm.h
event-alloc.o: buffer.h
event-alloc.o: bufslots.h
event-alloc.o: config.h
event-alloc.o: dispextern.h
event-alloc.o: events.h
event-alloc.o: process.h
event-alloc.o: screen.h
event-alloc.o: window.h
event-stream.o: buffer.h
event-stream.o: bufslots.h
event-stream.o: commands.h
event-stream.o: config.h
event-stream.o: events.h
event-stream.o: keymap.h
event-stream.o: macros.h
event-stream.o: process.h
event-stream.o: systime.h
event-stream.o: window.h
events.o: buffer.h
events.o: bufslots.h
events.o: config.h
events.o: dispextern.h
events.o: events.h
events.o: screen.h
events.o: window.h
extents.o: blockio.h
extents.o: buffer.h
extents.o: bufslots.h
extents.o: config.h
extents.o: dispextern.h
extents.o: extents.h
extents.o: faces.h
extents.o: hash.h
extents.o: process.h
extents.o: xterm.h
faces.o: blockio.h
faces.o: buffer.h
faces.o: bufslots.h
faces.o: config.h
faces.o: dispextern.h
faces.o: dispmisc.h
faces.o: extents.h
faces.o: faces.h
faces.o: hash.h
faces.o: indent.h
faces.o: screen.h
faces.o: window.h
faces.o: xobjs.h
faces.o: xterm.h
fileio.o: buffer.h
fileio.o: bufslots.h
fileio.o: config.h
fileio.o: insdel.h
fileio.o: sysdep.h
fileio.o: systime.h
fileio.o: window.h
filelock.o: buffer.h
filelock.o: bufslots.h
filelock.o: config.h
filelock.o: paths.h
filemode.o: config.h
floatfns.o: config.h
fns.o: buffer.h
fns.o: bufslots.h
fns.o: bytecode.h
fns.o: commands.h
fns.o: config.h
fns.o: dispextern.h
fns.o: events.h
fns.o: extents.h
fns.o: screen.h
fns.o: sysdep.h
fns.o: systime.h
font_lock.o: buffer.h
font_lock.o: bufslots.h
font_lock.o: config.h
font_lock.o: syntax.h
free-hook.o: blockio.h
free-hook.o: config.h
free-hook.o: hash.h
getloadavg.o: config.h
gmalloc.o: config.h
gmalloc.o: getpagesize.h
hash.o: config.h
hash.o: hash.h
indent.o: blockio.h
indent.o: buffer.h
indent.o: bufslots.h
indent.o: config.h
indent.o: dispextern.h
indent.o: dispmisc.h
indent.o: disptab.h
indent.o: extents.h
indent.o: indent.h
indent.o: insdel.h
indent.o: screen.h
indent.o: termchar.h
indent.o: termopts.h
indent.o: window.h
indent.o: xobjs.h
indent.o: xterm.h
insdel.o: buffer.h
insdel.o: bufslots.h
insdel.o: config.h
insdel.o: dispextern.h
insdel.o: extents.h
insdel.o: insdel.h
insdel.o: window.h
keyboard.o: backtrace.h
keyboard.o: blockio.h
keyboard.o: buffer.h
keyboard.o: bufslots.h
keyboard.o: commands.h
keyboard.o: config.h
keyboard.o: dispextern.h
keyboard.o: disptab.h
keyboard.o: events.h
keyboard.o: macros.h
keyboard.o: screen.h
keyboard.o: sysdep.h
keyboard.o: syssignal.h
keyboard.o: systime.h
keyboard.o: systty.h
keyboard.o: termchar.h
keyboard.o: termhooks.h
keyboard.o: termopts.h
keyboard.o: window.h
keymap.o: buffer.h
keymap.o: bufslots.h
keymap.o: commands.h
keymap.o: config.h
keymap.o: elhash.h
keymap.o: events.h
keymap.o: insdel.h
keymap.o: keymap.h
lastfile.o: config.h
libsst.o: libsst.h
lread.o: buffer.h
lread.o: bufslots.h
lread.o: bytecode.h
lread.o: commands.h
lread.o: config.h
lread.o: paths.h
macros.o: buffer.h
macros.o: bufslots.h
macros.o: commands.h
macros.o: config.h
macros.o: events.h
macros.o: macros.h
macros.o: window.h
malloc.o: config.h
malloc.o: getpagesize.h
marker.o: buffer.h
marker.o: bufslots.h
marker.o: config.h
menubar.o: blockio.h
menubar.o: buffer.h
menubar.o: bufslots.h
menubar.o: commands.h
menubar.o: config.h
menubar.o: dispextern.h
menubar.o: dispmisc.h
menubar.o: events.h
menubar.o: $(LWLIBDIR)/lwlib.h
menubar.o: screen.h
menubar.o: window.h
menubar.o: xterm.h
minibuf.o: buffer.h
minibuf.o: bufslots.h
minibuf.o: commands.h
minibuf.o: config.h
minibuf.o: dispextern.h
minibuf.o: dispmisc.h
minibuf.o: screen.h
minibuf.o: window.h
mocklisp.o: buffer.h
mocklisp.o: bufslots.h
mocklisp.o: config.h
play.o: config.h
print.o: buffer.h
print.o: bufslots.h
print.o: bytecode.h
print.o: config.h
print.o: dispextern.h
print.o: extents.h
print.o: insdel.h
print.o: screen.h
print.o: window.h
process.o: buffer.h
process.o: bufslots.h
process.o: commands.h
process.o: config.h
process.o: events.h
process.o: insdel.h
process.o: process.h
process.o: sysdep.h
process.o: syssignal.h
process.o: systime.h
process.o: systty.h
process.o: syswait.h
process.o: termhooks.h
process.o: termopts.h
process.o: window.h
pure.o: config.h
pure.o: puresize.h
ralloc.o: config.h
ralloc.o: mem-limits.h
regex.o: buffer.h
regex.o: bufslots.h
regex.o: config.h
regex.o: regex.h
regex.o: syntax.h
screen.o: blockio.h
screen.o: buffer.h
screen.o: bufslots.h
screen.o: config.h
screen.o: dispextern.h
screen.o: extents.h
screen.o: faces.h
screen.o: screen.h
screen.o: window.h
screen.o: xterm.h
scroll.o: config.h
scroll.o: dispextern.h
scroll.o: dispmisc.h
scroll.o: screen.h
scroll.o: termchar.h
scrollbar.o: $(LWLIBDIR)/lwlib.h
scrollbar.o: buffer.h
scrollbar.o: config.h
scrollbar.o: lisp.h
scrollbar.o: lrecord.h
scrollbar.o: screen.h
scrollbar.o: window.h
scrollbar.o: xterm.h
search.o: buffer.h
search.o: bufslots.h
search.o: commands.h
search.o: config.h
search.o: insdel.h
search.o: regex.h
search.o: syntax.h
sgiplay.o: config.h
sgiplay.o: libst.h
strcmp.o: config.h
strcpy.o: config.h
sunOS-fix.o: config.h
symbols.o: config.h
symbols.o: buffer.h
symbols.o: bufslots.h
symbols.o: config.h
symbols.o: symeval.h
syntax.o: buffer.h
syntax.o: bufslots.h
syntax.o: commands.h
syntax.o: config.h
syntax.o: insdel.h
syntax.o: syntax.h
sysdep.o: blockio.h
sysdep.o: config.h
sysdep.o: dispextern.h
sysdep.o: dispmisc.h
sysdep.o: process.h
sysdep.o: screen.h
sysdep.o: sysdep.h
sysdep.o: syssignal.h
sysdep.o: systime.h
sysdep.o: systty.h
sysdep.o: syswait.h
sysdep.o: termchar.h
sysdep.o: termhooks.h
sysdep.o: termopts.h
sysdep.o: window.h
term.o: cm.h
term.o: config.h
term.o: dispextern.h
term.o: dispmisc.h
term.o: disptab.h
term.o: screen.h
term.o: sysdep.h
term.o: termchar.h
term.o: termhooks.h
term.o: termopts.h
termcap.o: config.h
tparam.o: config.h
tparam.o: dispmisc.h
undo.o: buffer.h
undo.o: bufslots.h
undo.o: config.h
unexconvex.o: config.h
unexconvex.o: getpagesize.h
unexec.o: config.h
unexec.o: getpagesize.h
unexenix.o: config.h
unexmips.o: config.h
unexsunos4.o: config.h
vm-limit.o: config.h
vm-limit.o: mem-limits.h
vmsproc.o: clidef.h
vmsproc.o: dvidef.h
vmsproc.o: iodef.h
vmsproc.o: ssdef.h
vmsproc.o: vmsproc.h
window.o: blockio.h
window.o: buffer.h
window.o: bufslots.h
window.o: commands.h
window.o: config.h
window.o: dispextern.h
window.o: dispmisc.h
window.o: disptab.h
window.o: indent.h
window.o: screen.h
window.o: termchar.h
window.o: window.h
window.o: xobjs.h
window.o: xterm.h
xdisp.o: blockio.h
xdisp.o: buffer.h
xdisp.o: bufslots.h
xdisp.o: commands.h
xdisp.o: config.h
xdisp.o: dispextern.h
xdisp.o: dispmisc.h
xdisp.o: disptab.h
xdisp.o: extents.h
xdisp.o: indent.h
xdisp.o: process.h
xdisp.o: screen.h
xdisp.o: sysdep.h
xdisp.o: termchar.h
xdisp.o: termhooks.h
xdisp.o: window.h
xdisp.o: xobjs.h
xdisp.o: xterm.h
xfns.o: EmacsShell.h
xfns.o: EmacsShellP.h
xfns.o: EmacsScreen.h
xfns.o: EmacsScreenP.h
xfns.o: blockio.h
xfns.o: buffer.h
xfns.o: bufslots.h
xfns.o: config.h
xfns.o: dispextern.h
xfns.o: events.h
xfns.o: extents.h
xfns.o: faces.h
xfns.o: screen.h
xfns.o: window.h
xfns.o: xgccache.h
xfns.o: xobjs.h
xfns.o: xterm.h
xgccache.o: blockio.h
xgccache.o: config.h
xgccache.o: hash.h
xgccache.o: xgccache.h
xobjs.o: blockio.h
xobjs.o: config.h
xobjs.o: dispextern.h
xobjs.o: screen.h
xobjs.o: xobjs.h
xobjs.o: xterm.h
xselect.o: blockio.h
xselect.o: config.h
xselect.o: dispextern.h
xselect.o: screen.h
xselect.o: xterm.h
xterm.o: EmacsShell.h
xterm.o: EmacsShellP.h
xterm.o: EmacsScreen.h
xterm.o: EmacsScreenP.h
xterm.o: bitmaps.h
xterm.o: blockio.h
xterm.o: buffer.h
xterm.o: bufslots.h
xterm.o: config.h
xterm.o: dispextern.h
xterm.o: dispmisc.h
xterm.o: disptab.h
xterm.o: events.h
xterm.o: hash.h
xterm.o: $(LWLIBDIR)/lwlib.h
xterm.o: screen.h
xterm.o: sysdep.h
xterm.o: termchar.h
xterm.o: termhooks.h
xterm.o: termopts.h
xterm.o: window.h
xterm.o: xgccache.h
xterm.o: xobjs.h
xterm.o: xterm.h
xutils.o: blockio.h
xutils.o: config.h
xutils.o: dispextern.h
xutils.o: screen.h
xutils.o: xobjs.h
xutils.o: xterm.h
