diff src/Makefile.in.in @ 1315:70921960b980

[xemacs-hg @ 2003-02-20 08:19:28 by ben] check in makefile fixes et al Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory into src/. Simplify the dependencies -- everything in src/ is dependent on the single entry `src' in MAKE_SUBDIRS. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. mule/mule-msw-init.el: Removed. Delete this file. mule/mule-win32-init.el: New file, with stuff from mule-msw-init.el -- not just for MS Windows native, boys and girls! bytecomp.el: Change code inserted to catch trying to load a Mule-only .elc file in a non-Mule XEmacs. Formerly you got the rather cryptic "The required feature `mule' cannot be provided". Now you get "Loading this file requires Mule support". finder.el: Remove dependency on which directory this function is invoked from. update-elc.el: Don't mess around with ../src/BYTECOMPILE_CHANGE. Now that Makefile.in.in and xemacs.mak are in sync, both of them use NEEDTODUMP and the other one isn't used. dumped-lisp.el: Rewrite in terms of `list' and `nconc' instead of assemble-list, so we can have arbitrary forms, not just `when-feature'. very-early-lisp.el: Nuke this file. finder-inf.el, packages.el, update-elc.el, update-elc-2.el, loadup.el, make-docfile.el: Eliminate references to very-early-lisp. msw-glyphs.el: Comment clarification. xemacs.mak: Add macros DO_TEMACS, DO_XEMACS, and a few others; this macro section is now completely in sync with src/Makefile.in.in. Copy check-features, load-shadows, and rebuilding finder-inf.el from src/Makefile.in.in. The main build/dump/recompile process is now synchronized with src/Makefile.in.in. Change `WARNING' to `NOTE' and `error checking' to `error-checking' TO avoid tripping faux warnings and errors in the VC++ IDE. Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory from top-level Makefile.in.in to here. Simplify the dependencies. Rearrange into logical subsections. Synchronize the main compile/dump/build-elcs section with xemacs.mak, which is already clean and in good working order. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. Add additional levels of macros \(e.g. DO_TEMACS, DO_XEMACS, TEMACS_BATCH, XEMACS_BATCH, XEMACS_BATCH_PACKAGES) to factor out duplicated stuff. Clean up handling of "HEAP_IN_DATA" (Cygwin) so it doesn't need to ignore the return value from dumping. Add .NO_PARALLEL since various aspects of building and dumping must be serialized but do not always have dependencies between them (this is impossible in some cases). Everything related to src/ now gets built in one pass in this directory by just running `make' (except the Makefiles themselves and config.h, paths.h, Emacs.ad.h, and other generated .h files). console.c: Update list of possibly valid console types. emacs.c: Rationalize the specifying and handling of the type of the first frame. This was originally prompted by a workspace in which I got GTK to compile under C++ and in the process fixed it so it could coexist with X in the same build -- hence, a combined TTY/X/MS-Windows/GTK build is now possible under Cygwin. (However, you can't simultaneously *display* more than one kind of device connection -- but getting that to work is not that difficult. Perhaps a project for a bored grad student. I (ben) would do it but don't see the use.) To make sense of this, I added new switches that can be used to specifically indicate the window system: -x [aka --use-x], -tty \[aka --use-tty], -msw [aka --use-ms-windows], -gtk [aka --use-gtk], and -gnome [aka --use-gnome, same as --use-gtk]. -nw continues as an alias for -tty. When none have been given, XEmacs checks for other parameters implying particular device types (-t -> tty, -display -> x [or should it have same treatment as DISPLAY below?]), and has ad-hoc logic afterwards: if env var DISPLAY is set, use x (or gtk? perhaps should check whether gnome is running), else MS Windows if it exsits, else TTY if it exists, else stream, and you must be running in batch mode. This also fixes an existing bug whereby compiling with no x, no mswin, no tty, when running non- interactively (e.g. to dump) I get "sorry, must have TTY support". emacs.c: Turn on Vstack_trace_on_error so that errors are debuggable even when occurring extremely early in reinitialization. emacs.c: Try to make sure that the user can see message output under Windows (i.e. it doesn't just disappear right away) regardless of when it occurs, e.g. in the middle of creating the first frame. emacs.c: Define new function `emacs-run-status', indicating whether XEmacs is noninteractive or interactive, whether raw, post-dump/pdump-load or run-temacs, whether we are dumping, whether pdump is in effect. event-stream.c: It's "mommas are fat", not "momas are fat". Fix other typo. event-stream.c: Conditionalize in_menu_callback check on HAVE_MENUBARS, because it won't exist on w/o menubar support, lisp.h: More hackery on RETURN_NOT_REACHED. Cygwin v3.2 DOES complain here if RETURN_NOT_REACHED() is blank, as it is for GCC 2.5+. So make it blank only for GCC 2.5 through 2.999999999999999. Declare Vstack_trace_on_error. profile.c: Need to include "profile.h" to fix warnings. sheap.c: Don't fatal() when need to rerun Make, just stderr_out() and exit(0). That way we can distinguish between a dumping failing expectedly (due to lack of stack space, triggering another dump) and unexpectedly, in which case, we want to stop building. (or go on, if -K is given) syntax.c, syntax.h: Use ints where they belong, and enum syntaxcode's where they belong, and fix warnings thereby. syntax.h: Fix crash caused by an edge condition in the syntax-cache macros. text.h: Spacing fixes. xmotif.h: New file, to get around shadowing warnings. EmacsManager.c, event-Xt.c, glyphs-x.c, gui-x.c, input-method-motif.c, xmmanagerp.h, xmprimitivep.h: Include xmotif.h. alloc.c: Conditionalize in_malloc on ERROR_CHECK_MALLOC. config.h.in, file-coding.h, fileio.c, getloadavg.c, select-x.c, signal.c, sysdep.c, sysfile.h, systime.h, text.c, unicode.c: Eliminate HAVE_WIN32_CODING_SYSTEMS, use WIN32_ANY instead. Replace defined (WIN32_NATIVE) || defined (CYGWIN) with WIN32_ANY. lisp.h: More futile attempts to walk and chew gum at the same time when dealing with subr's that don't return.
author ben
date Thu, 20 Feb 2003 08:19:44 +0000
parents f99d3d25df86
children 70841e88fbee
line wrap: on
line diff
--- a/src/Makefile.in.in	Thu Feb 20 08:16:21 2003 +0000
+++ b/src/Makefile.in.in	Thu Feb 20 08:19:44 2003 +0000
@@ -3,7 +3,7 @@
 ##   Copyright (C) 1994, 1995 Board of Trustees, University of Illinois
 ##   Copyright (C) 1996, 1997 Sun Microsystems, Inc.
 ##   Copyright (C) 1998, 1999 J. Kean Johnston.
-##   Copyright (C) 2001, 2002 Ben Wing.
+##   Copyright (C) 2001, 2002, 2003 Ben Wing.
 
 ## This file is part of XEmacs.
 
@@ -24,6 +24,9 @@
 
 ## Synched up with: Not synched with FSF.
 
+.PHONY: all
+all: build-the-mofo
+
 PROGNAME=@PROGNAME@
 
 #define NOT_C_CODE
@@ -38,9 +41,6 @@
 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
@@ -133,15 +133,15 @@
 
 #########################################################################
 
-## Object files needed for compilation.
+## Object files needed for compilation, and other rebuilt files.
 
-## NOTE: Some of the object files are specified in this file, and
-## others in configure.in.  The general rule is that they be specified
-## here whenever they have clear dependencies on configure defines.
-## They should be in configure.in when there is no configure define or
-## when there is extremely hairy code to determine which files are
-## needed (e.g. native sound support) and it would be pointless to
-## duplicate that code.
+## NOTE: Some of the object files are specified in this file, and others in
+## configure.in.  The general rule is that they be specified here whenever
+## possible -- in practice, that means that they have clear dependencies on
+## configure defines.  They should be in configure.in when there is no
+## configure define or when there is extremely hairy code to determine
+## which files are needed (e.g. native sound support) and it would be
+## pointless to duplicate that code.
 
 gui_objs= gui.o
 #ifdef HAVE_MENUBARS
@@ -377,49 +377,6 @@
 # ifdef EXTERNAL_WIDGET
 external_widget_objs = ExternalShell.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
 
-## Now we try to figure out how to link a shared library.
-## If we cannot figure it out, leave EXTW_LINK undefined and a shared
-## library will not be created.
-
-# ifdef USE_GCC
-#  ifdef USG5
-#   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 =
-## 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 =
-#  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 =
-#  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 =
-#  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_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 =
-#  endif /* !(DEC_ALPHA && OSF1) */
-# endif /* not USG5 */
-
 #  ifdef LWLIB_USES_MOTIF
 #    ifdef EXTW_LINK
 motif_other_files = libextcli_Xm.a libextcli_Xm.so.1
@@ -436,7 +393,6 @@
  libextcli_Xt.a libextcli_Xlib.a\
  ${shared_other_files}
 
-all: ${other_files}
 # endif /* EXTERNAL_WIDGET */
 
 # if defined (HAVE_OFFIX_DND) || defined (HAVE_CDE)
@@ -459,88 +415,139 @@
 mo_file = ${mo_dir}emacs.mo
 #endif
 
-batch = -no-packages -batch
-batch_packages = -vanilla -batch
-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}
+#########################################################################
+
+## Primary rebuilding process
+
+DO_TEMACS = ${DUMPENV} ./${EXE_TARGET}
+DO_XEMACS = ./${PROGNAME}
+LISP = ${srcdir}/../lisp
+
+BATCH = -no-packages -batch
+BATCH_PACKAGES = -vanilla -batch
+TEMACS_BATCH = $(DO_TEMACS) -nd $(BATCH)
+XEMACS_BATCH = $(DO_XEMACS) $(BATCH)
+XEMACS_BATCH_PACKAGES = $(DO_XEMACS) $(BATCH_PACKAGES)
+temacs_loadup_args = -l $(LISP)/loadup.el
+dump_temacs_args   = $(temacs_loadup_args) dump
+run_temacs_args = $(temacs_loadup_args) run-temacs
+dump_temacs = $(TEMACS_BATCH) $(dump_temacs_args)
+
+debug_temacs = gdb $(EXE_TARGET)
+
+.PHONY : build-the-mofo release update-elc update-elc-2 load-shadows
+
+## Compile, dump, and make sure all .elc files are up-to-date.
+
+## NOTE: The dependencies would (should) look like the following
+## commented-out statement in linear order, but apparently this causes
+## problems with some versions of `make' because there is insufficient
+## serialization of the build steps.  Evidently the .NO_PARALLEL directive
+## doesn't help.  `make' really seems to be designed to have all
+## dependencies proceed upward, not across, and to be all calculable before
+## actually running anything.  The problem here is that update-elc may
+## touch NEEDTODUMP and thus create an additional dependency
+## -- but *NOT UNTIL* that step is run.  There is no way I can come up with
+## to express such a dependency in upward fashion.
 
-release: ${EXE_TARGET} ${libsrc}DOC $(mo_file) ${other_files}
-#ifdef CANNOT_DUMP
-	ln ${EXE_TARGET} ${PROGNAME}
-#else
-	-if [ -w ${srcdir}/../lisp ]; then \
-	  w=`pwd`; cd ${srcdir} && $${w}/${EXE_TARGET} -nd ${batch} -l ${srcdir}/../lisp/inc-vers; \
+## build-the-mofo: ${EXE_TARGET} update-elc ${libsrc}DOC $(mo_file) ${other_files} ${DUMP_TARGET} update-elc-2 $(LISP)/finder-inf.el load-shadows
+
+build-the-mofo: ${EXE_TARGET} update-elc ${libsrc}DOC $(mo_file) ${other_files} ${DUMP_TARGET} load-shadows
+.NO_PARALLEL: ${EXE_TARGET} update-elc ${libsrc}DOC ${DUMP_TARGET} update-elc-2
+
+release: all
+	-if [ -w $(LISP) ]; then \
+	  w=`pwd`; cd ${srcdir} && $${w}/${EXE_TARGET} -nd ${BATCH} -l $(LISP)/inc-vers; \
 	else true; fi
-	-./${EXE_TARGET} -nd ${batch} -l ${srcdir}/../lisp/loadup.el dump
+	-${dump_temacs}
 	touch release
-#endif /* ! defined (CANNOT_DUMP) */
+
+update-elc: $(EXE_TARGET)
+	$(TEMACS_BATCH) -l $(LISP)/update-elc.el
+
+## Update out-of-date .elcs, other than needed for dumping.
+update-elc-2: $(EXE_TARGET) $(DUMP_TARGET)
+	$(XEMACS_BATCH) -no-autoloads -l update-elc-2.el -f batch-update-elc-2 $(LISP)
 
-${DUMP_TARGET}: ${EXE_TARGET} ${libsrc}DOC $(mo_file) ${other_files} update-elc.stamp
+$(LISP)/finder-inf.el: update-elc-2 $(EXE_TARGET) $(DUMP_TARGET)
+	@echo "Building finder database ..."
+	$(XEMACS_BATCH) -eval '(setq finder-compile-keywords-quiet t)' \
+		-l finder -f finder-compile-keywords
+	@echo "Building finder database ...(done)"
+
+load-shadows: $(LISP)/finder-inf.el $(EXE_TARGET) $(DUMP_TARGET)
+#ifndef QUICK_BUILD
+	@echo "Testing for Lisp shadows ..."
+	@$(XEMACS_BATCH) -f list-load-path-shadows
+#endif
+
+## This file is touched by update-elc.el when redumping is necessary.
+NEEDTODUMP:
+	touch NEEDTODUMP
+
+${DUMP_TARGET}: ${EXE_TARGET} NEEDTODUMP
 #ifdef HEAP_IN_DATA
 	@$(RM) $@ && touch SATISFIED
-	-${dump_temacs}
-	@if test -f $@;        then if test -f SATISFIED; then \
-		echo "Testing for Lisp shadows ..."; \
-		./${PROGNAME} ${batch} -f list-load-path-shadows; fi; \
-		$(RM) SATISFIED; exit 0; fi; \
-	if test -f SATISFIED; then $(RM) SATISFIED; exit 1; fi; \
-	$(RM) $@; \
-	$(RECURSIVE_MAKE) $@;
+	${dump_temacs}
+	@if test -f SATISFIED; then $(RM) SATISFIED; else $(RM) $@; \
+	$(RECURSIVE_MAKE) $@; fi
 #else
 	@$(RM) $@
 	${dump_temacs}
-	@echo "Testing for Lisp shadows ..."
-	@./${PROGNAME} ${batch} -f list-load-path-shadows
 #endif
 
-fastdump: ${EXE_TARGET}
-	@$(RM) ${DUMP_TARGET} && touch SATISFIED
-	-${dump_temacs}
-	@./${PROGNAME} ${batch} -f list-load-path-shadows
-
-FRC.update-elc.stamp :
-
-update-elc.stamp : ${EXE_TARGET} FRC.update-elc.stamp
-	@touch BYTECOMPILE_CHANGE
-	./${EXE_TARGET} -nd ${batch} -l ${srcdir}/../lisp/update-elc.el
-	@if test ! -f $@ -o -f BYTECOMPILE_CHANGE; then touch $@; fi; \
-	 $(RM) BYTECOMPILE_CHANGE
-
-obj_src = $(objs:.o=.c)
-
-dortl : $(obj_rtl) $(otherrtls)
-	echo "(defvar source-files '(" > ${srcdir}/../lisp/source-files.el
-	(for a in $(obj_src) $(othersrcs);do \
-	echo -n "\""$$a"\"" >> ${srcdir}/../lisp/source-files.el ;\
-	done)
-	echo "))" >> ${srcdir}/../lisp/source-files.el
-
 #ifdef DYNODUMP
 dynodump_deps = ../dynodump/dynodump.so
 ../dynodump/dynodump.so:
 	cd ../dynodump && $(RECURSIVE_MAKE)
 #endif /* DYNODUMP */
 
-${libsrc}DOC: ${EXE_TARGET} update-elc.stamp
+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} ${DUMP_ID} ${LIBES}
+
+${EXE_TARGET}: $(temacs_deps)
+	$(LD) $(temacs_link_args)
+
+dump-id.c: ${libsrc}make-dump-id ${link_deps}
+	${libsrc}make-dump-id
+
+obj_src = $(objs:.o=.c)
+
+${libsrc}DOC: ${libsrc}make-docfile NEEDTODUMP ${temacs_deps}
 #ifdef QUICK_BUILD
 	if test ! -f $@ ; then \
 #else
 	if true ; then \
 #endif
-	${DUMPENV} ./${EXE_TARGET} -nd ${batch} -l ${srcdir}/../lisp/make-docfile.el -- \
+	$(TEMACS_BATCH) -l $(LISP)/make-docfile.el -- \
 		-o ${libsrc}DOC -d ${srcdir} -i ${libsrc}../site-packages \
 		${obj_src} ${mallocdocsrc} ${rallocdocsrc} \
 		${extra_doc_files} ; fi
 
-dump_elcs: dump-elcs
+${libsrc}make-dump-id:
+	cd ${libsrc} && $(RECURSIVE_MAKE) make-dump-id
+
+${libsrc}make-docfile:
+	cd ${libsrc} && $(RECURSIVE_MAKE) make-docfile
 
-dump-elcs: ${EXE_TARGET}
-	-${DUMPENV} ./${EXE_TARGET} -nd ${batch} -l ${srcdir}/../lisp/update-elc.el
+.PHONY: fastdump
+fastdump: ${EXE_TARGET}
+	@$(RM) ${DUMP_TARGET} && touch SATISFIED
+	-${dump_temacs}
+	@$(XEMACS_BATCH) -f list-load-path-shadows
 
-all-elc all-elcs:
-	cd .. && $(RECURSIVE_MAKE) all-elc
+.PHONY: all-elc
+all-elc:
+	cd .. && $(RECURSIVE_MAKE)
+
+#########################################################################
+
+## Subsidiary dependency rules
 
 #ifdef I18N3
 
@@ -571,118 +578,6 @@
 
 #endif /* I18N3 */
 
-${libsrc}make-dump-id:
-	cd ${libsrc} && $(RECURSIVE_MAKE) make-dump-id
-
-${libsrc}make-docfile:
-	cd ${libsrc} && $(RECURSIVE_MAKE) make-docfile
-
-## Lint Section
-LINT.c=$(LINT) $(LINTFLAGS) $(LINTINCLUDES)
-LINTFILES= $(objs:.o=.ln)
-LINTINCLUDES = $(cppflags)
-## LINTFLAGS= -fd -m -p -s -u -v -x
-LINTFLAGS= -fd -m -s -u -v -x
-lint: $(LINTFILES)
-	$(LINT.c) $(LINTFILES)
-## end of Lint Section
-
-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} ${DUMP_ID} ${LIBES}
-
-${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: ${EXE_TARGET}
-	-${run_temacs}
-
-## We have automated tests!!
-testdir = ${srcdir}/../tests/automated
-batch_test_emacs = ${batch_packages} -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:
-##
-## 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) ${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; \
-	dbxenv suppress_startup_message 5.0; \
-	ignore POLL; \
-	check -access; \
-	suppress rui; \
-	runargs ${batch} -l ${srcdir}/../lisp/loadup.el run-temacs -vanilla; \
-	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_LIBS  =
-PURIFY_FLAGS =\
-#ifdef PDUMP
- -search-mmaps=yes\
-#endif
- -chain-length=32 -ignore-signals=SIGPOLL\
- -cache-dir=${blddir}/purecache -always-use-cache-dir=yes
-
-puremacs: $(temacs_deps)
-	$(PURIFY_PROG) $(PURIFY_FLAGS) $(LD) $(temacs_link_args) $(PURIFY_LIBS)
-	cp $@ ${EXE_TARGET}
-
-## Quantify
-#ifdef  QUANTIFY
-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)
-	cp $@ ${EXE_TARGET}
-#endif /* QUANTIFY */
-
-
-PURECOV_PROG=purecov
-covmacs: $(temacs_deps)
-	$(PURECOV_PROG) $(LD) $(temacs_link_args)
-
-
 TopLevelEmacsShell.o : ${srcdir}/EmacsShell-sub.c config.h xintrinsicp.h EmacsShellP.h
 	$(CC) -c $(cflags) -DDEFINE_TOP_LEVEL_EMACS_SHELL ${srcdir}/EmacsShell-sub.c
 	mv EmacsShell-sub.o TopLevelEmacsShell.o
@@ -775,6 +670,49 @@
 libextcli_Xlib.a: ${external_client_xlib_objs_nonshared}
 	ar r libextcli_Xlib.a ${external_client_xlib_objs_nonshared}
 
+## Now we try to figure out how to link a shared library.
+## If we cannot figure it out, leave EXTW_LINK undefined and a shared
+## library will not be created.
+
+# ifdef USE_GCC
+#  ifdef USG5
+#   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 =
+## 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 =
+#  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 =
+#  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 =
+#  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_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 =
+#  endif /* !(DEC_ALPHA && OSF1) */
+# endif /* not USG5 */
+
 #ifdef EXTW_LINK
 
 libextcli_Xm.so.1: ${external_client_motif_objs_shared}
@@ -847,16 +785,109 @@
 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.  */
+#########################################################################
+
+## Other random crap
+
+dortl : $(obj_rtl) $(otherrtls)
+	echo "(defvar source-files '(" > $(LISP)/source-files.el
+	(for a in $(obj_src) $(othersrcs);do \
+	echo -n "\""$$a"\"" >> $(LISP)/source-files.el ;\
+	done)
+	echo "))" >> $(LISP)/source-files.el
+
+## Lint Section
+LINT.c=$(LINT) $(LINTFLAGS) $(LINTINCLUDES)
+LINTFILES= $(objs:.o=.ln)
+LINTINCLUDES = $(cppflags)
+## LINTFLAGS= -fd -m -p -s -u -v -x
+LINTFLAGS= -fd -m -s -u -v -x
+.PHONY: lint
+lint: $(LINTFILES)
+	$(LINT.c) $(LINTFILES)
+## end of Lint Section
+
+## We have automated tests!!
+testdir = ${srcdir}/../tests/automated
+batch_test_emacs = ${BATCH_PACKAGES} -l ${testdir}/test-harness.el -f batch-test-emacs ${testdir}
+
+.PHONY: check check-temacs check-features
+check:
+	$(DO_XEMACS) $(batch_test_emacs)
+check-temacs:
+	$(TEMACS_BATCH) $(run_temacs_args) $(batch_test_emacs)
+check-features: all
+	$(XEMACS_BATCH) -l check-features.el
+
+## Debugging targets:
+##
+## 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) ${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; \
+	dbxenv suppress_startup_message 5.0; \
+	ignore POLL; \
+	check -access; \
+	suppress rui; \
+	runargs -nd ${BATCH} ${run_temacs_args} -vanilla; \
+	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_LIBS  =
+PURIFY_FLAGS =\
+#ifdef PDUMP
+ -search-mmaps=yes\
+#endif
+ -chain-length=32 -ignore-signals=SIGPOLL\
+ -cache-dir=${blddir}/purecache -always-use-cache-dir=yes
+
+puremacs: $(temacs_deps)
+	$(PURIFY_PROG) $(PURIFY_FLAGS) $(LD) $(temacs_link_args) $(PURIFY_LIBS)
+	cp $@ ${EXE_TARGET}
+
+## Quantify
+#ifdef  QUANTIFY
+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)
+	cp $@ ${EXE_TARGET}
+#endif /* QUANTIFY */
+
+PURECOV_PROG=purecov
+covmacs: $(temacs_deps)
+	$(PURECOV_PROG) $(LD) $(temacs_link_args)
 
 .PHONY: mostlyclean clean distclean realclean versionclean extraclean
 mostlyclean:
 	$(RM) temacs puremacs quantmacs *.o *.i  \
 	  core temacs.exe sheap-adjust.h
 clean: mostlyclean versionclean
-	$(RM) libextcli* update-elc.stamp
+	$(RM) libextcli*
 ## This is used in making a distribution.
 ## Do not use it on development directories!
 distclean: clean