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