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