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