4.3BSD/usr/contrib/emacs/src/ymakefile

/* Makefile for GNU Emacs.
   Copyright (C) 1985 Richard M. Stallman.

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.  */


#define NO_SHORTNAMES
#include "config.h"

/* library that contains select () and related stuff, on some system V's.
   I suspect that it is true for Uniplus and not others.  */
#ifdef UNIPLUS
LIBNET= -lnet
#endif

/* 4.1 has a jobs library that has to do with simulating some
   stuff that is standard in 4.2.  */
#ifdef BSD4_1
LIBJOBS= -ljobs
#endif

#ifdef HPUX
LIBBSD= -lBSD
LIBG= /usr/lib/end.o
#endif

/* -lg makes dbx work.  Maybe on sysV it makes sdb work.  */
#if !defined (APOLLO) && (defined (BSD) || defined (UNIPLUS))
LIBG= -lg
#endif

/* Some machines don't find the standard C libraries in the usual place.  */
#ifdef LIB_STANDARD
LIBSTD= LIB_STANDARD
#else
LIBSTD= -lc
#endif

/* -gx makes dbx work properly on a pyramid. */
#ifdef pyramid
DEBUGSWITCH= -gx
#else
DEBUGSWITCH= -g
#endif

/* -N is used on some USG systems to avoid a gap in addresses
   between the end of the text and the start of the data segment.  */
#ifdef LOADER_N_SWITCH
LDNSWITCH= -N
#endif

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

#ifdef TEXT_START_ADDR
STARTFLAGS = -T TEXT_START_ADDR -e TEXT_START_ADDR
#endif

#if defined (BSD) && !defined (COFF)
#ifdef celerity
LDFLAGS= -X -k100000
#else
LDFLAGS= -X
#endif
#else /* COFF, or not BSD */
#ifdef UNIPLUS
/* On the dual box under 5.2, ld must have -N and /usr/lib/unshared.ld to
   make an unshared version, and /usr/lib/shared.ld to make a shared version.
   The shared version is the only way to go, but initially there were
   problems with malloc.c for shared programs.
   fnf@Unisoft */
LDFLAGS= $(LDNSWITCH) -L/lib/libg /usr/lib/unshared.ld
#else
/* For system V */
LDFLAGS= $(LDNSWITCH)
#endif
#endif /* COFF, or not BSD */

#ifdef UMAX
/* Guarantee that text and data are aligned on 1 K boundaries */
ALIGNMENT= align.umax
#endif

/* 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 */

CFLAGS= $(DEBUGSWITCH) -Demacs $(MYCPPFLAG)
/* 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 $(DEBUGSWITCH) with -O if you don't believe in debugging. */

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


#ifdef HAVE_X_WINDOWS
XOBJ= xterm.o xfns.o
LIBX= -lX
#endif /* HAVE_X_WINDOWS */

/* lastfile must follow all files
   whose initialized data areas should be dumped as pure by dump-emacs. */
obj=    dispnew.o scroll.o xdisp.o window.o \
	term.o cm.o $(XOBJ) \
	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 casefiddle.o indent.o search.o regex.o undo.o \
	alloc.o data.o doc.o editfns.o callint.o \
	eval.o fns.o print.o lread.o \
	abbrev.o syntax.o unexec.o mocklisp.o bytecode.o \
	process.o callproc.o \
	doprnt.o

/* define otherobj as list of object files that make-docfile
   should not be told about.  */
#ifdef APOLLO
otherobj= termcap.o tparam.o lastfile.o
LTERMCAP= -ltermcap
#endif /* APOLLO */
#ifdef sun
/* SUN puts funny things in their termcap; must not replace it.  */
otherobj= tparam.o lastfile.o alloca.o malloc.o
LTERMCAP= -ltermcap
#endif /* sun */
#ifdef TERMINFO
otherobj= terminfo.o lastfile.o alloca.o malloc.o
LTERMCAP= -ltermcap
#endif /* TERMINFO */

#if !defined (APOLLO) && !defined (sun) && !defined (TERMINFO)
otherobj= termcap.o tparam.o lastfile.o alloca.o malloc.o
#endif

/* List of Lisp files loaded into the dumped Emacs. */
lisp=	../lisp/simple.elc ../lisp/files.elc ../lisp/window.elc \
	../lisp/indent.elc ../lisp/loaddefs.el ../lisp/paths.el \
	../lisp/startup.elc ../lisp/lisp.elc \
	../lisp/page.elc ../lisp/register.elc \
	../lisp/paragraphs.elc ../lisp/lisp-mode.elc \
	../lisp/text-mode.elc ../lisp/fill.elc \
	../lisp/c-mode.elc ../lisp/isearch.elc \
	../lisp/replace.elc ../lisp/abbrev.elc \
	../lisp/buff-menu.elc ../lisp/subr.elc

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

/* Construct full set of libraries to be linked.  */
LIBES= $(LIBNET) $(LIBJOBS) $(LTERMCAP) $(LIBX) $(LIBBSD) $(LIBSTD) $(LIBG)

all: xemacs

xemacs: temacs ../etc/DOC ${lisp}
#ifdef CANNOT_DUMP
	mv temacs xemacs
#else
	./temacs -batch -l inc-vers
	./temacs -batch -l loadup.el dump
#endif /* not CANNOT_DUMP */

../etc/DOC: ../etc/make-docfile ${obj} ${lisp} auxdoc.c
	../etc/make-docfile auxdoc.c ${obj} ${lisp} ../lisp/version.el > ../etc/DOC

../etc/make-docfile:
	cd ../etc; make ${MFLAGS} make-docfile

#if defined(sequent)	/* for parallel make */
PARALLEL=&
#endif /* sequent */

temacs: $(PARALLEL) $(LOCALCPP) $(SHORT) crt0.o ${obj} ${otherobj}
	ld ${STARTFLAGS} ${LDFLAGS} -o temacs crt0.o ${obj} ${otherobj} ${LIBES} ${ALIGNMENT}

/* These are needed for C compilation, on the systems that need them */
#ifdef NEED_CPP
CPP = ./localcpp
localcpp:
	cd ../cpp; make ${MFLAGS} EMACS=-DEMACS
	ln ../cpp/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 = /lib/cpp
#endif /* need NEED_CPP */

#ifdef SHORTNAMES
shortnames:
	cd ../shortnames; make ${MFLAGS}
#endif /* SHORTNAMES */

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 may 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
alloca.o : alloca.s config.h
	$(CPP) -E alloca.s | \
/* remove any ^L, blank lines, and preprocessor comments,
   since some assemblers barf on them */
	sed -e 's///' -e 's/^#.*//' | \
	sed -n -e '/^..*$$/p' > alloca.t
	as -o alloca.o alloca.t
	rm alloca.t
#endif /* not C_ALLOCA */

/* 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.  */

abbrev.o : abbrev.c buffer.h commands.h config.h 
buffer.o : buffer.c syntax.h buffer.h commands.h window.h config.h 
callint.o : callint.c window.h commands.h buffer.h config.h 
callproc.o : callproc.c paths.h buffer.h commands.h config.h 
casefiddle.o : casefiddle.c syntax.h commands.h buffer.h config.h 
cm.o : cm.c cm.h termhooks.h config.h
cmds.o : cmds.c syntax.h buffer.h commands.h config.h 
crt0.o : crt0.c config.h
dired.o : dired.c commands.h buffer.h config.h 
dispnew.o : dispnew.c commands.h window.h buffer.h dispextern.h termchar.h termopts.h cm.h config.h
doc.o : doc.c config.h paths.h
doprnt.o : doprnt.c
editfns.o : editfns.c window.h buffer.h config.h 
emacs.o : emacs.c commands.h config.h 
fileio.o : fileio.c window.h buffer.h config.h 
filelock.o : filelock.c buffer.h paths.h config.h
filemode.o : filemode.c 
indent.o : indent.c window.h indent.h buffer.h config.h termchar.h termopts.h
insdel.o : insdel.c window.h buffer.h config.h 
keyboard.o : keyboard.c termchar.h termhooks.h termopts.h buffer.h commands.h window.h macros.h config.h 
keymap.o : keymap.c buffer.h commands.h config.h 
lastfile.o : lastfile.c 
macros.o : macros.c window.h buffer.h commands.h macros.h config.h
malloc.o : malloc.c config.h
marker.o : marker.c buffer.h config.h 
minibuf.o : minibuf.c syntax.h window.h buffer.h commands.h config.h 
mocklisp.o : mocklisp.c buffer.h config.h
process.o : process.c process.h buffer.h window.h termhooks.h config.h 
regex.o : regex.c syntax.h buffer.h config.h regex.h 
scroll.o : scroll.c termchar.h config.h dispextern.h
search.o : search.c regex.h commands.h buffer.h syntax.h config.h 
syntax.o : syntax.c syntax.h buffer.h commands.h config.h 
sysdep.o : sysdep.c config.h dispextern.h termhooks.h termchar.h termopts.h
term.o : term.c termchar.h termhooks.h termopts.h config.h cm.h
termcap.o : termcap.c
terminfo.o : terminfo.c config.h
tparam.o : tparam.c
undo.o : undo.c buffer.h commands.h undo.h config.h 
unexec.o : unexec.c config.h
window.o : window.c indent.h commands.h window.h buffer.h config.h termchar.h
xdisp.o : xdisp.c macros.h commands.h indent.h buffer.h dispextern.h termchar.h window.h config.h 
xfns.o : xfns.c window.h config.h
xterm.o : xterm.c xterm.h dispextern.h config.h

/* The files of Lisp proper */

alloc.o : alloc.c window.h buffer.h config.h 
bytecode.o : bytecode.c buffer.h config.h 
data.o : data.c buffer.h config.h 
eval.o : eval.c commands.h config.h
fns.o : fns.c commands.h config.h
print.o : print.c process.h window.h buffer.h config.h 
lread.o : lread.c buffer.h paths.h config.h