C_SWITCH_SYSTEM and C_SWITCH_MACHINE are now cpp symbols, not make variables.
[bpt/emacs.git] / src / Makefile.in
CommitLineData
ae3bed12 1/* Makefile for GNU Emacs.
2f1b0bbd 2 Copyright (C) 1985, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
ec558adc 3
ae3bed12
BF
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
3bdaa06a 20/* Here are the things that we expect ../configure to edit. */
ae3bed12
BF
21srcdir=@srcdir@
22VPATH=@srcdir@
23CC=@CC@
24CPP=@CPP@
25CFLAGS=@CFLAGS@
ae3bed12 26LN_S=@LN_S@
3bdaa06a
RS
27/* Substitute an assignment for the MAKE variable, because
28 BSD doesn't have it as a default. */
29@SET_MAKE@
ae3bed12
BF
30
31/* On Xenix and the IBM RS6000, double-dot gets screwed up. */
32dot = .
33lispdir = ${srcdir}/$(dot)$(dot)/lisp/
34libsrc = $(dot)$(dot)/lib-src/
35etc = $(dot)$(dot)/etc/
36shortnamesdir = $(dot)$(dot)/shortnames/
37cppdir = $(dot)$(dot)/cpp/
38oldXMenudir = $(dot)$(dot)/oldXMenu/
3e285e4d 39lwlibdir = $(dot)$(dot)/lwlib/
2a3c6d11
RS
40
41/* Configuration files for .o files to depend on. */
42M_FILE = ${srcdir}/@machfile@
43S_FILE = ${srcdir}/@opsysfile@
44config_h = config.h $(M_FILE) $(S_FILE)
ae3bed12 45
02e8e167
RS
46CPPFLAGS=
47LDFLAGS=
48C_SWITCH_SYSTEM=
49
ae3bed12
BF
50/* just to be sure the sh is used */
51SHELL=/bin/sh
52
53#define NO_SHORTNAMES
54#define THIS_IS_YMAKEFILE
55#define NOT_C_CODE
56#include "config.h"
57
58/* Use HAVE_X11 as an alias for X11 in this file
59 to avoid problems with X11 as a subdirectory name
60 in -I and other such options which pass through this file. */
61
62#ifdef X11
63#define HAVE_X11
64#undef X11
65#endif
66
67/* On some machines #define register is done in config;
68 don't let it interfere with this file. */
69#undef register
70
71/* On some systems we may not be able to use the system make command. */
72#ifdef MAKE_COMMAND
73MAKE = MAKE_COMMAND
74#else
75MAKE=make
76#endif
77
78#ifdef C_COMPILER
79CC = C_COMPILER
80#endif
81
82/* Some machines don't find the standard C libraries in the usual place. */
83#ifndef ORDINARY_LINK
84#ifndef LIB_STANDARD
85#define LIB_STANDARD -lc
86#endif
87#else
88#ifndef LIB_STANDARD
89#define LIB_STANDARD
90#endif
91#endif
92
93/* Unless inhibited or changed, use -lg to link for debugging. */
94#ifndef LIBS_DEBUG
95#define LIBS_DEBUG -lg
96#endif
97
98/* Some s/*.h files define this to request special libraries. */
99#ifndef LIBS_SYSTEM
100#define LIBS_SYSTEM
101#endif
102
103/* Some m/*.h files define this to request special libraries. */
104#ifndef LIBS_MACHINE
105#define LIBS_MACHINE
106#endif
107
108#ifndef LIB_MATH
109# ifdef LISP_FLOAT_TYPE
110# define LIB_MATH -lm
111# else /* ! defined (LISP_FLOAT_TYPE) */
112# define LIB_MATH
113# endif /* ! defined (LISP_FLOAT_TYPE) */
114#endif /* LIB_MATH */
115
116/* Some s/*.h files define this to request special switches in ld. */
117#ifndef LD_SWITCH_SYSTEM
118#if !defined (__GNUC__) && (defined(COFF_ENCAPSULATE) || (defined (BSD) && !defined (COFF)))
119#define LD_SWITCH_SYSTEM -X
120#else /* ! defined(COFF_ENCAPSULATE) || (defined (BSD) && !defined (COFF)) */
121#define LD_SWITCH_SYSTEM
122#endif /* ! defined(COFF_ENCAPSULATE) || (defined (BSD) && !defined (COFF)) */
123#endif /* LD_SWITCH_SYSTEM */
124
125/* Some m/*.h files define this to request special switches in ld. */
126#ifndef LD_SWITCH_MACHINE
127#define LD_SWITCH_MACHINE
128#endif
129
130/* Some m/*.h files define this to request special switches in cc. */
131#ifndef C_SWITCH_MACHINE
132#define C_SWITCH_MACHINE
133#endif
134
135/* Some s/*.h files define this to request special switches in cc. */
136#ifndef C_SWITCH_SYSTEM
137#define C_SWITCH_SYSTEM
138#endif
139
140/* These macros are for switches specifically related to X Windows. */
141#ifndef C_SWITCH_X_MACHINE
142#define C_SWITCH_X_MACHINE
143#endif
144
145#ifndef C_SWITCH_X_SYSTEM
146#define C_SWITCH_X_SYSTEM
147#endif
148
149#ifndef C_SWITCH_X_SITE
150#define C_SWITCH_X_SITE
151#endif
152
153#ifndef LD_SWITCH_X_SITE
154#define LD_SWITCH_X_SITE
155#endif
156
157/* These can be passed in from config.h to define special load and
158 compile switches needed by individual sites */
159#ifndef LD_SWITCH_SITE
160#define LD_SWITCH_SITE
161#endif
162
163#ifndef C_SWITCH_SITE
164#define C_SWITCH_SITE
165#endif
166
167#ifndef ORDINARY_LINK
9e012fc3 168
ae3bed12
BF
169#ifndef CRT0_COMPILE
170#define CRT0_COMPILE $(CC) -c $(ALL_CFLAGS) C_SWITCH_ASM
171#endif
172
173#ifndef START_FILES
174#ifdef NO_REMAP
175#ifdef COFF_ENCAPSULATE
176#define START_FILES pre-crt0.o /usr/local/lib/gcc-crt0.o
177#else /* ! defined (COFF_ENCAPSULATE) */
178#define START_FILES pre-crt0.o /lib/crt0.o
179#endif /* ! defined (COFF_ENCAPSULATE) */
180#else /* ! defined (NO_REMAP) */
181#define START_FILES crt0.o
182#endif /* ! defined (NO_REMAP) */
183#endif /* START_FILES */
184STARTFILES = START_FILES
185
186#else /* ORDINARY_LINK */
187
188/* config.h might want to force START_FILES anyway */
189#ifdef START_FILES
190STARTFILES = START_FILES
191#endif /* START_FILES */
192
193#endif /* not ORDINARY_LINK */
194
195
196/* cc switches needed to make `asm' keyword work.
197 Nothing special needed on most machines. */
198#ifndef C_SWITCH_ASM
199#define C_SWITCH_ASM
200#endif
201
202/* Figure out whether the system cpp can handle long names.
203 Do it by testing it right now.
204 If it loses, arrange to use the GNU cpp. */
205
206#define LONGNAMEBBBFOOX
207#ifdef LONGNAMEBBBARFOOX
208/* Installed cpp fails to distinguish those names! */
209/* Arrange to compile the GNU cpp later on */
210#define NEED_CPP
211/* Cause cc to invoke the cpp that comes with Emacs,
212 which will be in a file named localcpp. */
213MYCPPFLAG= -Blocal
214/* LOCALCPP is the local one or nothing.
215 CPP is the local one or the standardone. */
216LOCALCPP= localcpp
217#endif /* ! defined (LONGNAMEBBBARFOOX) */
218
219#ifdef SHORTNAMES
220SHORT= shortnames
221#endif
222
223/* DO NOT use -R. There is a special hack described in lastfile.c
224 which is used instead. Some initialized data areas are modified
225 at initial startup, then labeled as part of the text area when
226 Emacs is dumped for the first time, and never changed again. */
227
ae3bed12
BF
228/* -Demacs is needed to make some files produce the correct version
229 for use in Emacs.
230
231 -DHAVE_CONFIG_H is needed for some other files to take advantage of
232 the information in `config.h'. */
644ab589 233
ae3bed12
BF
234/* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM
235 since it may have -I options that should override those two. */
4b431fb7 236ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAG) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM ${CFLAGS}
ae3bed12
BF
237.c.o:
238 $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
239
240#ifndef LIBX10_MACHINE
241#define LIBX10_MACHINE
242#endif
243
244#ifndef LIBX11_MACHINE
245#define LIBX11_MACHINE
246#endif
247
248#ifndef LIBX10_SYSTEM
249#define LIBX10_SYSTEM
250#endif
251
252#ifndef LIBX11_SYSTEM
253#define LIBX11_SYSTEM
254#endif
255
256#ifndef LIB_X11_LIB
257#define LIB_X11_LIB -lX11
258#endif
259
260#ifdef HAVE_X_WINDOWS
261#ifdef HAVE_X_MENU
262
263/* Include xmenu.o in the list of X object files. */
264XOBJ= xterm.o xfns.o xfaces.o xmenu.o xselect.o xrdb.o
265
266/* The X Menu stuff is present in the X10 distribution, but missing
267 from X11. If we have X10, just use the installed library;
268 otherwise, use our own copy. */
269#ifdef HAVE_X11
3e285e4d
RS
270#ifdef USE_X_TOOLKIT
271OLDXMENU=liblw.a
272LIBXMENU= $(OLDXMENU)
273#else /* not USE_X_TOOLKIT */
ae3bed12
BF
274OLDXMENU= libXMenu11.a
275LIBXMENU= $(OLDXMENU)
3e285e4d
RS
276#endif /* not USE_X_TOOLKIT */
277#else /* not HAVE_X11 */
ae3bed12 278LIBXMENU= -lXMenu
3e285e4d 279#endif /* not HAVE_X11 */
ae3bed12 280
3e285e4d 281#else /* not HAVE_X_MENU */
ae3bed12
BF
282
283/* Otherwise, omit xmenu.o from the list of X object files, and
284 don't worry about the menu library at all. */
285XOBJ= xterm.o xfns.o xfaces.o xselect.o xrdb.o
286LIBXMENU=
3e285e4d
RS
287#endif /* not HAVE_X_MENU */
288
289#ifdef USE_X_TOOLKIT
ac4c3d0c 290LIBXT= -lXaw -lXt -lXmu -lXext
3e285e4d
RS
291#else
292LIBXT=
293#endif
ae3bed12
BF
294
295#ifdef HAVE_X11
5aff8acb 296LIBX= $(LIBXMENU) LD_SWITCH_X_SITE $(LIBXT) LIB_X11_LIB LIBX11_MACHINE LIBX11_SYSTEM
3e285e4d 297#else /* not HAVE_X11 */
ae3bed12 298LIBX= $(LIBXMENU) LD_SWITCH_X_SITE -lX10 LIBX10_MACHINE LIBX10_SYSTEM
3e285e4d
RS
299#endif /* not HAVE_X11 */
300#endif /* not HAVE_X_WINDOWS */
ae3bed12
BF
301
302#ifndef ORDINARY_LINK
303/* Fix linking if compiled with GCC. */
304#ifdef __GNUC__
305
306#if __GNUC__ > 1
307
ab8fbbf7
RS
308#ifdef LINKER
309#define LINKER_WAS_SPECIFIED
310#endif
311
ae3bed12
BF
312/* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
313 places that are difficult to figure out at make time. Fortunately,
314 these same versions allow you to pass arbitrary flags on to the
315 linker, so there's no reason not to use it as a linker.
316
317 Well, it's not quite perfect. The `-nostdlib' keeps GCC from
318 searching for libraries in its internal directories, so we have to
319 ask GCC explicitly where to find libgcc.a. */
9e012fc3 320
ae3bed12
BF
321#ifndef LINKER
322#define LINKER $(CC) -nostdlib
323#endif
0c22fbca 324
ae3bed12
BF
325#ifndef LIB_GCC
326/* Ask GCC where to find libgcc.a. */
327#define LIB_GCC `$(CC) -print-libgcc-file-name`
3e285e4d 328#endif /* not LIB_GCC */
c8ff0e1b 329
ae3bed12 330GNULIB_VAR = LIB_GCC
5627d72e 331
ab8fbbf7 332#ifndef LINKER_WAS_SPECIFIED
ae3bed12
BF
333/* GCC passes any argument prefixed with -Xlinker directly to the
334 linker. See prefix-args.c for an explanation of why we don't do
335 this with the shell's `for' construct.
336 Note that some people don't have '.' in their paths, so we must
337 use ./prefix-args. */
338#define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags`
ab8fbbf7
RS
339#else
340#define YMF_PASS_LDFLAGS(flags) flags
341#endif
9e012fc3 342
ae3bed12 343#else /* __GNUC__ < 2 */
c8ff0e1b 344
ae3bed12
BF
345#ifndef LIB_GCC
346#define LIB_GCC /usr/local/lib/gcc-gnulib
3e285e4d 347#endif /* not LIB_GCC */
ae3bed12
BF
348GNULIB_VAR = `if [ -f LIB_GCC ] ; then echo LIB_GCC; else echo; fi`
349#endif /* __GNUC__ < 2 */
3e285e4d 350#else /* not __GNUC__ */
ae3bed12 351GNULIB_VAR =
c8ff0e1b 352
3e285e4d 353#endif /* not __GNUC__ */
ae3bed12
BF
354#endif /* not ORDINARY_LINK */
355
356/* Specify address for ld to start loading at,
357 if requested by configuration. */
358#ifdef LD_TEXT_START_ADDR
359STARTFLAGS = -T LD_TEXT_START_ADDR -e __start
360#endif
361
362#ifdef ORDINARY_LINK
363LD = $(CC)
364#else
365#ifdef COFF_ENCAPSULATE
366LD=$(CC) -nostdlib
367#else /* not ORDINARY_LINK */
368#ifdef LINKER
369LD=LINKER
3e285e4d 370#else /* not LINKER */
ae3bed12 371LD=ld
3e285e4d
RS
372#endif /* not LINKER */
373#endif /* not COFF_ENCAPSULATE */
ae3bed12
BF
374#endif /* not ORDINARY_LINK */
375
98fb23e2 376ALL_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_MACHINE LD_SWITCH_SITE
ae3bed12
BF
377
378/* A macro which other sections of ymakefile can redefine to munge the
379 flags before they're passed to LD. This is helpful if you have
380 redefined LD to something odd, like "gcc". */
381#ifndef YMF_PASS_LDFLAGS
382#define YMF_PASS_LDFLAGS(flags) flags
383#endif
384
385/* Allow config.h to specify a replacement file for unexec.c. */
386#ifndef UNEXEC
387#define UNEXEC unexec.o
388#endif
389#ifndef UNEXEC_SRC
390#define UNEXEC_SRC unexec.c
391#endif
392
393#ifdef USE_TEXT_PROPERTIES
394#define INTERVAL_SRC intervals.h
395#define INTERVAL_OBJ intervals.o textprop.o
396#else
397#define INTERVAL_SRC
398#define INTERVAL_OBJ
399#endif
400
401#ifdef HAVE_GETLOADAVG
402#define GETLOADAVG_OBJ
403#else
404#define GETLOADAVG_OBJ getloadavg.o
405#endif
406
407/* lastfile must follow all files
408 whose initialized data areas should be dumped as pure by dump-emacs. */
409obj= dispnew.o frame.o scroll.o xdisp.o window.o \
410 term.o cm.o $(XOBJ) \
411 emacs.o keyboard.o macros.o keymap.o sysdep.o \
412 buffer.o filelock.o insdel.o marker.o INTERVAL_OBJ \
413 minibuf.o fileio.o dired.o filemode.o \
414 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
415 alloc.o data.o doc.o editfns.o callint.o \
416 eval.o floatfns.o fns.o print.o lread.o \
417 abbrev.o syntax.o UNEXEC mocklisp.o bytecode.o \
418 process.o callproc.o \
419 doprnt.o GETLOADAVG_OBJ
420
229c1c6a
RS
421/* Object files used on some machine or other.
422 These go in the DOC file on all machines
423 in case they are needed there. */
424SOME_MACHINE_OBJECTS = sunfns.o
425
ae3bed12
BF
426#ifdef TERMINFO
427/* Used to be -ltermcap here. If your machine needs that,
428 define LIBS_TERMCAP in the m/*.h file. */
429#ifndef LIBS_TERMCAP
430#define LIBS_TERMCAP -lcurses
431#endif /* LIBS_TERMCAP */
432termcapobj = terminfo.o
433#else /* ! defined (TERMINFO) */
434#ifndef LIBS_TERMCAP
435#define LIBS_TERMCAP
436termcapobj = termcap.o tparam.o
437#else /* LIBS_TERMCAP */
438termcapobj = tparam.o
439#endif /* LIBS_TERMCAP */
440#endif /* ! defined (TERMINFO) */
441
442
443#ifndef SYSTEM_MALLOC
444
445#ifdef GNU_MALLOC /* New GNU malloc */
446#ifdef REL_ALLOC
447mallocobj = gmalloc.o ralloc.o vm-limit.o
448#else /* ! defined (REL_ALLOC) */
449mallocobj = gmalloc.o vm-limit.o
450#endif /* ! defined (REL_ALLOC) */
451#else /* Old GNU malloc */
452mallocobj = malloc.o
453#endif /* Old GNU malloc */
454
455#endif /* SYSTEM_MALLOC */
456
457
458#ifndef HAVE_ALLOCA
459allocaobj = alloca.o
460#else
461allocaobj =
462#endif
463
3e285e4d
RS
464#ifdef USE_X_TOOLKIT
465widgetobj= widget.o
466#else /* not USE_X_TOOLKIT */
467widgetobj=
468#endif /* not USE_X_TOOLKIT */
469
ae3bed12
BF
470
471/* define otherobj as list of object files that make-docfile
472 should not be told about. */
3e285e4d 473otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj)
ae3bed12
BF
474
475#ifdef LISP_FLOAT_TYPE
476#define FLOAT_SUPPORT ${lispdir}float-sup.elc
477#else
478#define FLOAT_SUPPORT
479#endif
480
481#ifdef MULTI_FRAME
482#define FRAME_SUPPORT ${lispdir}frame.elc ${lispdir}mouse.elc ${lispdir}select.elc ${lispdir}scroll-bar.elc
483#else
484#define FRAME_SUPPORT
485#endif
486
2f1b0bbd 487#ifdef HAVE_X_WINDOWS
f32b54d4 488#define X_WINDOWS_SUPPORT
2f1b0bbd
RM
489#else
490#define X_WINDOWS_SUPPORT
491#endif
492
ae3bed12
BF
493#ifdef VMS
494#define VMS_SUPPORT ${lispdir}vmsproc.elc ${lispdir}vms-patch
495#else
496#define VMS_SUPPORT
497#endif
498
499/* List of Lisp files loaded into the dumped Emacs. It's arranged
500 like this because it's easier to generate it semi-mechanically from
501 loadup.el this way.
502
503 Note that this list should not include lisp files which might not
504 be present, like site-load.el and site-init.el; this makefile
2f1b0bbd 505 expects them all to be either present or buildable. */
ae3bed12
BF
506lisp= \
507 ${lispdir}abbrev.elc \
508 ${lispdir}buff-menu.elc \
509 ${lispdir}byte-run.elc \
510 ${lispdir}c-mode.elc \
511 ${lispdir}files.elc \
512 ${lispdir}fill.elc \
513 FLOAT_SUPPORT \
514 FRAME_SUPPORT \
2f1b0bbd 515 X_WINDOWS_SUPPORT \
ae3bed12
BF
516 ${lispdir}help.elc \
517 ${lispdir}indent.elc \
518 ${lispdir}isearch.elc \
519 ${lispdir}lisp-mode.elc \
520 ${lispdir}lisp.elc \
521 ${lispdir}loaddefs.el \
522 ${lispdir}map-ynp.elc \
523 ${lispdir}page.elc \
524 ${lispdir}paragraphs.elc \
525 ${lispdir}paths.el \
526 ${lispdir}register.elc \
527 ${lispdir}replace.elc \
528 ${lispdir}simple.elc \
529 ${lispdir}startup.elc \
530 ${lispdir}subr.elc \
531 ${lispdir}text-mode.elc \
532 ${lispdir}vc-hooks.elc \
533 VMS_SUPPORT \
2f1b0bbd 534 ${lispdir}window.elc \
45d3c866 535 ${lispdir}version.el
ae3bed12
BF
536
537/* Construct full set of libraries to be linked.
538 Note that SunOS needs -lm to come before -lc; otherwise, you get
709f7c1f
RM
539 duplicated symbols. If the standard libraries were compiled
540 with GCC, we might need gnulib again after them. */
ae3bed12 541LIBES = $(LIBX) LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
709f7c1f 542 LIBS_DEBUG $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)
ae3bed12
BF
543
544/* Enable recompilation of certain other files depending on system type. */
545
546#ifndef OTHER_FILES
547#define OTHER_FILES
548#endif
549
550/* Enable inclusion of object files in temacs depending on system type. */
551#ifndef OBJECTS_SYSTEM
552#define OBJECTS_SYSTEM
553#endif
554
555#ifndef OBJECTS_MACHINE
556#define OBJECTS_MACHINE
557#endif
558
559all: emacs OTHER_FILES
560
561emacs: temacs ${etc}DOC ${lisp}
562#ifdef CANNOT_DUMP
2bbc6b0a 563 rm -f emacs
ae3bed12
BF
564 ln temacs emacs
565#else
566#ifdef HAVE_SHM
ae3bed12
BF
567 ./temacs -nl -batch -l loadup dump
568#else /* ! defined (HAVE_SHM) */
ae3bed12
BF
569 ./temacs -batch -l loadup dump
570#endif /* ! defined (HAVE_SHM) */
571#endif /* ! defined (CANNOT_DUMP) */
572
80b233a9 573${etc}DOC: ${libsrc}make-docfile ${obj} ${lisp}
ae3bed12 574 rm -f ${etc}DOC
02e8e167 575 ${libsrc}make-docfile -d ${srcdir} ${obj} ${SOME_MACHINE_OBJECTS} \
270eee49 576 ${lisp} > ${etc}DOC
ae3bed12
BF
577
578${libsrc}make-docfile:
918a80cf 579 cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile
ae3bed12
BF
580
581/* Some systems define this to cause parallel Make-ing. */
582#ifndef MAKE_PARALLEL
583#define MAKE_PARALLEL
584#endif
585
586temacs: MAKE_PARALLEL $(LOCALCPP) $(SHORT) $(STARTFILES) $(OLDXMENU) ${obj} ${otherobj} OBJECTS_SYSTEM OBJECTS_MACHINE prefix-args
88f176a4 587 $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${ALL_LDFLAGS}) \
ae3bed12
BF
588 -o temacs ${STARTFILES} ${obj} ${otherobj} \
589 OBJECTS_SYSTEM OBJECTS_MACHINE ${LIBES}
590
591prefix-args: prefix-args.c $(config_h)
592 $(CC) $(ALL_CFLAGS) ${srcdir}/prefix-args.c -o prefix-args
593
594/* These are needed for C compilation, on the systems that need them */
595#ifdef NEED_CPP
596CPP = ./localcpp
597localcpp:
598 cd ${cppdir}; ${MAKE} ${MFLAGS} EMACS=-DEMACS
599 ln ${cppdir}cpp localcpp /* Name where ALL_CFLAGS will refer to it */
600/* cc appears to be cretinous and require all of these to exist
601 if -B is specified -- we can't use one local pass and let the
602 others be the standard ones. What a loser.
603 We can't even use ln, since they are probably
604 on different disks. */
605 cp /lib/ccom localccom
606 -cp /lib/optim localoptim
607 -cp /lib/c2 localc2
608 cp /bin/as localas
609#else /* ! defined (NEED_CPP) */
610CPP = $(CC) -E
611#endif /* ! defined (NEED_CPP) */
612
613#ifdef SHORTNAMES
614shortnames:
615 cd ${shortnamesdir}; ${MAKE} ${MFLAGS}
616#endif
617
618/* Don't lose if this was not defined. */
619#ifndef OLDXMENU_OPTIONS
620#define OLDXMENU_OPTIONS
621#endif
622
3e285e4d
RS
623/* Don't lose if this was not defined. */
624#ifndef LWLIB_OPTIONS
625#define LWLIB_OPTIONS
626#endif
627
ae3bed12 628#ifdef HAVE_X_WINDOWS
ae3bed12 629#ifdef HAVE_X11
3e285e4d
RS
630#ifdef USE_X_TOOLKIT
631$(OLDXMENU): really-lwlib
632 -rm -f $(OLDXMENU) /* We might have a link to an old version. */
633 ${LN_S} ${lwlibdir}liblw.a $(OLDXMENU)
634
635/* Encode the values of these two macros in Make variables,
636 so we can use $(...) to substitute their values within "...". */
637C_SWITCH_MACHINE_1 = C_SWITCH_MACHINE
638C_SWITCH_SYSTEM_1 = C_SWITCH_SYSTEM
639C_SWITCH_SITE_1 = C_SWITCH_SITE
640C_SWITCH_X_SITE_1 = C_SWITCH_X_SITE
641C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE
642C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM
643really-lwlib:
644 cd ${lwlibdir}; ${MAKE} ${MFLAGS} LWLIB_OPTIONS \
645 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \
646 "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
647 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
648 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \
649 "C_SWITCH_SITE=$(C_SWITCH_SITE_1)" \
650 "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
651 "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
652 @true /* make -t should not create really-lwlib. */
653#else /* not USE_X_TOOLKIT */
654#ifdef HAVE_X_MENU
ae3bed12
BF
655$(OLDXMENU): really-oldXMenu
656 -rm -f $(OLDXMENU) /* We might have a link to an old version. */
657 ${LN_S} ${oldXMenudir}libXMenu11.a $(OLDXMENU)
658
659/* Encode the values of these two macros in Make variables,
660 so we can use $(...) to substitute their values within "...". */
661C_SWITCH_MACHINE_1 = C_SWITCH_MACHINE
662C_SWITCH_SYSTEM_1 = C_SWITCH_SYSTEM
663C_SWITCH_SITE_1 = C_SWITCH_SITE
664C_SWITCH_X_SITE_1 = C_SWITCH_X_SITE
665C_SWITCH_X_MACHINE_1 = C_SWITCH_X_MACHINE
666C_SWITCH_X_SYSTEM_1 = C_SWITCH_X_SYSTEM
667really-oldXMenu:
668 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} OLDXMENU_OPTIONS \
669 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' \
670 "C_SWITCH_X_SITE=$(C_SWITCH_X_SITE_1)" \
671 "C_SWITCH_X_MACHINE=$(C_SWITCH_X_MACHINE_1)" \
672 "C_SWITCH_X_SYSTEM=$(C_SWITCH_X_SYSTEM_1)" \
673 "C_SWITCH_SITE=$(C_SWITCH_SITE_1)" \
674 "C_SWITCH_MACHINE=$(C_SWITCH_MACHINE_1)" \
675 "C_SWITCH_SYSTEM=$(C_SWITCH_SYSTEM_1)"
676 @true /* make -t should not create really-oldXMenu. */
3e285e4d
RS
677#endif /* HAVE_X_MENU */
678#endif /* not USE_X_TOOLKIT */
679#endif /* HAVE_X11 */
680#endif /* HAVE_X_WINDOWS */
ae3bed12
BF
681
682paths.h: paths.h.in
683 @echo "The file paths.h needs to be set up from paths.h.in."
684 @echo "Consult the file \`INSTALL' for instructions for building Emacs."
685 exit 1
686
687config.h: config.h.in
688 @echo "The file config.h needs to be set up from config.h.in."
689 @echo "Consult the file \`INSTALL' for instructions for building Emacs."
690 exit 1
691
692/* Some machines have alloca built-in.
693 They should define HAVE_ALLOCA, or may just let alloca.s
694 be used but generate no code.
695 Some have it written in assembler in alloca.s.
696 Some use the C version in alloca.c (these define C_ALLOCA in config.h).
697 */
698
699#ifdef C_ALLOCA
700/* We could put something in alloca.c to #define free and malloc
701 whenever emacs was #defined, but that's not appropriate for all
702 users of alloca in Emacs. Check out ../lib-src/getopt.c. */
703alloca.o : alloca.c
704 $(CC) -c $(CPPFLAGS) -Dfree=xfree -Dmalloc=xmalloc \
705 $(ALL_CFLAGS) ${srcdir}/alloca.c
706#else
707#ifndef HAVE_ALLOCA
2a3c6d11 708alloca.o : alloca.s $(config_h)
ae3bed12
BF
709/* $(CPP) is cc -E, which may get confused by filenames
710 that do not end in .c. So copy file to a safe name. */
711 cp ${srcdir}/alloca.s allocatem.c
712/* Remove any ^L, blank lines, and preprocessor comments,
713 since some assemblers barf on them. Use a different basename for the
714 output file, since some stupid compilers (Green Hill's) use that
715 name for the intermediate assembler file. */
716 $(CPP) $(CPPFLAGS) $(ALL_CFLAGS) allocatem.c | \
717 sed -e 's/\f//' -e 's/^#.*//' | \
718 sed -n -e '/^..*$$/p' > allocax.s
719 -rm -f alloca.o
720/* Xenix, in particular, needs to run assembler via cc. */
721 $(CC) -c allocax.s
722 mv allocax.o alloca.o
723 rm allocax.s allocatem.c
724#endif /* HAVE_ALLOCA */
725#endif /* ! defined (C_ALLOCA) */
726
727/* Nearly all the following files depend on lisp.h,
728 but it is not included as a dependency because
729 it is so often changed in ways that do not require any recompilation
730 and so rarely changed in ways that do require any. */
731
732abbrev.o : abbrev.c buffer.h commands.h $(config_h)
02e8e167 733buffer.o : buffer.c buffer.h commands.h window.h \
ae3bed12
BF
734 INTERVAL_SRC blockinput.h $(config_h)
735callint.o : callint.c window.h commands.h buffer.h mocklisp.h \
736 keyboard.h $(config_h)
8359469c
RS
737callproc.o : callproc.c paths.h buffer.h commands.h $(config_h) \
738 process.h systty.h syssignal.h
ae3bed12
BF
739casefiddle.o : casefiddle.c syntax.h commands.h buffer.h $(config_h)
740casetab.o : casetab.c buffer.h $(config_h)
741cm.o : cm.c cm.h termhooks.h $(config_h)
742cmds.o : cmds.c syntax.h buffer.h commands.h $(config_h)
743pre-crt0.o : pre-crt0.c
744crt0.o : crt0.c $(config_h)
745 CRT0_COMPILE ${srcdir}/crt0.c
746dired.o : dired.c commands.h buffer.h $(config_h) regex.h
747dispnew.o : dispnew.c commands.h frame.h window.h buffer.h dispextern.h \
748 termchar.h termopts.h termhooks.h cm.h disptab.h systty.h systime.h $(config_h)
749doc.o : doc.c $(config_h) paths.h buffer.h keyboard.h
750doprnt.o : doprnt.c
751editfns.o : editfns.c window.h buffer.h systime.h INTERVAL_SRC $(config_h)
752emacs.o : emacs.c commands.h systty.h syssignal.h process.h INTERVAL_SRC $(config_h)
753fileio.o : fileio.c window.h buffer.h systime.h INTERVAL_SRC $(config_h)
754filelock.o : filelock.c buffer.h paths.h $(config_h)
755filemode.o : filemode.c $(config_h)
756getloadavg.o : getloadavg.c $(config_h)
757indent.o : indent.c frame.h window.h indent.h buffer.h $(config_h) termchar.h \
758 termopts.h disptab.h
759insdel.o : insdel.c window.h buffer.h INTERVAL_SRC blockinput.h $(config_h)
760keyboard.o : keyboard.c termchar.h termhooks.h termopts.h buffer.h \
761 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
762 systty.h systime.h dispextern.h intervals.h blockinput.h $(config_h)
763keymap.o : keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
764 $(config_h)
765lastfile.o : lastfile.c $(config_h)
766macros.o : macros.c window.h buffer.h commands.h macros.h $(config_h)
767malloc.o : malloc.c $(config_h)
768gmalloc.o : gmalloc.c $(config_h)
769ralloc.o : ralloc.c $(config_h)
770vm-limit.o : vm-limit.c mem-limits.h $(config_h)
771marker.o : marker.c buffer.h $(config_h)
772minibuf.o : minibuf.c syntax.h dispextern.h frame.h window.h \
773 buffer.h commands.h $(config_h)
774mocklisp.o : mocklisp.c buffer.h $(config_h)
775process.o : process.c process.h buffer.h window.h termhooks.h termopts.h \
776 commands.h syssignal.h systime.h systty.h syswait.h frame.h $(config_h)
777regex.o : regex.c syntax.h buffer.h $(config_h) regex.h
778frame.o : frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
779 buffer.h $(config_h)
780scroll.o : scroll.c termchar.h $(config_h) dispextern.h frame.h
781search.o : search.c regex.h commands.h buffer.h syntax.h blockinput.h $(config_h)
782syntax.o : syntax.c syntax.h buffer.h commands.h $(config_h)
783sysdep.o : sysdep.c $(config_h) dispextern.h termhooks.h termchar.h termopts.h \
784 frame.h syssignal.h systty.h systime.h syswait.h blockinput.h window.h
785term.o : term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
786 disptab.h
787termcap.o : termcap.c $(config_h)
788terminfo.o : terminfo.c $(config_h)
789tparam.o : tparam.c $(config_h)
790undo.o : undo.c buffer.h commands.h $(config_h)
791UNEXEC : UNEXEC_SRC $(config_h)
3e285e4d 792widget.o : widget.c xterm.h frame.h dispextern.h widgetprv.h $(config_h)
ae3bed12
BF
793window.o : window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
794 termhooks.h disptab.h keyboard.h $(config_h)
795xdisp.o : xdisp.c macros.h commands.h indent.h buffer.h dispextern.h \
796 termchar.h frame.h window.h disptab.h termhooks.h $(config_h)
797xfaces.o : xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
798 window.h $(config_h)
799xfns.o : xfns.c buffer.h frame.h window.h keyboard.h xterm.h \
800 blockinput.h $(config_h)
801xmenu.o : xmenu.c xterm.h window.h frame.h keyboard.h blockinput.h $(config_h)
802xterm.o : xterm.c xterm.h termhooks.h termopts.h termchar.h window.h \
ae82682f 803 dispextern.h frame.h disptab.h blockinput.h systime.h syssignal.h \
ae3bed12
BF
804 gnu.h sink.h sinkmask.h $(config_h)
805xselect.o : xselect.c dispextern.h frame.h xterm.h blockinput.h $(config_h)
806xrdb.o : xrdb.c $(config_h)
f39f5da3 807hftctl.o : hftctl.c $(config_h)
ae3bed12
BF
808
809/* The files of Lisp proper */
810
811alloc.o : alloc.c frame.h window.h buffer.h puresize.h syssignal.h
812alloc.o : blockinput.h $(config_h) INTERVAL_SRC
813bytecode.o : bytecode.c buffer.h $(config_h)
814data.o : data.c buffer.h puresize.h syssignal.h $(config_h)
815eval.o : eval.c commands.h keyboard.h blockinput.h $(config_h)
816floatfns.o : floatfns.c $(config_h)
817fns.o : fns.c commands.h $(config_h) frame.h buffer.h keyboard.h INTERVAL_SRC
818print.o : print.c process.h frame.h window.h buffer.h $(config_h)
819lread.o : lread.c commands.h keyboard.h buffer.h paths.h $(config_h) \
820 termhooks.h
821
822/* Text properties support */
823textprop.o : textprop.c buffer.h intervals.h $(config_h)
240d5222 824intervals.o : intervals.c buffer.h intervals.h puresize.h $(config_h)
ae3bed12
BF
825
826/* System-specific programs to be made.
827 OTHER_FILES, OBJECTS_SYSTEM and OBJECTS_MACHINE
828 select which of these should be compiled. */
829
830sunfns.o : sunfns.c buffer.h $(config_h)
831
832${libsrc}emacstool: ${libsrc}emacstool.c
833 cd ${libsrc}; ${MAKE} ${MFLAGS} emacstool
bfb7b570 834mostlyclean:
9d11b9a1 835 rm -f temacs prefix-args xmakefile* core \#* *.o libXMenu11.a
bfb7b570
JB
836 rm -f ../etc/DOC
837clean: mostlyclean
21ed4461 838 rm -f emacs-* emacs
ae3bed12
BF
839/**/# This is used in making a distribution.
840/**/# Do not use it on development directories!
bfb7b570 841distclean: clean
48809826 842 rm -f paths.h config.h Makefile Makefile.in ../etc/DOC-*
bfb7b570
JB
843realclean: distclean
844 rm -f TAGS
c3d80a47
ER
845versionclean:
846 -rm -f emacs emacs-* ../etc/DOC*
9e012fc3 847extraclean: distclean
22e5421f 848 -rm -f *~ \#* m/?*~ s/?*~
9e012fc3 849
ae3bed12
BF
850/* The rule for the [sm] files has to be written a little funny to
851 avoid looking like a C comment to CPP. */
852SOURCES = *.[ch] [sm]/?* COPYING ymakefile \
a6af8696
ER
853 config.h.in README COPYING ChangeLog vms.pp-trans
854unlock:
855 chmod u+w $(SOURCES)
856
857relock:
858 chmod -w $(SOURCES)
859 chmod +w paths.h
dd6e8a8d
RS
860
861# Arrange to make a tags table in ../lisp, and another in this dir
862# which includes ../lisp/TAGS by reference.
863ctagsfiles = [a-zA-Z]*.h [a-zA-Z]*.c
864lisptagsfiles = ../lisp/[a-zA-Z]*.el ../lisp/term/[a-zA-Z]*.el
865TAGS: $(ctagsfiles)
866 ../lib-src/etags --include=../lisp/TAGS $(ctagsfiles)
867../lisp/TAGS: $(lisptagsfiles)
868 cd ../lisp; $(MAKE) TAGS
869tags: TAGS ../lisp/TAGS
ac21ec40 870.PHONY: tags