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