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