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