Contents in 1999-06-04-13 of release-21-2.
[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 select-x.o xgccache.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 select.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 #ifdef HEAP_IN_DATA
344         @$(RM) $@ $@.exe && touch SATISFIED
345         -${dump_temacs}
346         @if test -f $@;        then if test -f SATISFIED; then \
347                 echo "Testing for Lisp shadows ..."; \
348                 ./${PROGNAME} -batch -vanilla -f list-load-path-shadows; fi; \
349                 $(RM) SATISFIED; exit 0; fi; \
350         if test -f SATISFIED; then $(RM) SATISFIED; exit 1; fi; \
351         $(RECURSIVE_MAKE) $@;
352 #else
353         @$(RM) $@
354         -${dump_temacs}
355         @echo "Testing for Lisp shadows ..."
356         @./${PROGNAME} -batch -vanilla -f list-load-path-shadows
357 #endif
358
359 fastdump: temacs 
360         @$(RM) ${PROGNAME} && touch SATISFIED
361         -${dump_temacs}
362         @./${PROGNAME} -batch -vanilla -f list-load-path-shadows
363
364 FRC.update-elc.stamp :
365
366 update-elc.stamp : temacs FRC.update-elc.stamp
367         @touch NOBYTECOMPILE
368         ${DUMPENV} ./temacs -batch -l ${srcdir}/../lisp/update-elc.el
369         @if test ! -f $@ -o -f NOBYTECOMPILE; then touch $@; fi; \
370          $(RM) NOBYTECOMPILE
371
372 obj_src = $(objs:.o=.c)
373
374 dortl : $(obj_rtl) $(otherrtls)
375         echo "(defvar source-files '(" > ${srcdir}/../lisp/source-files.el
376         (for a in $(obj_src) $(othersrcs);do \
377         echo -n "\""$$a"\"" >> ${srcdir}/../lisp/source-files.el ;\
378         done)
379         echo "))" >> ${srcdir}/../lisp/source-files.el
380
381 #ifdef DYNODUMP
382 dynodump_deps = ../dynodump/dynodump.so
383 ../dynodump/dynodump.so:
384         cd ../dynodump && $(RECURSIVE_MAKE)
385 #endif /* DYNODUMP */
386
387 ${libsrc}DOC: temacs update-elc.stamp
388         $(RM) ${libsrc}DOC; \
389         ${DUMPENV} ./temacs -batch -l ${srcdir}/../lisp/make-docfile.el -- \
390                 -o ${libsrc}DOC -d ${srcdir} -i ${libsrc}../site-packages \
391                 ${obj_src} ${mallocdocsrc} ${rallocdocsrc}
392
393 dump_elcs: dump-elcs
394
395 dump-elcs: temacs
396         -${DUMPENV} ./temacs -batch -l ${srcdir}/../lisp/update-elc.el
397
398 all-elc all-elcs:
399         cd .. && $(RECURSIVE_MAKE) all-elc
400
401 #ifdef I18N3
402
403 # if defined(SPARC) && !defined(USG)
404    xgettext=             /usr/openwin/bin/xgettext
405    xgettext_args=        -o emacs -m_X messages
406    msgfmt=               /usr/openwin/bin/msgfmt
407 # else
408    xgettext=             xgettext
409    xgettext_args=        -s -d emacs -M_X messages
410    msgfmt=               msgfmt
411 #endif
412
413 ${mo_dir}emacs.po: ${libsrc}make-msgfile ${libsrc}make-po ${objs}
414         ${libsrc}make-msgfile -o ${libsrc}messages ${objs}
415         cd ${libsrc} && ${xgettext} ${xgettext_args}
416         $(RM) ${mo_dir}emacs.po
417         cd ${libsrc} && ${libsrc}make-po -a ${mo_dir}emacs.po DOC
418
419 ${mo_dir}emacs.mo: ${mo_dir}emacs.po
420         cd ${mo_dir} && ${msgfmt} -o emacs.mo emacs.po
421
422 ${libsrc}make-msgfile:
423         cd ${libsrc} && $(RECURSIVE_MAKE) make-msgfile
424
425 ${libsrc}make-po:
426         cd ${libsrc} && $(RECURSIVE_MAKE) make-po
427
428 #endif /* I18N3 */
429
430 ${libsrc}make-docfile:
431         cd ${libsrc} && $(RECURSIVE_MAKE) make-docfile
432
433 ## Lint Section
434 LINT.c=$(LINT) $(LINTFLAGS) $(LINTINCLUDES)
435 LINTFILES= $(objs:.o=.ln)
436 LINTINCLUDES = $(cppflags)
437 ## LINTFLAGS= -fd -m -p -s -u -v -x
438 LINTFLAGS= -fd -m -s -u -v -x
439 lint: $(LINTFILES)
440         $(LINT.c) $(LINTFILES)
441 ## end of Lint Section
442
443 temacs_deps=\
444  $(start_files) ${objs} ${otherobjs}\
445  $(lwlib_deps) $(dynodump_deps)
446
447 temacs_link_args=\
448  ${start_flags} ${ldflags}\
449  -o $@ ${start_files} ${objs} ${otherobjs} ${LIBES}
450
451 temacs: $(temacs_deps)
452         $(LD) $(temacs_link_args)
453
454 .PHONY : run-temacs
455
456 run-temacs: temacs
457         -${run_temacs}
458
459 ## We have automated tests!!
460 testdir = ${srcdir}/../tests/automated
461 batch_test_emacs = -batch -l ${testdir}/test-harness.el -f batch-test-emacs ${testdir}
462
463 .PHONY: check check-temacs
464 check:
465         ./${PROGNAME} ${batch_test_emacs}
466 check-temacs:
467         ${run_temacs} ${batch_test_emacs}
468
469 ## Debugging targets:
470 ##
471 ## None of the debugging products work with a dumped xemacs binary,
472 ## because it does unexpected things like free memory that has been
473 ## malloc'ed in a *different* process!!  So we need to run these on
474 ## temacs.
475
476 ## RTC is Sun WorkShop's Run Time Checking, integrated with dbx
477 rtc_patch.o:
478         rtc_patch_area -o $@
479
480 rtcmacs: $(temacs_deps) rtc_patch.o
481         $(RM) temacs; $(RECURSIVE_MAKE) temacs RTC_patch_objs=rtc_patch.o
482         mv temacs rtcmacs
483
484 .PHONY: run-rtcmacs
485 run-rtcmacs: rtcmacs
486         dbx -q -C -c \
487         'dbxenv rtc_error_log_file_name /dev/fd/1; \
488         dbxenv suppress_startup_message 5.0; \
489         ignore POLL; \
490         check -access; \
491         suppress rui; \
492         runargs -batch -l ${srcdir}/../lisp/loadup.el run-temacs -q; \
493         run' rtcmacs
494
495 ## Purify, Quantify, PureCoverage are software quality products from
496 ## Rational, formerly Pure Atria, formerly Pure Software.
497 ##
498 ## Purify
499 PURIFY_PROG  = purify
500 PURIFY_FLAGS = -chain-length=32 -ignore-signals=SIGPOLL -threads=yes \
501  -cache-dir=./purecache -always-use-cache-dir=yes -pointer-mask=0x0fffffff
502 PURIFY_LIBS  = -lpthread
503 puremacs: $(temacs_deps)
504         $(PURIFY_PROG) $(PURIFY_FLAGS) $(LD) $(temacs_link_args) $(PURIFY_LIBS)
505         cp $@ temacs
506
507 ## Quantify
508 #ifdef  QUANTIFY
509 QUANTIFY_PROG     = quantify
510 QUANTIFY_HOME     = `$(QUANTIFY_PROG) -print-home-dir`
511 QUANTIFY_FLAGS    = -cache-dir=./purecache -always-use-cache-dir=yes
512 cppflags         += -I$(QUANTIFY_HOME)
513 temacs_link_args += $(QUANTIFY_HOME)/quantify_stubs.a
514
515 quantmacs: $(temacs_deps)
516         $(QUANTIFY_PROG) $(QUANTIFY_FLAGS) $(LD) $(temacs_link_args)
517         cp $@ temacs
518 #endif /* QUANTIFY */
519
520
521 PURECOV_PROG=purecov
522 covmacs: $(temacs_deps)
523         $(PURECOV_PROG) $(LD) $(temacs_link_args)
524
525
526 TopLevelEmacsShell.o : ${srcdir}/EmacsShell-sub.c config.h xintrinsicp.h EmacsShellP.h
527         $(CC) -c $(cflags) -DDEFINE_TOP_LEVEL_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
528         mv EmacsShell-sub.o TopLevelEmacsShell.o
529
530 TopLevelEmacsShell.c.rtl : ${srcdir}/EmacsShell-sub.c config.h xintrinsicp.h EmacsShellP.h
531         $(CC) -dr -c $(cflags) -DDEFINE_TOP_LEVEL_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
532         mv EmacsShell-sub.c.rtl TopLevelEmacsShell.c.rtl
533
534 TransientEmacsShell.o : ${srcdir}/EmacsShell-sub.c TopLevelEmacsShell.o config.h xintrinsicp.h EmacsShellP.h
535         $(CC) -c $(cflags) -DDEFINE_TRANSIENT_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
536         mv EmacsShell-sub.o TransientEmacsShell.o
537
538 TransientEmacsShell.c.rtl : ${srcdir}/EmacsShell-sub.c TopLevelEmacsShell.o config.h xintrinsicp.h EmacsShellP.h
539         $(CC) -dr -c $(cflags) -DDEFINE_TRANSIENT_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
540         mv EmacsShell-sub.c.rtl TransientEmacsShell.c.rtl
541
542 ## Position-independent code for shared library creation
543 #if USE_GCC
544 pic_arg = -fpic
545 #elif defined (IRIX)
546 pic_arg = -KPIC
547 # else
548 pic_arg = -K pic
549 #endif
550
551 #ifdef EXTERNAL_WIDGET
552
553 external_client_motif_objs_shared    = ExternalClient-Xm-shared.o extw-Xt-shared.o extw-Xlib-shared.o
554 external_client_xt_objs_shared       = ExternalClient-Xt-shared.o extw-Xt-shared.o extw-Xlib-shared.o
555 external_client_xlib_objs_shared     = ExternalClient-Xlib-shared.o extw-Xlib-shared.o
556 external_client_motif_objs_nonshared = ExternalClient-Xm-nonshared.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
557 external_client_xt_objs_nonshared    = ExternalClient-Xt-nonshared.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
558 external_client_xlib_objs_nonshared  = ExternalClient-Xlib-nonshared.o extw-Xlib-nonshared.o
559
560 ## Add dependencies so things work right with a parallel make
561 ExternalClient-Xm-shared.o: ${srcdir}/ExternalClient.c ExternalClient-Xt-shared.o ExternalClient-Xm-nonshared.o
562         $(CC) -c $(pic_arg) $(cflags) -DEXTW_USES_MOTIF ${srcdir}/ExternalClient.c
563         mv ExternalClient.o ExternalClient-Xm-shared.o
564
565 ExternalClient-Xt-shared.o: ${srcdir}/ExternalClient.c ExternalClient-Xt-nonshared.o
566         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/ExternalClient.c
567         mv ExternalClient.o ExternalClient-Xt-shared.o
568
569 ExternalClient-Xlib-shared.o: ${srcdir}/ExternalClient-Xlib.c ExternalClient-Xlib-nonshared.o
570         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/ExternalClient-Xlib.c
571         mv ExternalClient-Xlib.o ExternalClient-Xlib-shared.o
572
573 ExternalClient-Xm-nonshared.o: ${srcdir}/ExternalClient.c ExternalClient-Xt-nonshared.o
574         $(CC) -c $(cflags) -DEXTW_USES_MOTIF ${srcdir}/ExternalClient.c
575         mv ExternalClient.o ExternalClient-Xm-nonshared.o
576
577 ExternalClient-Xt-nonshared.o: ${srcdir}/ExternalClient.c
578         $(CC) -c $(cflags) ${srcdir}/ExternalClient.c
579         mv ExternalClient.o ExternalClient-Xt-nonshared.o
580
581 ExternalClient-Xlib-nonshared.o: ${srcdir}/ExternalClient-Xlib.c
582         $(CC) -c $(cflags) ${srcdir}/ExternalClient-Xlib.c
583         mv ExternalClient-Xlib.o ExternalClient-Xlib-nonshared.o
584
585 ## We compile the common files twice (once with PIC and once without)
586 ## because on some systems, compiling with PIC but not linking into
587 ## a shared library messes things up.
588
589 extw-Xt-shared.o: ${srcdir}/extw-Xt.c extw-Xt-nonshared.o
590         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/extw-Xt.c
591         mv extw-Xt.o extw-Xt-shared.o
592
593 extw-Xlib-shared.o: ${srcdir}/extw-Xlib.c extw-Xlib-nonshared.o
594         $(CC) -c $(pic_arg) $(cflags) ${srcdir}/extw-Xlib.c
595         mv extw-Xlib.o extw-Xlib-shared.o
596
597 extw-Xt-nonshared.o: ${srcdir}/extw-Xt.c
598         $(CC) -c $(cflags) ${srcdir}/extw-Xt.c
599         mv extw-Xt.o extw-Xt-nonshared.o
600
601 extw-Xlib-nonshared.o: ${srcdir}/extw-Xlib.c
602         $(CC) -c $(cflags) ${srcdir}/extw-Xlib.c
603         mv extw-Xlib.o extw-Xlib-nonshared.o
604
605 libextcli_Xm.a: ${external_client_motif_objs_nonshared}
606         ar r libextcli_Xm.a ${external_client_motif_objs_nonshared}
607
608 libextcli_Xt.a: ${external_client_xt_objs_nonshared}
609         ar r libextcli_Xt.a ${external_client_xt_objs_nonshared}
610
611 libextcli_Xlib.a: ${external_client_xlib_objs_nonshared}
612         ar r libextcli_Xlib.a ${external_client_xlib_objs_nonshared}
613
614 #ifdef EXTW_LINK
615
616 libextcli_Xm.so.1: ${external_client_motif_objs_shared}
617         ${extw_link_beg} ${external_client_motif_objs_shared} ${extw_link_mid} libextcli_Xm.so.1 ${extw_link_end}
618
619 libextcli_Xt.so.1: ${external_client_xt_objs_shared}
620         ${extw_link_beg} ${external_client_xt_objs_shared} ${extw_link_mid} libextcli_Xt.so.1 ${extw_link_end}
621
622 libextcli_Xlib.so.1: ${external_client_xlib_objs_shared}
623         ${extw_link_beg} ${external_client_xlib_objs_shared} ${extw_link_mid} libextcli_Xlib.so.1 ${extw_link_end}
624
625 #endif /* EXTW_LINK */
626
627 #endif /* EXTERNAL_WIDGET */
628
629 config.h: ${srcdir}/config.h.in
630 Emacs.ad.h: ${srcdir}/${etcdir}Emacs.ad
631
632 config.h sheap-adjust.h paths.h Emacs.ad.h :
633         @echo "The file $@ needs to be re-generated."
634         @echo "Please run a make in the top level directory."
635         @echo "Consult the file \`INSTALL' for instructions for building XEmacs."
636         @exit 1
637
638 ## Some machines have alloca built-in.
639 ## They should define HAVE_ALLOCA, or may just let alloca.s
640 ## be used but generate no code.
641 ## Some have it written in assembler in alloca.s.
642 ## Some use the C version in alloca.c (these define C_ALLOCA in config.h).
643
644
645 #ifdef C_ALLOCA
646 ## We could put something in alloca.c to #define free and malloc
647 ## whenever emacs was #defined, but that's not appropriate for all
648 ## users of alloca in Emacs.  Check out ../lib-src/getopt.c.  */
649
650 alloca.o : ${srcdir}/alloca.c
651         $(CC) -c -Dfree=xfree -Dmalloc=xmalloc $(cflags) ${srcdir}/alloca.c
652 #else
653 #ifndef HAVE_ALLOCA
654 alloca.o : ${srcdir}/alloca.s config.h
655 ## $(CPP) is cc -E, which may get confused by filenames
656 ## that do not end in .c.  So copy file to a safe name.  */
657 ##      cp ${srcdir}/alloca.s allocatem.c
658 ## Remove any ^L, blank lines, and preprocessor comments,
659 ## since some assemblers barf on them.  Use a different basename for the
660 ## output file, since some stupid compilers (Green Hill) use that
661 ## name for the intermediate assembler file.
662         $(CPP) $(cppflags) allocatem.c | \
663         sed -e 's/\f//' -e 's/^#.*//' | \
664         sed -n -e '/^..*$$/p' > allocax.s
665         @$(RM) alloca.o
666 ## Xenix, in particular, needs to run assembler via cc.
667         $(CC) -c allocax.s
668         mv allocax.o alloca.o
669         $(RM) allocax.s allocatem.c
670 #endif /* HAVE_ALLOCA */
671 #endif /* ! defined (C_ALLOCA) */
672
673 #ifdef HAVE_NATIVE_SOUND
674 sunplay.o: ${srcdir}/sunplay.c
675         $(CC) -c  $(sound_cflags) $(cflags) ${srcdir}/sunplay.c
676 hpplay.o: ${srcdir}/hpplay.c
677         $(CC) -c -Demacs $(sound_cflags) $(cflags) ${srcdir}/hpplay.c
678 #endif /* HAVE_NATIVE_SOUND */
679
680 ## System-specific programs to be made.
681 ## ${other_files}, $(objects_system) and $(objects_machine)
682 ## select which of these should be compiled.  */
683
684 .PHONY: mostlyclean clean distclean realclean versionclean extraclean
685 mostlyclean:
686         $(RM) temacs puremacs quantmacs prefix-args *.o *.i  \
687           core temacs.exe sheap-adjust.h
688 clean: mostlyclean versionclean
689         $(RM) libextcli* update-elc.stamp
690 ## This is used in making a distribution.
691 ## Do not use it on development directories!
692 distclean: clean
693         $(RM) config.h paths.h Emacs.ad.h \
694           GNUmakefile Makefile Makefile.in TAGS ${PROGNAME}.*
695 realclean: distclean
696 versionclean:
697         $(RM) ${PROGNAME} ${PROGNAME}.exe ${libsrc}DOC
698 extraclean: realclean
699         $(RM) *~ \#* m/*~ m/\#* s/*~ s/\#*
700
701 .PHONY : lock unlock
702 SOURCES = *.[chm] *.pswm [sm]/* COPYING paths.h.in Makefile.in.in \
703         config.h.in README COPYING ChangeLog
704 unlock:
705         chmod u+w $(SOURCES)
706
707 relock:
708         chmod -w $(SOURCES)
709
710 ## Header files for ellcc
711 #ifdef HAVE_SHLIB
712 MAKEPATH=../lib-src/make-path
713 install: ${PROGNAME}
714         ${MAKEPATH} ${archlibdir}/include ${archlibdir}/include/m ${archlibdir}/include/s
715         -@echo "Copying include files for ellcc..."
716         -@hdir=`pwd`; \
717         cd ${srcdir}; hdrdir2=`pwd`; cd $$hdir; \
718         test "$$hdrdir2" != "$$hdir" && hdir="$$hdir $$hdrdir2"; \
719         (for thisdir in $$hdir; do \
720                 cd $$hdir && \
721                 (hdrtars=; \
722                 for hdrfile in *.h; do \
723                         hdrtars="$$hdrtars $$hdrfile"; \
724                 done; \
725                 test -d s && hdrtars="$$hdrtars s/*"; \
726                 test -d m && hdrtars="$$hdrtars m/*"; \
727                 test -n "$$hdrtars" && (tar cf - $$hdrtars) | \
728                         (cd ${archlibdir}/include && umask 022 && tar xf -); \
729                 chmod 755 ${archlibdir}/include; \
730                 test -d ${archlibdir}/include/s && \
731                   chmod 755 ${archlibdir}/include/s; \
732                 test -d ${archlibdir}/include/m && \
733                   chmod 755 ${archlibdir}/include/s;) \
734         done)
735 #endif
736
737 ## Dependency processing using home-grown script, not makedepend
738 .PHONY: depend
739 FRC.depend:
740 depend: FRC.depend
741         cd ${srcdir} && $(RM) depend.tmp && \
742         perl make-src-depend > depend.tmp && \
743         $(RM) depend && mv depend.tmp depend