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