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