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