XEmacs 21.2.45 "Thelxepeia".
[chise/xemacs-chise.git.1] / src / Makefile.in.in
index 3da462f..0b2c9cf 100644 (file)
@@ -2,6 +2,7 @@
 ##   Copyright (C) 1985, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
 ##   Copyright (C) 1994, 1995 Board of Trustees, University of Illinois
 ##   Copyright (C) 1996, 1997 Sun Microsystems, Inc.
+##   Copyright (C) 1998, 1999 J. Kean Johnston.
 
 ## This file is part of XEmacs.
 
 
 PROGNAME=@PROGNAME@
 
-all: ${PROGNAME}
+#define NOT_C_CODE
+#include "config.h"
+
+#ifdef PDUMP
+DUMP_TARGET = ${PROGNAME}.dmp
+EXE_TARGET  = ${PROGNAME}
+DUMP_ID     = dump-id.o
+#else
+DUMP_TARGET = ${PROGNAME}
+EXE_TARGET  = temacs
+#endif
+
+all: ${DUMP_TARGET}
 .PHONY : all release dump-elc dump-elcs all-elc all-elcs lint
 
 ## For performance and consistency, no built-in rules.
 .SUFFIXES:
 .SUFFIXES: .c .h .o .i .s .dep
 
+#ifdef USE_GNU_MAKE
+RECURSIVE_MAKE=$(MAKE)
+#else
 @SET_MAKE@
+RECURSIVE_MAKE=@RECURSIVE_MAKE@
+#endif
+
 SHELL=/bin/sh
 RM = rm -f
 
 lispdir = ${srcdir}/../lisp/
+moduledir = ${srcdir}/../modules/
 libsrc = ../lib-src/
 etcdir = ../etc/
 
@@ -44,12 +64,11 @@ prefix=@prefix@
 srcdir=@srcdir@
 blddir=@blddir@
 version=@version@
-CC=@CC@
+CC=@XEMACS_CC@
 CPP=@CPP@
 CFLAGS=@CFLAGS@
 CPPFLAGS=@CPPFLAGS@
 LDFLAGS=@LDFLAGS@
-RECURSIVE_MAKE=@RECURSIVE_MAKE@
 
 c_switch_all=@c_switch_all@
 ld_switch_all=@ld_switch_all@
@@ -66,8 +85,6 @@ LD=@ld@
 lib_gcc=@lib_gcc@
 ##libmcheck=@libmcheck@
 
-#define NOT_C_CODE
-#include "config.h"
 
 ## With the traditional VPATH setting, it is not possible to
 ## simultaneously compile in-place and in another directory.  The
@@ -90,18 +107,14 @@ vpath %.h @srcdir@
 vpath config.h
 vpath paths.h
 vpath Emacs.ad.h
-vpath puresize-adjust.h
 vpath sheap-adjust.h
+vpath dump-id.c
 #else
 VPATH=@srcdir@
 #endif
 
 RM = rm -f
 
-#ifdef HAVE_NATIVE_SOUND
-sound_cflags=@sound_cflags@
-#endif
-
 LWLIB_SRCDIR = ${srcdir}/../lwlib
 
 #ifdef HAVE_X_WINDOWS
@@ -110,8 +123,8 @@ lwlib_deps = $(lwlib_libs)
 $(lwlib_libs) :
        cd ../lwlib && $(RECURSIVE_MAKE)
 
-x_objs=balloon_help.o balloon-x.o console-x.o device-x.o event-Xt.o frame-x.o\
- glyphs-x.o objects-x.o redisplay-x.o xgccache.o xselect.o 
+x_objs=console-x.o device-x.o event-Xt.o frame-x.o\
+ glyphs-x.o objects-x.o redisplay-x.o select-x.o xgccache.o
 
 #ifdef AIX4
 LIBI18N = -li18n
@@ -120,8 +133,12 @@ LIBI18N = -li18n
 X11_libs = $(LIBI18N)
 #endif /* HAVE_X_WINDOWS */
 
-#ifdef HEAP_IN_DATA
-sheap_obj=sheap.o
+#if defined (HEAP_IN_DATA) && !defined (PDUMP)
+sheap_objs=sheap.o
+#endif
+
+#if defined (WIN32_NATIVE) || defined (CYGWIN)
+win32_objs=win32.o xemacs_res.o
 #endif
 
 ## -Demacs is needed to make some files produce the correct version
@@ -129,7 +146,11 @@ sheap_obj=sheap.o
 
 cppflags = $(CPPFLAGS) -Demacs -I. $(c_switch_all)
 cflags   = $(CFLAGS) $(cppflags)
+#if defined (WIN32_NATIVE) || defined (CYGWIN)
+ldflags  = $(LDFLAGS) -mwindows $(ld_switch_all) $(ld_dynamic_link_flags)
+#else
 ldflags  = $(LDFLAGS) $(ld_switch_all) $(ld_dynamic_link_flags)
+#endif
 
 #ifdef SOLARIS2
 %.o : %.c
@@ -169,15 +190,15 @@ objs=\
  eval.o events.o $(extra_objs)\
  event-stream.o extents.o faces.o\
  fileio.o $(LOCK_OBJ) filemode.o floatfns.o fns.o font-lock.o\
- frame.o general.o getloadavg.o glyphs.o glyphs-eimage.o\
- $(gui_objs) hash.o imgproc.o indent.o insdel.o intl.o\
+ frame.o general.o glyphs.o glyphs-eimage.o glyphs-widget.o\
+ gui.o gutter.o $(gui_objs) hash.o imgproc.o indent.o insdel.o intl.o\
  keymap.o $(RTC_patch_objs) line-number.o lread.o lstream.o\
  macros.o marker.o md5.o minibuf.o objects.o opaque.o\
- print.o process.o profile.o pure.o\
+ print.o process.o profile.o\
  rangetab.o redisplay.o redisplay-output.o regex.o\
- search.o $(sheap_obj) signal.o sound.o\
+ search.o select.o $(sheap_objs) signal.o sound.o\
  specifier.o strftime.o symbols.o syntax.o sysdep.o\
- undo.o $(x_objs) widget.o window.o
+ undo.o $(x_objs) widget.o window.o $(win32_objs)
 
 obj_rtl = $(objs:.o=.c.rtl)
 
@@ -230,37 +251,37 @@ external_widget_objs = ExternalShell.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
 #   define EXTW_LINK(objs, output) $(CC) -shared objs -Xlinker -z -Xlinker text -o output
 extw_link_beg = $(CC) -shared
 extw_link_mid = -Xlinker -z -Xlinker text -o
-extw_link_end = 
+extw_link_end =
 ## I cannot figure out how to do shared a.out libraries, so just punt.
 #  elif !defined (LINUX) || defined (__ELF__)
 #   define EXTW_LINK(objs, output) $(CC) -shared objs -o output
 extw_link_beg = $(CC) -shared
 extw_link_mid = -o
-extw_link_end = 
+extw_link_end =
 #  endif
 # elif defined (USG5)
 #  if defined (IRIX)
 #   define EXTW_LINK(objs, output) $(LD) -shared -g -check_registry ${TOOLROOT}/usr/lib/so_locations objs -o output
-extw_link_beg = $(LD) -shared -g -check_registry ${TOOLROOT}/usr/lib/so_locations 
-extw_link_mid =  -o 
-extw_link_end = 
+extw_link_beg = $(LD) -shared -g -check_registry ${TOOLROOT}/usr/lib/so_locations
+extw_link_mid =  -o
+extw_link_end =
 #  else /* not IRIX */
 #   define EXTW_LINK(objs, output) $(CC) -G objs -z text -o output
 extw_link_beg = $(CC) -G
 extw_link_mid = -z text -o
-extw_link_end = 
+extw_link_end =
 #  endif /* not IRIX */
 # else /* not USG5 */
 #  if defined (DEC_ALPHA) && defined (OSF1)
 #   define EXTW_LINK(objs, output) $(LD) $(ldflags) $(ld_switch_shared) -d objs -o output $(LIBES)
-extw_link_beg = $(LD) $(ldflags) $(ld_switch_shared) -d 
-extw_link_mid = -o 
+extw_link_beg = $(LD) $(ldflags) $(ld_switch_shared) -d
+extw_link_mid = -o
 extw_link_end = $(LIBES)
 #  else /* !(DEC_ALPHA && OSF1) */
 #   define EXTW_LINK(objs, output) $(LD) -dc objs -assert pure-text -o output
 extw_link_beg = $(LD) -dc
 extw_link_mid = -assert pure-text -o
-extw_link_end = 
+extw_link_end =
 #  endif /* !(DEC_ALPHA && OSF1) */
 # endif /* not USG5 */
 
@@ -292,67 +313,61 @@ X11_objs =  EmacsFrame.o EmacsShell.o TopLevelEmacsShell.o TransientEmacsShell.o
 
 ## define otherobjs as list of object files that make-docfile
 ## should not be told about.
-otherobjs = $(BTL_objs) lastfile.o $(mallocobjs) $(rallocobjs) $(X11_objs)
+otherobjs = lastfile.o $(mallocobjs) $(rallocobjs) $(X11_objs)
 otherrtls = $(otherobjs:.o=.c.rtl)
 othersrcs = $(otherobjs:.o=.c)
 
-LIBES = $(lwlib_libs) $(quantify_libs) $(malloclib) $(ld_libs_all) $(lib_gcc)
+LIBES = $(lwlib_libs) $(malloclib) $(ld_libs_all) $(lib_gcc)
 
 #ifdef I18N3
 mo_dir = ${etcdir}
 mo_file = ${mo_dir}emacs.mo
 #endif
 
-LOADPATH =  EMACSBOOTSTRAPLOADPATH="${lispdir}:${blddir}"
-DUMPENV = $(LOADPATH)
+temacs_loadup = ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/loadup.el
+dump_temacs   = ${temacs_loadup} dump
+run_temacs    = ${temacs_loadup} run-temacs
+debug_temacs = gdb ${EXE_TARGET}
 
-release: temacs ${libsrc}DOC $(mo_file) ${other_files}
+release: ${EXE_TARGET} ${libsrc}DOC $(mo_file) ${other_files}
 #ifdef CANNOT_DUMP
-       ln temacs ${PROGNAME}
+       ln ${EXE_TARGET} ${PROGNAME}
 #else
-#ifdef HAVE_SHM
-       -if [ -w ${srcdir}/../lisp ]; then \
-         w=`pwd`; cd ${srcdir} && $${w}/temacs -nl -batch -l ${srcdir}/../lisp/inc-vers; \
-       else true; fi
-       @touch SATISFIED
-       -$(DUMPENV) ./temacs -nl -batch -l ${srcdir}/../lisp/loadup.el dump
-       @if test ! -f SATISFIED; then $(RECURSIVE_MAKE) $@; fi
-       @$(RM) SATISFIED
-#else /* ! defined (HAVE_SHM) */
        -if [ -w ${srcdir}/../lisp ]; then \
-         w=`pwd`; cd ${srcdir} && $${w}/temacs -batch -l ${srcdir}/../lisp/inc-vers; \
+         w=`pwd`; cd ${srcdir} && $${w}/${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/inc-vers; \
        else true; fi
-       @touch SATISFIED
-       -$(DUMPENV) ./temacs -batch -l ${srcdir}/../lisp/loadup.el dump
-       @if test ! -f SATISFIED; then $(RECURSIVE_MAKE) $@; fi
-       @$(RM) SATISFIED
-#endif /* ! defined (HAVE_SHM) */
+       -./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/loadup.el dump
        touch release
 #endif /* ! defined (CANNOT_DUMP) */
 
-${PROGNAME}: temacs ${libsrc}DOC $(mo_file) ${other_files} update-elc.stamp
+${DUMP_TARGET}: ${EXE_TARGET} ${libsrc}DOC $(mo_file) ${other_files} update-elc.stamp
+#ifdef HEAP_IN_DATA
        @$(RM) $@ && touch SATISFIED
-       -$(DUMPENV) ./temacs -batch -l ${srcdir}/../lisp/loadup.el dump
+       -${dump_temacs}
        @if test -f $@;        then if test -f SATISFIED; then \
                echo "Testing for Lisp shadows ..."; \
                ./${PROGNAME} -batch -vanilla -f list-load-path-shadows; fi; \
                $(RM) SATISFIED; exit 0; fi; \
        if test -f SATISFIED; then $(RM) SATISFIED; exit 1; fi; \
+       $(RM) $@; \
        $(RECURSIVE_MAKE) $@;
+#else
+       @$(RM) $@
+       ${dump_temacs}
+       @echo "Testing for Lisp shadows ..."
+       @./${PROGNAME} -batch -vanilla -f list-load-path-shadows
+#endif
 
-fastdump: temacs 
-       @$(RM) ${PROGNAME} && touch SATISFIED
-       -$(DUMPENV) ./temacs -batch -l ${srcdir}/../lisp/loadup.el dump
-       @if test -f ${PROGNAME};        then if test -f SATISFIED; then \
-               ./${PROGNAME} -batch -vanilla -f list-load-path-shadows; fi; \
-               $(RM) SATISFIED; exit 0; fi; \
-       if test -f SATISFIED; then $(RM) SATISFIED; exit 1; fi;
+fastdump: ${EXE_TARGET}
+       @$(RM) ${DUMP_TARGET} && touch SATISFIED
+       -${dump_temacs}
+       @./${PROGNAME} -batch -vanilla -f list-load-path-shadows
 
 FRC.update-elc.stamp :
 
-update-elc.stamp : temacs FRC.update-elc.stamp
+update-elc.stamp : ${EXE_TARGET} FRC.update-elc.stamp
        @touch NOBYTECOMPILE
-       ${DUMPENV} ./temacs -batch -l ${srcdir}/../lisp/update-elc.el
+       ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/update-elc.el
        @if test ! -f $@ -o -f NOBYTECOMPILE; then touch $@; fi; \
         $(RM) NOBYTECOMPILE
 
@@ -371,16 +386,16 @@ dynodump_deps = ../dynodump/dynodump.so
        cd ../dynodump && $(RECURSIVE_MAKE)
 #endif /* DYNODUMP */
 
-${libsrc}DOC: temacs update-elc.stamp
+${libsrc}DOC: ${EXE_TARGET} update-elc.stamp
        $(RM) ${libsrc}DOC; \
-       ${DUMPENV} ./temacs -batch -l ${srcdir}/../lisp/make-docfile.el -- \
+       ${DUMPENV} ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/make-docfile.el -- \
                -o ${libsrc}DOC -d ${srcdir} -i ${libsrc}../site-packages \
                ${obj_src} ${mallocdocsrc} ${rallocdocsrc}
 
 dump_elcs: dump-elcs
 
-dump-elcs: temacs
-       -${DUMPENV} ./temacs -batch -l ${srcdir}/../lisp/update-elc.el
+dump-elcs: ${EXE_TARGET}
+       -${DUMPENV} ./${EXE_TARGET} -nd -batch -l ${srcdir}/../lisp/update-elc.el
 
 all-elc all-elcs:
        cd .. && $(RECURSIVE_MAKE) all-elc
@@ -414,6 +429,9 @@ ${libsrc}make-po:
 
 #endif /* I18N3 */
 
+${libsrc}make-dump-id:
+       cd ${libsrc} && $(RECURSIVE_MAKE) make-dump-id
+
 ${libsrc}make-docfile:
        cd ${libsrc} && $(RECURSIVE_MAKE) make-docfile
 
@@ -427,43 +445,53 @@ lint: $(LINTFILES)
        $(LINT.c) $(LINTFILES)
 ## end of Lint Section
 
-temacs_deps=\
+link_deps=\
  $(start_files) ${objs} ${otherobjs}\
  $(lwlib_deps) $(dynodump_deps)
 
+temacs_deps = $(link_deps) ${DUMP_ID}
+
 temacs_link_args=\
  ${start_flags} ${ldflags}\
- -o $@ ${start_files} ${objs} ${otherobjs} ${LIBES}
+ -o $@ ${start_files} ${objs} ${otherobjs} ${DUMP_ID} ${LIBES}
 
-temacs: $(temacs_deps)
+${EXE_TARGET}: $(temacs_deps)
        $(LD) $(temacs_link_args)
 
+dump-id.c: ${libsrc}make-dump-id ${link_deps}
+       ${libsrc}make-dump-id
+
 .PHONY : run-temacs
 
-run-temacs: temacs
-       -$(DUMPENV) ./temacs -batch -l ${srcdir}/../lisp/loadup.el run-temacs
+run-temacs: ${EXE_TARGET}
+       -${run_temacs}
+
+## We have automated tests!!
+testdir = ${srcdir}/../tests/automated
+batch_test_emacs = -batch -l ${testdir}/test-harness.el -f batch-test-emacs ${testdir}
+
+.PHONY: check check-temacs
+check:
+       ./${PROGNAME} ${batch_test_emacs}
+check-temacs:
+       ${run_temacs} ${batch_test_emacs}
 
 ## Debugging targets:
 ##
-## RTC is Sun WorkShop's Run Time Checking
-##
-## Purify, Quantify, PureCoverage are software quality products from
-## Rational, formerly Pure Atria, formerly Pure Software.
-##
-## None of these products work with a dumped xemacs binary, because it
-## does unexpected things like free memory that has been malloc'ed in
-## a *different* process!!  So we need to run these on temacs.
-##
-
-.PHONY : run-rtcmacs run-puremacs run-quantmacs
+## None of the debugging products work with a dumped xemacs binary,
+## because it does unexpected things like free memory that has been
+## malloc'ed in a *different* process!!  So we need to run these on
+## temacs.
 
+## RTC is Sun WorkShop's Run Time Checking, integrated with dbx
 rtc_patch.o:
        rtc_patch_area -o $@
 
 rtcmacs: $(temacs_deps) rtc_patch.o
-       $(RM) temacs; $(RECURSIVE_MAKE) temacs RTC_patch_objs=rtc_patch.o
-       mv temacs rtcmacs
+       $(RM) ${EXE_TARGET}; $(RECURSIVE_MAKE) ${EXE_TARGET} RTC_patch_objs=rtc_patch.o
+       mv ${EXE_TARGET} rtcmacs
 
+.PHONY: run-rtcmacs
 run-rtcmacs: rtcmacs
        dbx -q -C -c \
        'dbxenv rtc_error_log_file_name /dev/fd/1; \
@@ -474,27 +502,40 @@ run-rtcmacs: rtcmacs
        runargs -batch -l ${srcdir}/../lisp/loadup.el run-temacs -q; \
        run' rtcmacs
 
+debug-temacs: ${EXE_TARGET}
+       -${debug_temacs}
+
+## Purify, Quantify, PureCoverage are software quality products from
+## Rational, formerly Pure Atria, formerly Pure Software.
+##
 ## Purify
-PURIFY_PROG=purify
-PURIFY_FLAGS=-chain-length=32 -ignore-signals=SIGPOLL -threads=yes \
- -cache-dir=./purecache -always-use-cache-dir=yes -pointer-mask=0x0fffffff
-puremacs: $(temacs_deps)
-       $(PURIFY_PROG) $(PURIFY_FLAGS) $(LD) $(temacs_link_args) -lpthread
+PURIFY_PROG  = purify
+PURIFY_LIBS  =
+PURIFY_FLAGS =\
+#ifdef PDUMP
+ -search-mmaps=yes\
+#endif
+ -chain-length=32 -ignore-signals=SIGPOLL\
+ -cache-dir=${blddir}/purecache -always-use-cache-dir=yes
 
-run-puremacs: puremacs
-       -$(DUMPENV) ./puremacs -batch -l ${srcdir}/../lisp/loadup.el run-temacs
+puremacs: $(temacs_deps)
+       $(PURIFY_PROG) $(PURIFY_FLAGS) $(LD) $(temacs_link_args) $(PURIFY_LIBS)
+       cp $@ ${EXE_TARGET}
 
 ## Quantify
 #ifdef  QUANTIFY
-quantify_prog  = quantify
-quantify_flags = -windows=no -record-data=no
-quantify_includes = -I/local/include
-quantify_libs = /local/lib/quantify_stubs.a
+QUANTIFY_PROG     = quantify
+QUANTIFY_HOME     = `$(QUANTIFY_PROG) -print-home-dir`
+QUANTIFY_FLAGS    = -cache-dir=./purecache -always-use-cache-dir=yes
+cppflags         += -I$(QUANTIFY_HOME)
+temacs_link_args += $(QUANTIFY_HOME)/quantify_stubs.a
 
 quantmacs: $(temacs_deps)
-       $(quantify_prog) $(quantify_flags) $(LD) $(temacs_link_args)
+       $(QUANTIFY_PROG) $(QUANTIFY_FLAGS) $(LD) $(temacs_link_args)
+       cp $@ ${EXE_TARGET}
 #endif /* QUANTIFY */
 
+
 PURECOV_PROG=purecov
 covmacs: $(temacs_deps)
        $(PURECOV_PROG) $(LD) $(temacs_link_args)
@@ -516,6 +557,10 @@ TransientEmacsShell.c.rtl : ${srcdir}/EmacsShell-sub.c TopLevelEmacsShell.o conf
        $(CC) -dr -c $(cflags) -DDEFINE_TRANSIENT_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
        mv EmacsShell-sub.c.rtl TransientEmacsShell.c.rtl
 
+## The above rules are subject to a race condition if using a parallel make.
+TransientEmacsShell.o : TopLevelEmacsShell.o
+TransientEmacsShell.c.rtl : TopLevelEmacsShell.c.rtl
+
 ## Position-independent code for shared library creation
 #if USE_GCC
 pic_arg = -fpic
@@ -604,10 +649,9 @@ libextcli_Xlib.so.1: ${external_client_xlib_objs_shared}
 #endif /* EXTERNAL_WIDGET */
 
 config.h: ${srcdir}/config.h.in
-puresize-adjust.h: ${srcdir}/puresize.h
 Emacs.ad.h: ${srcdir}/${etcdir}Emacs.ad
 
-config.h puresize-adjust.h sheap-adjust.h paths.h Emacs.ad.h :
+config.h sheap-adjust.h paths.h Emacs.ad.h :
        @echo "The file $@ needs to be re-generated."
        @echo "Please run a make in the top level directory."
        @echo "Consult the file \`INSTALL' for instructions for building XEmacs."
@@ -648,41 +692,35 @@ alloca.o : ${srcdir}/alloca.s config.h
 #endif /* HAVE_ALLOCA */
 #endif /* ! defined (C_ALLOCA) */
 
-#ifdef EMACS_BTL
-BTL_includes = -I$(BTL_dir)
-BTL_compile = -DEMACS_BTL -D`lucid-arch` -I. $(BTL_includes) $(BTL_dir)/$(@:.o=.c)
-
-cadillac-btl.o cadillac-btl-process.o cadillac-btl-emacs.o:
-       $(CC) $(CFLAGS) -c $(BTL_compile)
-cadillac-btl-asm.o:
-       $(CC) $(CFLAGS) -c $(BTL_compile)
-#endif /* EMACS_BTL */
-
 #ifdef HAVE_NATIVE_SOUND
+sound_cflags=@sound_cflags@
 sunplay.o: ${srcdir}/sunplay.c
        $(CC) -c  $(sound_cflags) $(cflags) ${srcdir}/sunplay.c
 hpplay.o: ${srcdir}/hpplay.c
        $(CC) -c -Demacs $(sound_cflags) $(cflags) ${srcdir}/hpplay.c
 #endif /* HAVE_NATIVE_SOUND */
 
+xemacs_res.o: ${srcdir}/../nt/xemacs.rc
+       windres --include-dir ${srcdir}/../nt -i ${srcdir}/../nt/xemacs.rc -o $@
+
 ## System-specific programs to be made.
 ## ${other_files}, $(objects_system) and $(objects_machine)
 ## select which of these should be compiled.  */
 
 .PHONY: mostlyclean clean distclean realclean versionclean extraclean
 mostlyclean:
-       $(RM) temacs puremacs quantmacs prefix-args *.o *.i  \
-         core temacs.exe puresize-adjust.h sheap-adjust.h
+       $(RM) temacs puremacs quantmacs *.o *.i  \
+         core temacs.exe sheap-adjust.h
 clean: mostlyclean versionclean
        $(RM) libextcli* update-elc.stamp
 ## This is used in making a distribution.
 ## Do not use it on development directories!
 distclean: clean
        $(RM) config.h paths.h Emacs.ad.h \
-         Makefile Makefile.in TAGS ${PROGNAME}.*
+         GNUmakefile Makefile Makefile.in TAGS ${PROGNAME}.*
 realclean: distclean
 versionclean:
-       $(RM) ${PROGNAME} ${PROGNAME}.exe ${libsrc}DOC
+       $(RM) ${EXE_TARGET} ${DUMP_TARGET} ${libsrc}DOC
 extraclean: realclean
        $(RM) *~ \#* m/*~ m/\#* s/*~ s/\#*
 
@@ -695,8 +733,40 @@ unlock:
 relock:
        chmod -w $(SOURCES)
 
+## Header files for ellcc
+#ifdef HAVE_SHLIB
+MAKEPATH=../lib-src/make-path
+install: ${PROGNAME}
+       ${MAKEPATH} ${archlibdir}/include ${archlibdir}/include/m ${archlibdir}/include/s
+       -@echo "Copying include files for ellcc..."
+       -@hdir=`pwd`; \
+       cd ${srcdir}; hdrdir2=`pwd`; cd $$hdir; \
+       test "$$hdrdir2" != "$$hdir" && hdir="$$hdir $$hdrdir2"; \
+       (for thisdir in $$hdir; do \
+               cd $$thisdir && \
+               (hdrtars=; \
+               for hdrfile in *.h; do \
+                       hdrtars="$$hdrtars $$hdrfile"; \
+               done; \
+               test -d s && hdrtars="$$hdrtars s/*"; \
+               test -d m && hdrtars="$$hdrtars m/*"; \
+               test -n "$$hdrtars" && (tar cf - $$hdrtars) | \
+                       (cd ${archlibdir}/include && umask 022 && tar xf -); \
+               chmod 755 ${archlibdir}/include; \
+               test -d ${archlibdir}/include/s && \
+                 chmod 755 ${archlibdir}/include/s; \
+               test -d ${archlibdir}/include/m && \
+                 chmod 755 ${archlibdir}/include/s;) \
+       done)
+#endif
+
 ## Dependency processing using home-grown script, not makedepend
+.PHONY: depend
+FRC.depend:
 depend: FRC.depend
-       $(RM) ${srcdir}/depend depend.tmp
-       perl ${srcdir}/make-src-depend > depend.tmp
-       mv depend.tmp ${srcdir}/depend
+       cd ${srcdir} && $(RM) depend.tmp && \
+       perl ./make-src-depend > depend.tmp && \
+       if cmp -s depend depend.tmp; \
+       then $(RM) depend.tmp; \
+       else $(RM) depend && mv depend.tmp depend; \
+       fi