XEmacs 21.4.4 "Artificial Intelligence".
[chise/xemacs-chise.git.1] / src / Makefile.in.in
1 ##   Makefile for src subdirectory in XEmacs.
2 ##   Copyright (C) 1985, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
3 ##   Copyright (C) 1994, 1995 Board of Trustees, University of Illinois
4 ##   Copyright (C) 1996, 1997 Sun Microsystems, Inc.
5 ##   Copyright (C) 1998, 1999 J. Kean Johnston.
6
7 ## This file is part of XEmacs.
8
9 ## XEmacs is free software; you can redistribute it and/or modify it
10 ## under the terms of the GNU General Public License as published by the
11 ## Free Software Foundation; either version 2, or (at your option) any
12 ## later version.
13
14 ## XEmacs is distributed in the hope that it will be useful, but WITHOUT
15 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 ## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 ## for more details.
18
19 ## You should have received a copy of the GNU General Public License
20 ## along with XEmacs; see the file COPYING.  If not, write to
21 ## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ## Boston, MA 02111-1307, USA.
23
24 ## Synched up with: Not synched with FSF.
25
26 PROGNAME=@PROGNAME@
27
28 #define NOT_C_CODE
29 #include "config.h"
30
31 #ifdef PDUMP
32 DUMP_TARGET = ${PROGNAME}.dmp
33 EXE_TARGET  = ${PROGNAME}
34 DUMP_ID     = dump-id.o
35 #else
36 DUMP_TARGET = ${PROGNAME}
37 EXE_TARGET  = temacs
38 #endif
39
40 all: ${DUMP_TARGET}
41 .PHONY : all release dump-elc dump-elcs all-elc all-elcs lint
42
43 ## For performance and consistency, no built-in rules.
44 .SUFFIXES:
45 .SUFFIXES: .c .h .o .i .s .dep
46
47 #ifdef USE_GNU_MAKE
48 RECURSIVE_MAKE=$(MAKE)
49 #else
50 @SET_MAKE@
51 RECURSIVE_MAKE=@RECURSIVE_MAKE@
52 #endif
53
54 SHELL=/bin/sh
55 RM = rm -f
56 TAR = tar
57
58 lispdir = ${srcdir}/../lisp/
59 moduledir = ${srcdir}/../modules/
60 libsrc = ../lib-src/
61 etcdir = ../etc/
62
63 ## Here are the things that we expect ../configure to edit.
64 prefix=@prefix@
65 srcdir=@srcdir@
66 blddir=@blddir@
67 version=@version@
68 CC=@XEMACS_CC@
69 CPP=@CPP@
70 CFLAGS=@CFLAGS@
71 CPPFLAGS=@CPPFLAGS@
72 LDFLAGS=@LDFLAGS@
73
74 c_switch_all=@c_switch_all@
75 ld_switch_all=@ld_switch_all@
76 ld_libs_all=@ld_libs_all@
77 ld_dynamic_link_flags=@ld_dynamic_link_flags@
78
79 extra_objs=@extra_objs@
80 LN_S=@LN_S@
81
82 ld_switch_shared=@ld_switch_shared@
83 start_files=@start_files@
84 start_flags=@start_flags@
85 LD=@ld@
86 lib_gcc=@lib_gcc@
87 ##libmcheck=@libmcheck@
88
89
90 ## With the traditional VPATH setting, it is not possible to
91 ## simultaneously compile in-place and in another directory.  The
92 ## mistaken definition is that *all* dependencies are searched for in
93 ## the VPATH directory, rather than just the dependencies that are not
94 ## themselves targets.  Thus, if there is an up-to-date .o file in the
95 ## in-place location, it will not get recompiled in the not-in-place
96 ## location.
97
98 ## The GNU Make "vpath" directive continues this tradition, but at
99 ## least lets you restrict the classes of files that it applies to.
100 ## This allows us to kludge around the problem.
101
102 #ifdef USE_GNU_MAKE
103 vpath %.c @srcdir@
104 vpath %.h @srcdir@
105 ## now list files that should NOT be searched in the srcdir.
106 ## This includes any .c or .h built from something else
107 ## (e.g. a .in file).
108 vpath config.h
109 vpath paths.h
110 vpath Emacs.ad.h
111 vpath sheap-adjust.h
112 vpath dump-id.c
113 #else
114 VPATH=@srcdir@
115 #endif
116
117 RM = rm -f
118
119 LWLIB_SRCDIR = ${srcdir}/../lwlib
120
121 #ifdef HAVE_X_WINDOWS
122 lwlib_libs = ../lwlib/liblw.a
123 lwlib_deps = $(lwlib_libs)
124 $(lwlib_libs) :
125         cd ../lwlib && $(RECURSIVE_MAKE)
126
127 x_objs=console-x.o device-x.o event-Xt.o frame-x.o\
128  glyphs-x.o objects-x.o redisplay-x.o select-x.o xgccache.o
129
130 #ifdef AIX4
131 LIBI18N = -li18n
132 #endif /* AIX4 */
133
134 X11_libs = $(LIBI18N)
135 #endif /* HAVE_X_WINDOWS */
136
137 #if defined (HEAP_IN_DATA) && !defined (PDUMP)
138 sheap_objs=sheap.o
139 #endif
140
141 #if defined (WIN32_NATIVE) || defined (CYGWIN)
142 win32_objs=win32.o xemacs_res.o
143 #endif
144
145 ## -Demacs is needed to make some files produce the correct version
146 ## for use in Emacs.
147
148 cppflags = $(CPPFLAGS) -Demacs -I. $(c_switch_all)
149 cflags   = $(CFLAGS) $(cppflags)
150 #if defined (WIN32_NATIVE) || defined (CYGWIN)
151 ldflags  = $(LDFLAGS) -mwindows $(ld_switch_all) $(ld_dynamic_link_flags)
152 #else
153 ldflags  = $(LDFLAGS) $(ld_switch_all) $(ld_dynamic_link_flags)
154 #endif
155
156 #ifdef SOLARIS2
157 %.o : %.c
158 #else
159 .c.o:
160 #endif
161         $(CC) -c $(cflags) $<
162
163 ## Create preprocessor output (debugging purposes only)
164 .c.i:
165 #ifdef __GNUC__
166         $(CC) -E $(cppflags) -o $@ $<
167 #else /* works on Solaris; what about other systems? */
168         $(CC) -P $(cppflags) $<
169 #endif /* compiler */
170
171 ## Create assembler output (debugging purposes only)
172 .c.s:
173         $(CC) -S -c $(cflags) $<
174
175 ## Create RTL files
176 %.c.rtl : %.c
177         $(CC) -dr -c $(cflags) $<
178
179 ## lastfile must follow all files whose initialized data areas should
180 ## be dumped as pure by dump-emacs.
181
182 ## NOTE: The last line cannot be all macros, because make will barf
183 ## if they all come out null.
184
185 objs=\
186  abbrev.o alloc.o blocktype.o buffer.o bytecode.o\
187  callint.o callproc.o casefiddle.o casetab.o chartab.o\
188  cmdloop.o cmds.o console.o console-stream.o\
189  data.o device.o dired.o doc.o doprnt.o dynarr.o\
190  editfns.o elhash.o emacs.o\
191  eval.o events.o $(extra_objs)\
192  event-stream.o extents.o faces.o\
193  fileio.o $(LOCK_OBJ) filemode.o floatfns.o fns.o font-lock.o\
194  frame.o general.o glyphs.o glyphs-eimage.o glyphs-widget.o\
195  gui.o gutter.o $(gui_objs) hash.o imgproc.o indent.o insdel.o intl.o\
196  keymap.o $(RTC_patch_objs) line-number.o lread.o lstream.o\
197  macros.o marker.o md5.o minibuf.o objects.o opaque.o\
198  print.o process.o profile.o\
199  rangetab.o redisplay.o redisplay-output.o regex.o\
200  search.o select.o $(sheap_objs) signal.o sound.o\
201  specifier.o strftime.o symbols.o syntax.o sysdep.o\
202  undo.o $(x_objs) widget.o window.o $(win32_objs)
203
204 obj_rtl = $(objs:.o=.c.rtl)
205
206 #ifdef REL_ALLOC
207 rallocdocsrc = ralloc.c
208 rallocobjs = ralloc.o
209 #endif
210
211 malloclib = $(libmcheck)
212 #ifndef SYSTEM_MALLOC
213 # ifdef GNU_MALLOC  /* GNU malloc */
214 #  ifdef ERROR_CHECK_MALLOC
215 #ifdef DOUG_LEA_MALLOC
216 mallocobjs = free-hook.o vm-limit.o
217 #else
218 mallocobjs = gmalloc.o free-hook.o vm-limit.o
219 #endif
220 mallocdocsrc = free-hook.c
221 #  else /* New GNU malloc, sans error checking */
222 #ifdef DOUG_LEA_MALLOC
223 mallocobjs = vm-limit.o
224 #else
225 mallocobjs = gmalloc.o vm-limit.o
226 #endif
227 mallocdocsrc =
228 #  endif /* ERROR_CHECK_MALLOC */
229 # else /* Older GNU malloc */
230 mallocobjs = malloc.o
231 mallocdocsrc =
232 # endif /* Older GNU malloc */
233 #else /* SYSTEM_MALLOC */
234 mallocobjs =
235 mallocdocsrc =
236 #ifdef USE_DEBUG_MALLOC
237 malloclib = -ldmalloc
238 #endif /* USE_DEBUG_MALLOC */
239 #endif /* SYSTEM_MALLOC */
240
241 #ifdef HAVE_X_WINDOWS
242
243 # ifdef EXTERNAL_WIDGET
244 external_widget_objs = ExternalShell.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
245
246 ## Now we try to figure out how to link a shared library.
247 ## If we cannot figure it out, leave EXTW_LINK undefined and a shared
248 ## library will not be created.
249
250 # ifdef USE_GCC
251 #  ifdef USG5
252 #   define EXTW_LINK(objs, output) $(CC) -shared objs -Xlinker -z -Xlinker text -o output
253 extw_link_beg = $(CC) -shared
254 extw_link_mid = -Xlinker -z -Xlinker text -o
255 extw_link_end =
256 ## I cannot figure out how to do shared a.out libraries, so just punt.
257 #  elif !defined (LINUX) || defined (__ELF__)
258 #   define EXTW_LINK(objs, output) $(CC) -shared objs -o output
259 extw_link_beg = $(CC) -shared
260 extw_link_mid = -o
261 extw_link_end =
262 #  endif
263 # elif defined (USG5)
264 #  if defined (IRIX)
265 #   define EXTW_LINK(objs, output) $(LD) -shared -g -check_registry ${TOOLROOT}/usr/lib/so_locations objs -o output
266 extw_link_beg = $(LD) -shared -g -check_registry ${TOOLROOT}/usr/lib/so_locations
267 extw_link_mid =  -o
268 extw_link_end =
269 #  else /* not IRIX */
270 #   define EXTW_LINK(objs, output) $(CC) -G objs -z text -o output
271 extw_link_beg = $(CC) -G
272 extw_link_mid = -z text -o
273 extw_link_end =
274 #  endif /* not IRIX */
275 # else /* not USG5 */
276 #  if defined (DEC_ALPHA) && defined (OSF1)
277 #   define EXTW_LINK(objs, output) $(LD) $(ldflags) $(ld_switch_shared) -d objs -o output $(LIBES)
278 extw_link_beg = $(LD) $(ldflags) $(ld_switch_shared) -d
279 extw_link_mid = -o
280 extw_link_end = $(LIBES)
281 #  else /* !(DEC_ALPHA && OSF1) */
282 #   define EXTW_LINK(objs, output) $(LD) -dc objs -assert pure-text -o output
283 extw_link_beg = $(LD) -dc
284 extw_link_mid = -assert pure-text -o
285 extw_link_end =
286 #  endif /* !(DEC_ALPHA && OSF1) */
287 # endif /* not USG5 */
288
289 #  ifdef LWLIB_USES_MOTIF
290 #    ifdef EXTW_LINK
291 motif_other_files = libextcli_Xm.a libextcli_Xm.so.1
292 #    else
293 motif_other_files = libextcli_Xm.a
294 #    endif
295 #endif /* LWLIB_USES_MOTIF */
296
297 #  ifdef EXTW_LINK
298 shared_other_files = libextcli_Xt.so.1 libextcli_Xlib.so.1
299 #  endif
300 other_files=\
301  ${motif_other_files}\
302  libextcli_Xt.a libextcli_Xlib.a\
303  ${shared_other_files}
304
305 all: ${other_files}
306 # endif /* EXTERNAL_WIDGET */
307
308 # if defined (HAVE_OFFIX_DND) || defined (HAVE_CDE)
309 dnd_objs = @dnd_objs@
310 # endif /* HAVE_OFFIX_DND || HAVE_CDE */
311
312 X11_objs =  EmacsFrame.o EmacsShell.o TopLevelEmacsShell.o TransientEmacsShell.o EmacsManager.o $(external_widget_objs) $(dnd_objs)
313 #endif /* HAVE_X_WINDOWS */
314
315 ## define otherobjs as list of object files that make-docfile
316 ## should not be told about.
317 otherobjs = lastfile.o $(mallocobjs) $(rallocobjs) $(X11_objs)
318 otherrtls = $(otherobjs:.o=.c.rtl)
319 othersrcs = $(otherobjs:.o=.c)
320
321 LIBES = $(lwlib_libs) $(malloclib) $(ld_libs_all) $(lib_gcc)
322
323 #ifdef I18N3
324 mo_dir = ${etcdir}
325 mo_file = ${mo_dir}emacs.mo
326 #endif
327
328 temacs_loadup = ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/loadup.el
329 dump_temacs   = ${temacs_loadup} dump
330 run_temacs    = ${temacs_loadup} run-temacs
331 debug_temacs = gdb ${EXE_TARGET}
332
333 release: ${EXE_TARGET} ${libsrc}DOC $(mo_file) ${other_files}
334 #ifdef CANNOT_DUMP
335         ln ${EXE_TARGET} ${PROGNAME}
336 #else
337         -if [ -w ${srcdir}/../lisp ]; then \
338           w=`pwd`; cd ${srcdir} && $${w}/${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/inc-vers; \
339         else true; fi
340         -./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/loadup.el dump
341         touch release
342 #endif /* ! defined (CANNOT_DUMP) */
343
344 ${DUMP_TARGET}: ${EXE_TARGET} ${libsrc}DOC $(mo_file) ${other_files} update-elc.stamp
345 #ifdef HEAP_IN_DATA
346         @$(RM) $@ && touch SATISFIED
347         -${dump_temacs}
348         @if test -f $@;        then if test -f SATISFIED; then \
349                 echo "Testing for Lisp shadows ..."; \
350                 ./${PROGNAME} -batch -vanilla -f list-load-path-shadows; fi; \
351                 $(RM) SATISFIED; exit 0; fi; \
352         if test -f SATISFIED; then $(RM) SATISFIED; exit 1; fi; \
353         $(RM) $@; \
354         $(RECURSIVE_MAKE) $@;
355 #else
356         @$(RM) $@
357         ${dump_temacs}
358         @echo "Testing for Lisp shadows ..."
359         @./${PROGNAME} -batch -vanilla -f list-load-path-shadows
360 #endif
361
362 fastdump: ${EXE_TARGET}
363         @$(RM) ${DUMP_TARGET} && touch SATISFIED
364         -${dump_temacs}
365         @./${PROGNAME} -batch -vanilla -f list-load-path-shadows
366
367 FRC.update-elc.stamp :
368
369 update-elc.stamp : ${EXE_TARGET} FRC.update-elc.stamp
370         @touch NOBYTECOMPILE
371         ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/update-elc.el
372         @if test ! -f $@ -o -f NOBYTECOMPILE; then touch $@; fi; \
373          $(RM) NOBYTECOMPILE
374
375 obj_src = $(objs:.o=.c)
376
377 dortl : $(obj_rtl) $(otherrtls)
378         echo "(defvar source-files '(" > ${srcdir}/../lisp/source-files.el
379         (for a in $(obj_src) $(othersrcs);do \
380         echo -n "\""$$a"\"" >> ${srcdir}/../lisp/source-files.el ;\
381         done)
382         echo "))" >> ${srcdir}/../lisp/source-files.el
383
384 #ifdef DYNODUMP
385 dynodump_deps = ../dynodump/dynodump.so
386 ../dynodump/dynodump.so:
387         cd ../dynodump && $(RECURSIVE_MAKE)
388 #endif /* DYNODUMP */
389
390 ${libsrc}DOC: ${EXE_TARGET} update-elc.stamp
391         $(RM) ${libsrc}DOC; \
392         ${DUMPENV} ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/make-docfile.el -- \
393                 -o ${libsrc}DOC -d ${srcdir} -i ${libsrc}../site-packages \
394                 ${obj_src} ${mallocdocsrc} ${rallocdocsrc} ${extra_doc_files}
395
396 dump_elcs: dump-elcs
397
398 dump-elcs: ${EXE_TARGET}
399         -${DUMPENV} ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/update-elc.el
400
401 all-elc all-elcs:
402         cd .. && $(RECURSIVE_MAKE) all-elc
403
404 #ifdef I18N3
405
406 # if defined(SPARC) && !defined(USG)
407    xgettext=             /usr/openwin/bin/xgettext
408    xgettext_args=        -o emacs -m_X messages
409    msgfmt=               /usr/openwin/bin/msgfmt
410 # else
411    xgettext=             xgettext
412    xgettext_args=        -s -d emacs -M_X messages
413    msgfmt=               msgfmt
414 #endif
415
416 ${mo_dir}emacs.po: ${libsrc}make-msgfile ${libsrc}make-po ${objs}
417         ${libsrc}make-msgfile -o ${libsrc}messages ${objs}
418         cd ${libsrc} && ${xgettext} ${xgettext_args}
419         $(RM) ${mo_dir}emacs.po
420         cd ${libsrc} && ${libsrc}make-po -a ${mo_dir}emacs.po DOC
421
422 ${mo_dir}emacs.mo: ${mo_dir}emacs.po
423         cd ${mo_dir} && ${msgfmt} -o emacs.mo emacs.po
424
425 ${libsrc}make-msgfile:
426         cd ${libsrc} && $(RECURSIVE_MAKE) make-msgfile
427
428 ${libsrc}make-po:
429         cd ${libsrc} && $(RECURSIVE_MAKE) make-po
430
431 #endif /* I18N3 */
432
433 ${libsrc}make-dump-id:
434         cd ${libsrc} && $(RECURSIVE_MAKE) make-dump-id
435
436 ${libsrc}make-docfile:
437         cd ${libsrc} && $(RECURSIVE_MAKE) make-docfile
438
439 ## Lint Section
440 LINT.c=$(LINT) $(LINTFLAGS) $(LINTINCLUDES)
441 LINTFILES= $(objs:.o=.ln)
442 LINTINCLUDES = $(cppflags)
443 ## LINTFLAGS= -fd -m -p -s -u -v -x
444 LINTFLAGS= -fd -m -s -u -v -x
445 lint: $(LINTFILES)
446         $(LINT.c) $(LINTFILES)
447 ## end of Lint Section
448
449 link_deps=\
450  $(start_files) ${objs} ${otherobjs}\
451  $(lwlib_deps) $(dynodump_deps)
452
453 temacs_deps = $(link_deps) ${DUMP_ID}
454
455 temacs_link_args=\
456  ${start_flags} ${ldflags}\
457  -o $@ ${start_files} ${objs} ${otherobjs} ${DUMP_ID} ${LIBES}
458
459 ${EXE_TARGET}: $(temacs_deps)
460         $(LD) $(temacs_link_args)
461
462 dump-id.c: ${libsrc}make-dump-id ${link_deps}
463         ${libsrc}make-dump-id
464
465 .PHONY : run-temacs
466
467 run-temacs: ${EXE_TARGET}
468         -${run_temacs}
469
470 ## We have automated tests!!
471 testdir = ${srcdir}/../tests/automated
472 batch_test_emacs = -batch -l ${testdir}/test-harness.el -f batch-test-emacs ${testdir}
473
474 .PHONY: check check-temacs
475 check:
476         ./${PROGNAME} ${batch_test_emacs}
477 check-temacs:
478         ${run_temacs} ${batch_test_emacs}
479
480 ## Debugging targets:
481 ##
482 ## None of the debugging products work with a dumped xemacs binary,
483 ## because it does unexpected things like free memory that has been
484 ## malloc'ed in a *different* process!!  So we need to run these on
485 ## temacs.
486
487 ## RTC is Sun WorkShop's Run Time Checking, integrated with dbx
488 rtc_patch.o:
489         rtc_patch_area -o $@
490
491 rtcmacs: $(temacs_deps) rtc_patch.o
492         $(RM) ${EXE_TARGET}; $(RECURSIVE_MAKE) ${EXE_TARGET} RTC_patch_objs=rtc_patch.o
493         mv ${EXE_TARGET} rtcmacs
494
495 .PHONY: run-rtcmacs
496 run-rtcmacs: rtcmacs
497         dbx -q -C -c \
498         'dbxenv rtc_error_log_file_name /dev/fd/1; \
499         dbxenv suppress_startup_message 5.0; \
500         ignore POLL; \
501         check -access; \
502         suppress rui; \
503         runargs -batch -l ${srcdir}/../lisp/loadup.el run-temacs -q; \
504         run' rtcmacs
505
506 debug-temacs: ${EXE_TARGET}
507         -${debug_temacs}
508
509 ## Purify, Quantify, PureCoverage are software quality products from
510 ## Rational, formerly Pure Atria, formerly Pure Software.
511 ##
512 ## Purify
513 PURIFY_PROG  = purify
514 PURIFY_LIBS  =
515 PURIFY_FLAGS =\
516 #ifdef PDUMP
517  -search-mmaps=yes\
518 #endif
519  -chain-length=32 -ignore-signals=SIGPOLL\
520  -cache-dir=${blddir}/purecache -always-use-cache-dir=yes
521
522 puremacs: $(temacs_deps)
523         $(PURIFY_PROG) $(PURIFY_FLAGS) $(LD) $(temacs_link_args) $(PURIFY_LIBS)
524         cp $@ ${EXE_TARGET}
525
526 ## Quantify
527 #ifdef  QUANTIFY
528 QUANTIFY_PROG     = quantify
529 QUANTIFY_HOME     = `$(QUANTIFY_PROG) -print-home-dir`
530 QUANTIFY_FLAGS    = -cache-dir=./purecache -always-use-cache-dir=yes
531 cppflags         += -I$(QUANTIFY_HOME)
532 temacs_link_args += $(QUANTIFY_HOME)/quantify_stubs.a
533
534 quantmacs: $(temacs_deps)
535         $(QUANTIFY_PROG) $(QUANTIFY_FLAGS) $(LD) $(temacs_link_args)
536         cp $@ ${EXE_TARGET}
537 #endif /* QUANTIFY */
538
539
540 PURECOV_PROG=purecov
541 covmacs: $(temacs_deps)
542         $(PURECOV_PROG) $(LD) $(temacs_link_args)
543
544
545 TopLevelEmacsShell.o : ${srcdir}/EmacsShell-sub.c config.h xintrinsicp.h EmacsShellP.h
546         $(CC) -c $(cflags) -DDEFINE_TOP_LEVEL_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
547         mv EmacsShell-sub.o TopLevelEmacsShell.o
548
549 TopLevelEmacsShell.c.rtl : ${srcdir}/EmacsShell-sub.c config.h xintrinsicp.h EmacsShellP.h
550         $(CC) -dr -c $(cflags) -DDEFINE_TOP_LEVEL_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
551         mv EmacsShell-sub.c.rtl TopLevelEmacsShell.c.rtl
552
553 TransientEmacsShell.o : ${srcdir}/EmacsShell-sub.c TopLevelEmacsShell.o config.h xintrinsicp.h EmacsShellP.h
554         $(CC) -c $(cflags) -DDEFINE_TRANSIENT_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
555         mv EmacsShell-sub.o TransientEmacsShell.o
556
557 TransientEmacsShell.c.rtl : ${srcdir}/EmacsShell-sub.c TopLevelEmacsShell.o config.h xintrinsicp.h EmacsShellP.h
558         $(CC) -dr -c $(cflags) -DDEFINE_TRANSIENT_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
559         mv EmacsShell-sub.c.rtl TransientEmacsShell.c.rtl
560
561 ## The above rules are subject to a race condition if using a parallel make.
562 TransientEmacsShell.o : TopLevelEmacsShell.o
563 TransientEmacsShell.c.rtl : TopLevelEmacsShell.c.rtl
564
565 ## Position-independent code for shared library creation
566 #if USE_GCC
567 pic_arg = -fpic
568 #elif defined (IRIX)
569 pic_arg = -KPIC
570 # else
571 pic_arg = -K pic
572 #endif
573
574 #ifdef EXTERNAL_WIDGET
575
576 external_client_motif_objs_shared    = ExternalClient-Xm-shared.o extw-Xt-shared.o extw-Xlib-shared.o
577 external_client_xt_objs_shared       = ExternalClient-Xt-shared.o extw-Xt-shared.o extw-Xlib-shared.o
578 external_client_xlib_objs_shared     = ExternalClient-Xlib-shared.o extw-Xlib-shared.o
579 external_client_motif_objs_nonshared = ExternalClient-Xm-nonshared.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
580 external_client_xt_objs_nonshared    = ExternalClient-Xt-nonshared.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
581 external_client_xlib_objs_nonshared  = ExternalClient-Xlib-nonshared.o extw-Xlib-nonshared.o
582
583 ## Add dependencies so things work right with a parallel make
584 ExternalClient-Xm-shared.o: ${srcdir}/ExternalClient.c ExternalClient-Xt-shared.o ExternalClient-Xm-nonshared.o
585         $(CC) -c $(pic_arg) $(cflags) -DEXTW_USES_MOTIF ${srcdir}/ExternalClient.c
586         mv ExternalClient.o ExternalClient-Xm-shared.o
587
588 ExternalClient-Xt-shared.o: ${srcdir}/ExternalClient.c ExternalClient-Xt-nonshared.o
589         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/ExternalClient.c
590         mv ExternalClient.o ExternalClient-Xt-shared.o
591
592 ExternalClient-Xlib-shared.o: ${srcdir}/ExternalClient-Xlib.c ExternalClient-Xlib-nonshared.o
593         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/ExternalClient-Xlib.c
594         mv ExternalClient-Xlib.o ExternalClient-Xlib-shared.o
595
596 ExternalClient-Xm-nonshared.o: ${srcdir}/ExternalClient.c ExternalClient-Xt-nonshared.o
597         $(CC) -c $(cflags) -DEXTW_USES_MOTIF ${srcdir}/ExternalClient.c
598         mv ExternalClient.o ExternalClient-Xm-nonshared.o
599
600 ExternalClient-Xt-nonshared.o: ${srcdir}/ExternalClient.c
601         $(CC) -c $(cflags) ${srcdir}/ExternalClient.c
602         mv ExternalClient.o ExternalClient-Xt-nonshared.o
603
604 ExternalClient-Xlib-nonshared.o: ${srcdir}/ExternalClient-Xlib.c
605         $(CC) -c $(cflags) ${srcdir}/ExternalClient-Xlib.c
606         mv ExternalClient-Xlib.o ExternalClient-Xlib-nonshared.o
607
608 ## We compile the common files twice (once with PIC and once without)
609 ## because on some systems, compiling with PIC but not linking into
610 ## a shared library messes things up.
611
612 extw-Xt-shared.o: ${srcdir}/extw-Xt.c extw-Xt-nonshared.o
613         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/extw-Xt.c
614         mv extw-Xt.o extw-Xt-shared.o
615
616 extw-Xlib-shared.o: ${srcdir}/extw-Xlib.c extw-Xlib-nonshared.o
617         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/extw-Xlib.c
618         mv extw-Xlib.o extw-Xlib-shared.o
619
620 extw-Xt-nonshared.o: ${srcdir}/extw-Xt.c
621         $(CC) -c $(cflags) ${srcdir}/extw-Xt.c
622         mv extw-Xt.o extw-Xt-nonshared.o
623
624 extw-Xlib-nonshared.o: ${srcdir}/extw-Xlib.c
625         $(CC) -c $(cflags) ${srcdir}/extw-Xlib.c
626         mv extw-Xlib.o extw-Xlib-nonshared.o
627
628 libextcli_Xm.a: ${external_client_motif_objs_nonshared}
629         ar r libextcli_Xm.a ${external_client_motif_objs_nonshared}
630
631 libextcli_Xt.a: ${external_client_xt_objs_nonshared}
632         ar r libextcli_Xt.a ${external_client_xt_objs_nonshared}
633
634 libextcli_Xlib.a: ${external_client_xlib_objs_nonshared}
635         ar r libextcli_Xlib.a ${external_client_xlib_objs_nonshared}
636
637 #ifdef EXTW_LINK
638
639 libextcli_Xm.so.1: ${external_client_motif_objs_shared}
640         ${extw_link_beg} ${external_client_motif_objs_shared} ${extw_link_mid} libextcli_Xm.so.1 ${extw_link_end}
641
642 libextcli_Xt.so.1: ${external_client_xt_objs_shared}
643         ${extw_link_beg} ${external_client_xt_objs_shared} ${extw_link_mid} libextcli_Xt.so.1 ${extw_link_end}
644
645 libextcli_Xlib.so.1: ${external_client_xlib_objs_shared}
646         ${extw_link_beg} ${external_client_xlib_objs_shared} ${extw_link_mid} libextcli_Xlib.so.1 ${extw_link_end}
647
648 #endif /* EXTW_LINK */
649
650 #endif /* EXTERNAL_WIDGET */
651
652 config.h: ${srcdir}/config.h.in
653 Emacs.ad.h: ${srcdir}/${etcdir}Emacs.ad
654
655 config.h sheap-adjust.h paths.h Emacs.ad.h :
656         @echo "The file $@ needs to be re-generated."
657         @echo "Please run a make in the top level directory."
658         @echo "Consult the file \`INSTALL' for instructions for building XEmacs."
659         @exit 1
660
661 ## Some machines have alloca built-in.
662 ## They should define HAVE_ALLOCA, or may just let alloca.s
663 ## be used but generate no code.
664 ## Some have it written in assembler in alloca.s.
665 ## Some use the C version in alloca.c (these define C_ALLOCA in config.h).
666
667
668 #ifdef C_ALLOCA
669 ## We could put something in alloca.c to #define free and malloc
670 ## whenever emacs was #defined, but that's not appropriate for all
671 ## users of alloca in Emacs.  Check out ../lib-src/getopt.c.  */
672
673 alloca.o : ${srcdir}/alloca.c
674         $(CC) -c -Dfree=xfree -Dmalloc=xmalloc $(cflags) ${srcdir}/alloca.c
675 #else
676 #ifndef HAVE_ALLOCA
677 alloca.o : ${srcdir}/alloca.s config.h
678 ## $(CPP) is cc -E, which may get confused by filenames
679 ## that do not end in .c.  So copy file to a safe name.  */
680 ##      cp ${srcdir}/alloca.s allocatem.c
681 ## Remove any ^L, blank lines, and preprocessor comments,
682 ## since some assemblers barf on them.  Use a different basename for the
683 ## output file, since some stupid compilers (Green Hill) use that
684 ## name for the intermediate assembler file.
685         $(CPP) $(cppflags) allocatem.c | \
686         sed -e 's/\f//' -e 's/^#.*//' | \
687         sed -n -e '/^..*$$/p' > allocax.s
688         @$(RM) alloca.o
689 ## Xenix, in particular, needs to run assembler via cc.
690         $(CC) -c allocax.s
691         mv allocax.o alloca.o
692         $(RM) allocax.s allocatem.c
693 #endif /* HAVE_ALLOCA */
694 #endif /* ! defined (C_ALLOCA) */
695
696 #ifdef HAVE_NATIVE_SOUND
697 sound_cflags=@sound_cflags@
698 sunplay.o: ${srcdir}/sunplay.c
699         $(CC) -c  $(sound_cflags) $(cflags) ${srcdir}/sunplay.c
700 hpplay.o: ${srcdir}/hpplay.c
701         $(CC) -c -Demacs $(sound_cflags) $(cflags) ${srcdir}/hpplay.c
702 #endif /* HAVE_NATIVE_SOUND */
703
704 #if defined(HAVE_GLADE_GLADE_H) || defined(HAVE_GLADE_H)
705 glade_files=glade.c
706 #endif
707
708 #ifdef HAVE_GTK
709 extra_doc_files=emacs-widget-accessors.c ui-byhand.c $(glade_files)
710 #endif
711
712 xemacs_res.o: ${srcdir}/../nt/xemacs.rc
713         windres --include-dir ${srcdir}/../nt -i ${srcdir}/../nt/xemacs.rc -o $@
714
715 ## System-specific programs to be made.
716 ## ${other_files}, $(objects_system) and $(objects_machine)
717 ## select which of these should be compiled.  */
718
719 .PHONY: mostlyclean clean distclean realclean versionclean extraclean
720 mostlyclean:
721         $(RM) temacs puremacs quantmacs *.o *.i  \
722           core temacs.exe sheap-adjust.h
723 clean: mostlyclean versionclean
724         $(RM) libextcli* update-elc.stamp
725 ## This is used in making a distribution.
726 ## Do not use it on development directories!
727 distclean: clean
728         $(RM) config.h paths.h Emacs.ad.h \
729           GNUmakefile Makefile Makefile.in TAGS ${PROGNAME}.*
730 realclean: distclean
731 versionclean:
732         $(RM) ${EXE_TARGET} ${DUMP_TARGET} ${libsrc}DOC
733 extraclean: realclean
734         $(RM) *~ \#* m/*~ m/\#* s/*~ s/\#*
735
736 .PHONY : lock unlock
737 SOURCES = *.[chm] *.pswm [sm]/* COPYING paths.h.in Makefile.in.in \
738         config.h.in README COPYING ChangeLog
739 unlock:
740         chmod u+w $(SOURCES)
741
742 relock:
743         chmod -w $(SOURCES)
744
745 ## Header files for ellcc
746 #ifdef HAVE_SHLIB
747 MAKEPATH=../lib-src/make-path
748 install: ${PROGNAME}
749         ${MAKEPATH} ${archlibdir}/include ${archlibdir}/include/m ${archlibdir}/include/s
750         -@echo "Copying include files for ellcc..."
751         -@hdir=`pwd`; \
752         cd ${srcdir}; hdrdir2=`pwd`; cd $$hdir; \
753         test "$$hdrdir2" != "$$hdir" && hdir="$$hdir $$hdrdir2"; \
754         (for thisdir in $$hdir; do \
755                 cd $$thisdir && \
756                 (hdrtars=; \
757                 for hdrfile in *.h; do \
758                         hdrtars="$$hdrtars $$hdrfile"; \
759                 done; \
760                 test -d s && hdrtars="$$hdrtars s/*"; \
761                 test -d m && hdrtars="$$hdrtars m/*"; \
762                 test -n "$$hdrtars" && (${TAR} cf - $$hdrtars) | \
763                         (cd ${archlibdir}/include && umask 022 && ${TAR} xf -); \
764                 chmod 755 ${archlibdir}/include; \
765                 test -d ${archlibdir}/include/s && \
766                   chmod 755 ${archlibdir}/include/s; \
767                 test -d ${archlibdir}/include/m && \
768                   chmod 755 ${archlibdir}/include/s;) \
769         done)
770 #endif
771
772 ## Dependency processing using home-grown script, not makedepend
773 .PHONY: depend
774 FRC.depend:
775 depend: FRC.depend
776         cd ${srcdir} && $(RM) depend.tmp && \
777         perl ./make-src-depend > depend.tmp && \
778         if cmp -s depend depend.tmp; \
779         then $(RM) depend.tmp; \
780         else $(RM) depend && mv depend.tmp depend; \
781         fi