changeset 9794:0d4613a736e9

convert build system to use automake and libtool
author John W. Eaton <jwe@octave.org>
date Tue, 10 Nov 2009 15:02:25 -0500
parents 7161e9b41cf6
children 3ccd3a03944c
files AUTHORS ChangeLog Makeconf.in Makefile Makefile.am acinclude.m4 aclocal.m4 autogen.sh common.mk configure.ac doc/ChangeLog doc/Makefile.am doc/Makefile.in doc/faq/Makefile.am doc/faq/Makefile.in doc/faq/Octave-FAQ.texi doc/faq/OctaveFAQ.texi doc/interpreter/Makefile.am doc/interpreter/Makefile.in doc/interpreter/config-images.sh doc/interpreter/images doc/interpreter/images.awk doc/interpreter/munge-texi.cc doc/liboctave/Makefile.am doc/liboctave/Makefile.in doc/liboctave/liboctave.texi doc/refcard/Makefile.am doc/refcard/Makefile.in emacs/Makefile.in emacs/module.mk examples/@FIRfilter/Makefile.in examples/@FIRfilter/module.mk examples/@polynomial/Makefile.in examples/@polynomial/module.mk examples/Makefile.am examples/Makefile.in install-sh libcruft/ChangeLog libcruft/Makefile.am libcruft/Makefile.in libcruft/Makerules.in libcruft/amos/Makefile.in libcruft/amos/module.mk libcruft/blas-xtra/Makefile.in libcruft/blas-xtra/module.mk libcruft/blas/Makefile.in libcruft/blas/module.mk libcruft/daspk/Makefile.in libcruft/daspk/module.mk libcruft/dasrt/Makefile.in libcruft/dasrt/module.mk libcruft/dassl/Makefile.in libcruft/dassl/module.mk libcruft/fftpack/Makefile.in libcruft/fftpack/module.mk libcruft/lapack-xtra/Makefile.in libcruft/lapack-xtra/module.mk libcruft/lapack/Makefile.in libcruft/lapack/module.mk libcruft/misc/Makefile.in libcruft/misc/module.mk libcruft/odepack/Makefile.in libcruft/odepack/module.mk libcruft/ordered-qz/Makefile.in libcruft/ordered-qz/module.mk libcruft/quadpack/Makefile.in libcruft/quadpack/module.mk libcruft/ranlib/Makefile.in libcruft/ranlib/module.mk libcruft/slatec-err/Makefile.in libcruft/slatec-err/module.mk libcruft/slatec-fn/Makefile.in libcruft/slatec-fn/module.mk libcruft/villad/Makefile.in libcruft/villad/module.mk liboctave/ChangeLog liboctave/Makefile.am liboctave/Makefile.in liboctave/config-ops.sh liboctave/mx-ops liboctave/sparse-mx-ops liboctave/vx-ops m4/Makefile.in m4/module.mk mkoctfile.cc.in mkoctfile.in octMakefile.in run-octave.in scripts/ChangeLog scripts/Makefile.am scripts/Makefile.in scripts/audio/Makefile.in scripts/audio/module.mk scripts/configure.ac scripts/deprecated/Makefile.in scripts/deprecated/module.mk scripts/elfun/Makefile.in scripts/elfun/module.mk scripts/general/Makefile.in scripts/general/module.mk scripts/geometry/Makefile.in scripts/geometry/module.mk scripts/help/Makefile.in scripts/help/module.mk scripts/image/Makefile.in scripts/image/module.mk scripts/io/Makefile.in scripts/io/module.mk scripts/linear-algebra/Makefile.in scripts/linear-algebra/module.mk scripts/miscellaneous/Makefile.in scripts/miscellaneous/module.mk scripts/mk-pkg-add scripts/mkdoc scripts/mkpkgadd scripts/move-if-change scripts/optimization/Makefile.in scripts/optimization/module.mk scripts/path/Makefile.in scripts/path/module.mk scripts/pkg/Makefile.in scripts/pkg/module.mk scripts/plot/Makefile.in scripts/plot/module.mk scripts/polynomial/Makefile.in scripts/polynomial/module.mk scripts/set/Makefile.in scripts/set/module.mk scripts/signal/Makefile.in scripts/signal/module.mk scripts/skip-autoheader scripts/sparse/Makefile.in scripts/sparse/module.mk scripts/specfun/Makefile.in scripts/specfun/module.mk scripts/special-matrix/Makefile.in scripts/special-matrix/module.mk scripts/startup/Makefile.in scripts/startup/module.mk scripts/statistics/Makefile.in scripts/statistics/base/Makefile.in scripts/statistics/base/module.mk scripts/statistics/distributions/Makefile.in scripts/statistics/distributions/module.mk scripts/statistics/models/Makefile.in scripts/statistics/models/module.mk scripts/statistics/tests/Makefile.in scripts/statistics/tests/module.mk scripts/strings/Makefile.in scripts/strings/module.mk scripts/testfun/Makefile.in scripts/testfun/module.mk scripts/time/Makefile.in scripts/time/module.mk src/ChangeLog src/DLD-FUNCTIONS/config-module.awk src/DLD-FUNCTIONS/config-module.sh src/DLD-FUNCTIONS/module-files src/Makefile.am src/Makefile.in src/OPERATORS/module.mk src/TEMPLATE-INST/module.mk src/find-defun-files.sh src/lex.l src/lex.ll src/mkbuiltins src/mkgendoc src/oct-conf.h.in src/oct-parse.yy src/parse.y src/toplev.cc src/version.h src/version.h.in test/@Blork/module.mk test/@Cork/module.mk test/@Dork/module.mk test/@Gork/module.mk test/@Pork/module.mk test/@Sneetch/module.mk test/@Snork/module.mk test/@Spork/module.mk test/ChangeLog test/Makefile.am test/Makefile.in
diffstat 179 files changed, 6899 insertions(+), 8344 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,54 @@
+2009-11-10  John W. Eaton  <jwe@octave.org>
+
+	* configure.ac: Set octincludedir to
+	$(includedir)/octave-$(version)/octave, not
+	$(includedir)/octave-$(version).
+	* mkoctfile.in: Set DEFAULT_INCFLAGS to -I$octincludedir/.. and
+	-I$octincludedir instead of -I$octincludedir and
+	-I$octincludedir/octave.
+
+	* configure.ac: Pass args to AC_INIT.  Invoke AM_INIT_AUTOMAKE and
+	AC_PROG_LIBTOOL.  Don't call AC_PROG_RANLIB.  Set version info here.
+	Call AC_CONFIG_MACRO_DIR.  Give same warning for gcc 1.x and 2.x.
+	Use AM_CONDITIONALS for FFTW, BLAS, and LAPACK.  Don't set
+	variables with calls to ACX_BLAS_WITH_F77_FUNC or ACX_LAPACK.
+	Don't substitute BLAS_DIR or LAPACK_DIR.  Use LT_INIT.  Eliminate
+	--enable-shared and --enable-static options (now provided by
+	LT_INIT).  Set SHARED_LIBS and STATIC_LIBS variables based on
+	LT_INIT variables.  Handle dlopen libraries with info from
+	LT_INIT.  Substitute NO_UNDEFINED_FLAG (only set on Windows
+	sytems).  Include $LAPACK_LIBS in $LIBS when checking for qrupdate
+	and cholmod.  Handle --enable-dl consistently with other --enable
+	options.  Don't copy $srcdir/Makefile in AH_BOTTOM commands.
+	Substitute LEX_OUTPUT_ROOT.  Use AM_CONDITONAL for
+	ENABLE_DYNAMIC_LINKING.  Reindent configure summary.
+	(AC_CONFIG_FILES): Don't list Makefiles in libcruft
+	subdirectories.  Generate Makefile and src/version.h.  Don't
+	generate Makeconf, octMakefile, m4/Makefile, emacs/Makefile,
+	examples/@polynomial/Makefile, or examples/@FIRfilter/Makefile.
+
+	* run-octave.in Call libtool to execute src/octave.
+	(ldpreloadsep, liboctinterp, liboctave, libcruft): Delete variables.
+	(INFOFILE): Find it in $top_srcdir, not $builddir.
+
+	* acinclude.m4: Rename from aclocal.m4.
+	(OCTAVE_PROG_FLEX): Don't include -t in LFLAGS.
+
+	* autogen.sh: Exit immediately on error.  Use libtoolize, aclocal,
+	and automake.  Only run autoconf and autoheader in top-level and
+	scripts directories.
+	Run liboctave/config-ops.sh, doc/interpreter/config-images.sh, and
+	src/DLD-FUNCTIONS/config-module.sh, to generate source lists for
+	subdirectories.
+
+	* AUTHORS, Makefile.am, common.mk, m4/module.mk, emacs/module.mk,
+	examples/@FIRfilter/module.mk, examples/@polynomial/module.mk,
+	examples/Makefile.am: New files.
+	* Makeconf.in, Makefile, octMakefile.in, m4/Makefile.in,
+	emacs/Makefile.in, install-sh, examples/Makefile.in,
+	examples/@FIRfilter/Makefile.in, examples/@polynomial/Makefile.in:
+	Delete.
+
 2009-11-09  David Grundberg  <davidg@cs.umu.se>
 
 	* configure.ac: Use AMD_CPPFLAGS while checking for UMFPACK.
deleted file mode 100644
--- a/Makeconf.in
+++ /dev/null
@@ -1,834 +0,0 @@
-# @configure_input@
-#
-# Common configuration rules for all of octave's Makefiles.
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
- 
-SHELL = /bin/sh
-
-AWK = @AWK@
-export AWK
-
-SED = @SED@
-export SED
-
-FIND = @FIND@
-export FIND
-
-PERL = @PERL@
-export PERL
-
-PYTHON = @PYTHON@
-
-GNUPLOT = @GNUPLOT@
-
-DESKTOP_FILE_INSTALL = @DESKTOP_FILE_INSTALL@
-
-# A shell command to extract the version number from version.h.
-getversion = $(SED) -e '/OCTAVE_VERSION/!d' -e 's/.*"\(.*\)".*$$/\1/' -e q
-
-# A shell command to extract the API version number from version.h.
-getapiversion = $(SED) -e '/OCTAVE_API_VERSION/!d' -e 's/.*"\(.*\)".*$$/\1/' -e q
-
-# Look for version.h to get version information.
-xfiles := $(TOPDIR)/src/version.h $(srcdir)/$(TOPDIR)/src/version.h
-version_file := $(firstword $(foreach file, $(xfiles), $(wildcard $(file))))
-version := $(shell $(getversion) $(version_file))
-api_version := $(shell $(getapiversion) $(version_file))
-
-#### Start of system configuration section. ####
-
-EXEEXT = @EXEEXT@
-
-BUILD_EXEEXT = @BUILD_EXEEXT@
-
-LEX = @LEX@
-LFLAGS = @LFLAGS@
-LEXLIB = @LEXLIB@
-
-YACC = @YACC@
-YFLAGS = -dv
-
-GPERF = @GPERF@
-
-AR = @AR@
-ARFLAGS = @ARFLAGS@ 
-
-TEMPLATE_AR = @TEMPLATE_AR@
-TEMPLATE_ARFLAGS = @TEMPLATE_ARFLAGS@
-
-RANLIB = @RANLIB@
-
-LN_S = @LN_S@
-
-MAKEINFO = @MAKEINFO@
-TEXI2DVI = @TEXI2DVI@
-TEXI2PDF = @TEXI2PDF@
-
-GHOSTSCRIPT = @GHOSTSCRIPT@
-
-DEFAULT_PAGER = @DEFAULT_PAGER@
-
-ENABLE_DYNAMIC_LINKING = @ENABLE_DYNAMIC_LINKING@
-
-STATIC_LIBS = @STATIC_LIBS@
-
-SHARED_LIBS = @SHARED_LIBS@
-SHLEXT = @SHLEXT@
-SHLEXT_VER = @SHLEXT_VER@
-SHLLIB = @SHLLIB@
-SHLLIB_VER = @SHLLIB_VER@
-SHLBIN = @SHLBIN@
-SHLBIN_VER = @SHLBIN_VER@
-SHLLINKEXT=
-
-LIBEXT = a
-LIBPRE = @LIBPRE@
-SHLPRE = @SHLPRE@
-SHLLIBPRE = @SHLLIBPRE@
-SHLBINPRE = @SHLBINPRE@
-
-# Fortran compiler flags.
-
-FC = @FC@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-FPICFLAG = @FPICFLAG@
-ALL_FFLAGS = $(FFLAGS)
-F77_FLOAT_STORE_FLAG = @F77_FLOAT_STORE_FLAG@
-
-F77_TOLOWER=@F77_TOLOWER@
-F77_APPEND_UNDERSCORE=@F77_TOLOWER@
-F77_APPEND_EXTRA_UNDERSCORE=@F77_TOLOWER@
-
-# cc and associated flags.
-
-# Clean up INCFLAGS a bit if we are not compiling in a separate
-# directory.
-ifeq ($(srcdir),.)
-  TMP_IF_1 = -I.
-else
-  TMP_IF_1 = -I. -I$(srcdir)
-endif
-ifeq ($(TOPDIR),$(top_srcdir))
-  TMP_IF_2 = \
-    -I$(TOPDIR) \
-    -I$(TOPDIR)/liboctave \
-    -I$(TOPDIR)/src \
-    -I$(TOPDIR)/libcruft/misc
-else
-  TMP_IF_2 = \
-    -I$(TOPDIR) \
-    -I$(TOPDIR)/liboctave \
-    -I$(TOPDIR)/src \
-    -I$(TOPDIR)/libcruft/misc \
-    -I$(top_srcdir) \
-    -I$(top_srcdir)/liboctave \
-    -I$(top_srcdir)/src \
-    -I$(top_srcdir)/libcruft/misc
-endif
-INCFLAGS = $(TMP_IF_1) $(TMP_IF_2)
-
-X11_INCFLAGS = @X11_INCFLAGS@
-X11_LIBS = @X11_LIBS@
-
-CARBON_LIBS = @CARBON_LIBS@
-
-MAGICK_CPPFLAGS = @MAGICK_CPPFLAGS@
-MAGICK_LDFLAGS = @MAGICK_LDFLAGS@
-MAGICK_LIBS = @MAGICK_LIBS@
-
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-PTHREAD_LIBS = @PTHREAD_LIBS@
-
-LIBFLAGS = -L$(TOPDIR)
-
-DEFS = @DEFS@
-
-UGLY_DEFS = @UGLY_DEFS@
-
-CC = @CC@
-CC_VERSION = @CC_VERSION@
-CFLAGS = @CFLAGS@
-CPICFLAG = @CPICFLAG@
-XTRA_CFLAGS = @XTRA_CFLAGS@
-WARN_CFLAGS = @WARN_CFLAGS@
-ALL_CFLAGS = $(INCFLAGS) $(DLL_CDEFS) $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS) $(PTHREAD_CFLAGS)
-BUG_CFLAGS = $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
-
-BUILD_CC = @BUILD_CC@
-BUILD_CFLAGS = @BUILD_CFLAGS@
-
-DEPEND_FLAGS = @DEPEND_FLAGS@
-DEPEND_EXTRA_SED_PATTERN = @DEPEND_EXTRA_SED_PATTERN@
-INCLUDE_DEPS = @INCLUDE_DEPS@
-ifeq ($(INCLUDE_DEPS),false)
-  omit_deps = true;
-endif
-
-GRAPHICS_CFLAGS = @GRAPHICS_CFLAGS@
-
-CXX = @CXX@
-CXX_VERSION = @CXX_VERSION@
-CXXCPP = @CXXCPP@
-CXXFLAGS = @CXXFLAGS@
-CXXPICFLAG = @CXXPICFLAG@
-XTRA_CXXFLAGS = @XTRA_CXXFLAGS@
-WARN_CXXFLAGS = @WARN_CXXFLAGS@
-ALL_CXXFLAGS = \
-  $(INCFLAGS) $(DLL_CXXDEFS) $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS) $(PTHREAD_CFLAGS)
-BUG_CXXFLAGS = $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS)
-
-BUILD_CXX = @BUILD_CXX@
-BUILD_CXXFLAGS = @BUILD_CXXFLAGS@
-
-CPPFLAGS = @CPPFLAGS@
-
-LD_CXX = @LD_CXX@
-LDFLAGS = @LDFLAGS@
-LD_STATIC_FLAG = @LD_STATIC_FLAG@
-ALL_LDFLAGS = $(LIBFLAGS) $(LD_STATIC_FLAG) $(CPICFLAG) $(LDFLAGS)
-
-BUILD_LDFLAGS = @BUILD_LDFLAGS@
-
-SH_LD = @SH_LD@
-SH_LDFLAGS = @SH_LDFLAGS@
-
-DL_LD = @DL_LD@
-DL_LDFLAGS = @DL_LDFLAGS@
-
-SONAME_FLAGS = @SONAME_FLAGS@
-
-RDYNAMIC_FLAG = @RDYNAMIC_FLAG@
-
-RLD_FLAG = @RLD_FLAG@
-
-FLIBS = @FLIBS@
-
-LIBGLOB = @LIBGLOB@
-LIBOCTINTERP = @LIBOCTINTERP@
-LIBOCTAVE = @LIBOCTAVE@
-LIBCRUFT = @LIBCRUFT@
-
-FT2_LIBS = @FT2_LIBS@
-
-HDF5_CPPFLAGS = @HDF5_CPPFLAGS@
-HDF5_LDFLAGS = @HDF5_LDFLAGS@
-HDF5_LIBS = @HDF5_LIBS@
-
-Z_CPPFLAGS = @Z_CPPFLAGS@
-Z_LDFLAGS = @Z_LDFLAGS@
-Z_LIBS = @Z_LIBS@
-
-GRAPHICS_LIBS = @GRAPHICS_LIBS@
-
-QHULL_CPPFLAGS = @QHULL_CPPFLAGS@
-QHULL_LDFLAGS = @QHULL_LDFLAGS@
-QHULL_LIBS = @QHULL_LIBS@
-
-REGEX_LIBS = @REGEX_LIBS@
-BLAS_LIBS = @BLAS_LIBS@
-
-FFTW3_CPPFLAGS = @FFTW3_CPPFLAGS@
-FFTW3_LDFLAGS = @FFTW3_LDFLAGS@
-FFTW3_LIBS = @FFTW3_LIBS@
-
-FFTW3F_CPPFLAGS = @FFTW3F_CPPFLAGS@
-FFTW3F_LDFLAGS = @FFTW3F_LDFLAGS@
-FFTW3F_LIBS = @FFTW3F_LIBS@
-
-GLPK_CPPFLAGS = @GLPK_CPPFLAGS@
-GLPK_LDFLAGS = @GLPK_LDFLAGS@
-GLPK_LIBS = @GLPK_LIBS@
-
-CURL_CPPFLAGS = @CURL_CPPFLAGS@
-CURL_LDFLAGS = @CURL_LDFLAGS@
-CURL_LIBS = @CURL_LIBS@
-
-AMD_CPPFLAGS = @AMD_CPPFLAGS@
-AMD_LDFLAGS = @AMD_LDFLAGS@
-AMD_LIBS = @AMD_LIBS@
-
-CAMD_CPPFLAGS = @CAMD_CPPFLAGS@
-CAMD_LDFLAGS = @CAMD_LDFLAGS@
-CAMD_LIBS = @CAMD_LIBS@
-
-COLAMD_CPPFLAGS = @COLAMD_CPPFLAGS@
-COLAMD_LDFLAGS = @COLAMD_LDFLAGS@
-COLAMD_LIBS = @COLAMD_LIBS@
-
-CCOLAMD_CPPFLAGS = @CCOLAMD_CPPFLAGS@
-CCOLAMD_LDFLAGS = @CCOLAMD_LDFLAGS@
-CCOLAMD_LIBS = @CCOLAMD_LIBS@
-
-CHOLMOD_CPPFLAGS = @CHOLMOD_CPPFLAGS@
-CHOLMOD_LDFLAGS = @CHOLMOD_LDFLAGS@
-CHOLMOD_LIBS = @CHOLMOD_LIBS@
-
-CXSPARSE_CPPFLAGS = @CXSPARSE_CPPFLAGS@
-CXSPARSE_LDFLAGS = @CXSPARSE_LDFLAGS@
-CXSPARSE_LIBS = @CXSPARSE_LIBS@
-
-UMFPACK_CPPFLAGS = @UMFPACK_CPPFLAGS@
-UMFPACK_LDFLAGS = @UMFPACK_LDFLAGS@
-UMFPACK_LIBS = @UMFPACK_LIBS@
-
-OPENGL_LIBS = @OPENGL_LIBS@
-
-QRUPDATE_CPPFLAGS = @QRUPDATE_CPPFLAGS@
-QRUPDATE_LDFLAGS = @QRUPDATE_LDFLAGS@
-QRUPDATE_LIBS = @QRUPDATE_LIBS@
-
-READLINE_LIBS = @READLINE_LIBS@
-TERM_LIBS = @TERM_LIBS@
-
-ARPACK_CPPFLAGS = @ARPACK_CPPFLAGS@
-ARPACK_LDFLAGS = @ARPACK_LDFLAGS@
-ARPACK_LIBS = @ARPACK_LIBS@
-
-DL_LIBS = @DL_LIBS@
-LIBS = @LIBS@
-
-ALL_CPPFLAGS = $(CPPFLAGS) $(HDF5_CPPFLAGS) $(Z_CPPFLAGS)
-
-SPARSE_CPPFLAGS = \
-  $(CHOLMOD_CPPFLAGS) $(UMFPACK_CPPFLAGS) \
-  $(AMD_CPPFLAGS) $(CAMD_CPPFLAGS) $(COLAMD_CPPFLAGS) \
-  $(CCOLAMD_CPPFLAGS) $(CXSPARSE_CPPFLAGS)
-
-SPARSE_LDFLAGS = \
-  $(CHOLMOD_LDFLAGS) $(UMFPACK_LDFLAGS) \
-  $(AMD_LDFLAGS) $(CAMD_LDFLAGS) $(COLAMD_LDFLAGS) \
-  $(CCOLAMD_LDFLAGS) $(CXSPARSE_LDFLAGS)
-
-## Order matters, at least on some systems (Cygwin, for example).
-SPARSE_LIBS = \
-    $(CHOLMOD_LIBS) $(UMFPACK_LIBS) \
-    $(AMD_LIBS) $(CAMD_LIBS) $(COLAMD_LIBS) \
-    $(CCOLAMD_LIBS) $(CXSPARSE_LIBS)
-
-FFTW_CPPFLAGS = $(FFTW3_CPPFLAGS) $(FFTW3F_CPPFLAGS)
-
-FFTW_LDFLAGS = $(FFTW3_LDFLAGS) $(FFTW3F_LDFLAGS)
-
-FFTW_LIBS = $(FFTW3_LIBS) $(FFTW3F_LIBS)
-
-USE_64_BIT_IDX_T = @USE_64_BIT_IDX_T@
-
-TEXINFO_COLAMD = @TEXINFO_COLAMD@
-TEXINFO_CHOLMOD = @TEXINFO_CHOLMOD@
-TEXINFO_UMFPACK = @TEXINFO_UMFPACK@
-TEXINFO_QHULL = @TEXINFO_QHULL@
-
-# The arguments passed to configure.
-config_opts = @config_opts@
-
-CONFIG_SUBDIRS = @subdirs@
-
-# ==================== Where To Install Things ====================
-
-# The default location for installation.  Everything is placed in
-# subdirectories of this directory.  The default values for many of
-# the variables below are expressed in terms of this one, so you may
-# not need to change them.  This defaults to /usr/local.
-prefix = @prefix@
-
-# Like `prefix', but used for architecture-specific files.
-exec_prefix = @exec_prefix@
-
-# Where to install Octave and other binaries that people will want to
-# run directly.
-bindir = @bindir@
-
-# Normally the directory for installing executables that system
-# administrators run.  This is the same as libexecdir on Cygwin systems.
-sbindir = @sbindir@
-
-# The root of the directory tree for read-only
-# architecture-independent data files.
-datarootdir = @datarootdir@
-
-# Where to install architecture-independent data files.  ${fcnfiledir}
-# and ${localfcnfiledir} are subdirectories of this.
-datadir = @datadir@
-
-libdir = @libdir@
-
-# Where to install and expect extra files like NEWS and doc-cache.
-octetcdir = @octetcdir@
-
-# Where to install and expect libraries like libcruft.a, liboctave.a,
-# and other architecture-dependent data.
-octlibdir = @octlibdir@
-
-# Where to install and expect executable programs to be run by Octave
-# rather than directly by users.
-libexecdir = @libexecdir@
-
-# The prefix for Octave's include file directory.  The default is
-# ${prefix}/include
-includedir = @includedir@
-
-# Where to install Octave's man pages, and what extension they should
-# have.  The default is ${prefix}/man/man1
-mandir = @mandir@
-man1dir = @man1dir@
-man1ext = @man1ext@
-
-# The full path to the default doc cache file.
-doc_cache_file = @doc_cache_file@
-
-# Where to install and expect the info files describing Octave..
-infodir = @infodir@
-
-# The full path to the default info file.
-infofile = @infofile@
-
-# ==================== Octave-specific directories ====================
-
-# These variables hold the values specific to Octave.  They are
-# based on the values of the standard Make variables above.
-
-# What is the path separation character
-sepchar = @sepchar@
-
-# Where to install Octave's include files (they will actually be
-# installed in a subdirectory called octave).  The default is
-# ${includedir}/octave-${version}
-octincludedir = @octincludedir@
-
-# Where to install the function file distributed with
-# Octave.  This includes the Octave version, so that the
-# function files for different versions of Octave will install
-# themselves in separate directories.
-fcnfiledir = @fcnfiledir@
-
-# Directories Octave should search for function files specific
-# to this site (i.e. customizations), before consulting
-# ${fcnfiledir}.  This should be a colon-separated list of
-# directories.
-localfcnfiledir = @localfcnfiledir@
-localapifcnfiledir = @localapifcnfiledir@
-localverfcnfiledir = @localverfcnfiledir@
-
-# Where to put executables to be run by Octave rather than
-# the user.  This path usually includes the Octave version
-# and configuration name, so that multiple configurations
-# for multiple versions of Octave may be installed at once.
-archlibdir = @archlibdir@
-
-# Where to put executables to be run by Octave rather than by the
-# user that are specific to this site.
-localarchlibdir = @localarchlibdir@
-localapiarchlibdir = @localapiarchlibdir@
-localverarchlibdir = @localverarchlibdir@
-
-# Where to put object files that will by dynamically loaded.
-# This path usually includes the Octave version and configuration
-# name, so that multiple configurations for multiple versions of
-# Octave may be installed at once. 
-octfiledir = @octfiledir@
-
-# Directories Octave should search for object files that will be
-# dynamically loaded and that are specific to this site
-# (i.e. customizations), before consulting ${octfiledir}.  This should
-# be a colon-separated list of directories.
-localoctfiledir = @localoctfiledir@
-localapioctfiledir = @localapioctfiledir@
-localveroctfiledir = @localveroctfiledir@
-
-# Where Octave will search to find image files.
-imagedir = @imagedir@
-
-# The type of computer we are running on.
-canonical_host_type = @canonical_host_type@
-
-# Where Octave will look for startup files
-startupfiledir = ${fcnfiledir}/startup
-localstartupfiledir = ${localfcnfiledir}/startup
-
-# LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PATH, ...
-library_path_var = @library_path_var@
-
-# The separator used for elements of the LD_PRELOAD variable (might be
-# a space, so protect with $(null))
-null :=
-ldpreloadsep = $(null)@ldpreloadsep@$(null)
-
-NO_OCT_FILE_STRIP = @NO_OCT_FILE_STRIP@
-
-# The following pattern rules and the substitution functions require
-# GNU make.  If you don't have it, get it!
-
-# How to make .o files:
-
-%.o : %.f
-	$(FC) -c $(ALL_FFLAGS) -o $@ $<
-
-%.o : %.c
-	$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< -o $@
-
-%.o : %.cc
-	$(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< -o $@
-
-pic/%.o : %.f
-	$(FC) -c $(FPICFLAG) $(ALL_FFLAGS) $< -o $@
-
-pic/%.o : %.c
-	$(CC) -c $(ALL_CPPFLAGS) $(CPICFLAG) $(ALL_CFLAGS) $< -o $@
-
-pic/%.o : %.cc
-	$(CXX) -c $(ALL_CPPFLAGS) $(CXXPICFLAG) $(ALL_CXXFLAGS) $< -o $@
-
-# Here is a rule for generating dependencies for .cc files:
-
-%.d : %.cc
-	@echo making $@ from $<
-	@rm -f $@
-	@$(CXX) $(DEPEND_FLAGS) $(CPPFLAGS) $(ALL_CXXFLAGS) $< | \
-	  $(SED) \
-              $(DEPEND_EXTRA_SED_PATTERN) \
-	      -e 's,^[^:]*/\(.*\.o\):,\1:,' \
-	      -e 's,$*\.o,pic/& & $*.df $@,g' > $@-t
-	@mv $@-t $@
-
-# And one for .c files.too:
-
-%.d : %.c
-	@echo making $@ from $<
-	@rm -f $@
-	@$(CC) $(DEPEND_FLAGS) $(CPPFLAGS) $(ALL_CFLAGS) $< | \
-	  $(SED) \
-              $(DEPEND_EXTRA_SED_PATTERN) \
-	      -e 's,^[^:]*/\(.*\.o\):,\1:,' \
-	      -e 's,$*\.o,pic/& & $@,g' > $@-t
-	@mv $@-t $@
-
-define do-subdir-for-command
-echo making $@ in $d; $(MAKE) -C $d $@;
-endef
-
-define subdir-for-command
-$(foreach d, $(SUBDIRS), $(do-subdir-for-command))
-endef
-
-define simple-move-if-change-rule
-if [ -s $@-t ]; then \
-  $(top_srcdir)/move-if-change $@-t $@; \
-else \
-  echo "$@-t is empty!" 1>&2; \
-  rm -f $@-t; \
-  exit 1; \
-fi
-endef
-
-define builddir-move-if-change-rule
-if [ -s $(@F)-t ]; then \
-  $(top_srcdir)/move-if-change $(@F)-t $(@F); \
-else \
-  echo "$(@F)-t is empty!" 1>&2; \
-  rm -f $(@F)-t; \
-  exit 1; \
-fi
-endef
-
-# Yes, the second sed command near the end is needed, to avoid limits
-# in command lengths for some versions of sed.  UGLY_DEFS is often
-# quite large, so it makes sense to split this command there.
-
-define do-subst-config-vals
-echo "making $@ from $<"
-$(SED) < $< \
-  -e "s|%NO_OCT_FILE_STRIP%|${NO_OCT_FILE_STRIP}|" \
-  -e "s|%OCTAVE_BINDIR%|\"${bindir}\"|" \
-  -e "s|%OCTAVE_CONF_ALL_CFLAGS%|\"${ALL_CFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_ALL_CXXFLAGS%|\"${ALL_CXXFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_ALL_FFLAGS%|\"${ALL_FFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_ALL_LDFLAGS%|\"${ALL_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_AMD_CPPFLAGS%|\"${AMD_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_AMD_LDFLAGS%|\"${AMD_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_AMD_LIBS%|\"${AMD_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_AR%|\"${AR}\"|" \
-  -e "s|%OCTAVE_CONF_ARFLAGS%|\"${ARFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_ARPACK_CPPFLAGS%|\"${ARPACK_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_ARPACK_LDFLAGS%|\"${ARPACK_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_ARPACK_LIBS%|\"${ARPACK_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_BLAS_LIBS%|\"${BLAS_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_CAMD_CPPFLAGS%|\"${CAMD_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CAMD_LDFLAGS%|\"${CAMD_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CAMD_LIBS%|\"${CAMD_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_CANONICAL_HOST_TYPE%|\"${canonical_host_type}\"|" \
-  -e "s|%OCTAVE_CONF_CARBON_LIBS%|\"${CARBON_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_CC%|\"${CC}\"|" \
-  -e "s|%OCTAVE_CONF_CC_VERSION%|\"${CC_VERSION}\"|" \
-  -e "s|%OCTAVE_CONF_CCOLAMD_CPPFLAGS%|\"${CCOLAMD_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CCOLAMD_LDFLAGS%|\"${CCOLAMD_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CCOLAMD_LIBS%|\"${CCOLAMD_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_CFLAGS%|\"${CFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CHOLMOD_CPPFLAGS%|\"${CHOLMOD_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CHOLMOD_LDFLAGS%|\"${CHOLMOD_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CHOLMOD_LIBS%|\"${CHOLMOD_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_COLAMD_CPPFLAGS%|\"${COLAMD_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_COLAMD_LDFLAGS%|\"${COLAMD_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_COLAMD_LIBS%|\"${COLAMD_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_CPICFLAG%|\"${CPICFLAG}\"|" \
-  -e "s|%OCTAVE_CONF_CPPFLAGS%|\"${CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CURL_CPPFLAGS%|\"${CURL_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CURL_LDFLAGS%|\"${CURL_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CURL_LIBS%|\"${CURL_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_CXSPARSE_CPPFLAGS%|\"${CXSPARSE_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CXSPARSE_LDFLAGS%|\"${CXSPARSE_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CXSPARSE_LIBS%|\"${CXSPARSE_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_CXX%|\"${CXX}\"|" \
-  -e "s|%OCTAVE_CONF_CXXCPP%|\"${CXXCPP}\"|" \
-  -e "s|%OCTAVE_CONF_CXXFLAGS%|\"${CXXFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_CXXPICFLAG%|\"${CXXPICFLAG}\"|" \
-  -e "s|%OCTAVE_CONF_CXX_VERSION%|\"${CXX_VERSION}\"|" \
-  -e "s|%OCTAVE_CONF_DEFAULT_PAGER%|\"${DEFAULT_PAGER}\"|" \
-  -e "s|%OCTAVE_CONF_DEPEND_FLAGS%|\"${DEPEND_FLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%|\"${DEPEND_EXTRA_SED_PATTERN}\"|" \
-  -e "s|%OCTAVE_CONF_DL_LD%|\"${DL_LD}\"|" \
-  -e "s|%OCTAVE_CONF_DL_LDFLAGS%|\"${DL_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_DL_LIBS%|\"${DL_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_EXEEXT%|\"${EXEEXT}\"|" \
-  -e "s|%OCTAVE_CONF_F77%|\"${F77}\"|" \
-  -e "s|%OCTAVE_CONF_F77_FLOAT_STORE_FLAG%|\"${F77_FLOAT_STORE_FLAG}\"|" \
-  -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \
-  -e "s|%OCTAVE_CONF_FFLAGS%|\"${FFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_FFTW3_CPPFLAGS%|\"${FFTW3_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_FFTW3_LDFLAGS%|\"${FFTW3_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_FFTW3_LIBS%|\"${FFTW3_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_FFTW3F_CPPFLAGS%|\"${FFTW3F_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_FFTW3F_LDFLAGS%|\"${FFTW3F_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_FFTW3F_LIBS%|\"${FFTW3F_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_FLIBS%|\"${FLIBS}\"|" \
-  -e "s|%OCTAVE_CONF_FPICFLAG%|\"${FPICFLAG}\"|" \
-  -e "s|%OCTAVE_CONF_FT2_LIBS%|\"${FT2_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_GLPK_CPPFLAGS%|\"${GLPK_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_GLPK_LDFLAGS%|\"${GLPK_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_GLPK_LIBS%|\"${GLPK_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_GNUPLOT%|\"${GNUPLOT}\"|" \
-  -e "s|%OCTAVE_CONF_GRAPHICS_LIBS%|\"${GRAPHICS_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_HDF5_CPPFLAGS%|\"${HDF5_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_HDF5_LDFLAGS%|\"${HDF5_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_HDF5_LIBS%|\"${HDF5_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_INCFLAGS%|\"${INCFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_INCLUDEDIR%|\"${includedir}\"|" \
-  -e "s|%OCTAVE_CONF_LD_CXX%|\"${LD_CXX}\"|" \
-  -e "s|%OCTAVE_CONF_LDFLAGS%|\"${LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_LD_STATIC_FLAG%|\"${LD_STATIC_FLAG}\"|" \
-  -e "s|%OCTAVE_CONF_LEX%|\"${LEX}\"|" \
-  -e "s|%OCTAVE_CONF_LEXLIB%|\"${LEXLIB}\"|" \
-  -e "s|%OCTAVE_CONF_LFLAGS%|\"${LFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_LIBCRUFT%|\"${LIBCRUFT}\"|" \
-  -e "s|%OCTAVE_CONF_LIBDIR%|\"${libdir}\"|" \
-  -e "s|%OCTAVE_CONF_LIBEXT%|\"${LIBEXT}\"|" \
-  -e "s|%OCTAVE_CONF_LIBFLAGS%|\"${LIBFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_LIBGLOB%|\"${LIBGLOB}\"|" \
-  -e "s|%OCTAVE_CONF_LIBOCTAVE%|\"${LIBOCTAVE}\"|" \
-  -e "s|%OCTAVE_CONF_LIBOCTINTERP%|\"${LIBOCTINTERP}\"|" \
-  -e "s|%OCTAVE_CONF_LIBS%|\"${LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_LN_S%|\"${LN_S}\"|" \
-  -e "s|%OCTAVE_CONF_MAGICK_CPPFLAGS%|\"${MAGICK_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_MAGICK_LDFLAGS%|\"${MAGICK_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_MAGICK_LIBS%|\"${MAGICK_LIBS}\"|" \
-  -e 's|%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%|\"@MKOCTFILE_DL_LDFLAGS@\"|' \
-  -e "s|%OCTAVE_CONF_OCTINCLUDEDIR%|\"${octincludedir}\"|" \
-  -e "s|%OCTAVE_CONF_OCTLIBDIR%|\"${octlibdir}\"|" \
-  -e "s|%OCTAVE_CONF_OPENGL_LIBS%|\"${OPENGL_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_PREFIX%|\"${prefix}\"|" \
-  -e "s|%OCTAVE_CONF_PTHREAD_CFLAGS%|\"${PTHREAD_CFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_PTHREAD_LIBS%|\"${PTHREAD_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_QHULL_CPPFLAGS%|\"${QHULL_CPPFLAGSS}\"|" \
-  -e "s|%OCTAVE_CONF_QHULL_LDFLAGS%|\"${QHULL_LDFLAGSS}\"|" \
-  -e "s|%OCTAVE_CONF_QHULL_LIBS%|\"${QHULL_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_QRUPDATE_CPPFLAGS%|\"${QRUPDATE_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_QRUPDATE_LDFLAGS%|\"${QRUPDATE_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_QRUPDATE_LIBS%|\"${QRUPDATE_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_RANLIB%|\"${RANLIB}\"|" \
-  -e "s|%OCTAVE_CONF_RDYNAMIC_FLAG%|\"${RDYNAMIC_FLAG}\"|" \
-  -e "s|%OCTAVE_CONF_READLINE_LIBS%|\"${READLINE_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_REGEX_LIBS%|\"${REGEX_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_RLD_FLAG%|\"${RLD_FLAG}\"|" \
-  -e "s|%OCTAVE_CONF_SED%|\"${SED}\"|" \
-  -e "s|%OCTAVE_CONF_SHARED_LIBS%|\"${SHARED_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_SHLEXT%|\"${SHLEXT}\"|" \
-  -e "s|%OCTAVE_CONF_SHLLINKEXT%|\"${SHLLINKEXT}\"|" \
-  -e "s|%OCTAVE_CONF_SHLEXT_VER%|\"${SHLEXT_VER}\"|" \
-  -e "s|%OCTAVE_CONF_SH_LD%|\"${SH_LD}\"|" \
-  -e "s|%OCTAVE_CONF_SH_LDFLAGS%|\"${SH_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_SONAME_FLAGS%|\"${SONAME_FLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_STATIC_LIBS%|\"${STATIC_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_TERM_LIBS%|\"${TERM_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_UGLY_DEFS%|\"${UGLY_DEFS}\"|" \
-  -e "s|%OCTAVE_CONF_UMFPACK_CPPFLAGS%|\"${UMFPACK_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_UMFPACK_LDFLAGS%|\"${UMFPACK_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_UMFPACK_LIBS%|\"${UMFPACK_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_USE_64_BIT_IDX_T%|\"${USE_64_BIT_IDX_T}\"|" \
-  -e "s|%OCTAVE_CONF_VERSION%|\"${version}\"|" \
-  -e "s|%OCTAVE_CONF_ENABLE_DYNAMIC_LINKING%|\"${ENABLE_DYNAMIC_LINKING}\"|" \
-  -e "s|%OCTAVE_CONF_X11_INCFLAGS%|\"${X11_INCFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_X11_LIBS%|\"${X11_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_XTRA_CFLAGS%|\"${XTRA_CFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_XTRA_CXXFLAGS%|\"${XTRA_CXXFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_YACC%|\"${YACC}\"|" \
-  -e "s|%OCTAVE_CONF_YFLAGS%|\"${YFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_Z_CPPFLAGS%|\"${Z_CPPFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_Z_LDFLAGS%|\"${Z_LDFLAGS}\"|" \
-  -e "s|%OCTAVE_CONF_Z_LIBS%|\"${Z_LIBS}\"|" \
-  -e "s|%OCTAVE_CONF_config_opts%|\"${config_opts}\"|" | \
-  $(SED)  -e "s|%OCTAVE_CONF_DEFS%|\"${UGLY_DEFS}\"|" > $@-t
-$(simple-move-if-change-rule)
-endef
-
-define do-subst-default-vals
-echo "making $@ from $<"
-$(SED) < $< > $@-t \
-  -e "s|%OCTAVE_ARCHLIBDIR%|\"${archlibdir}\"|" \
-  -e "s|%OCTAVE_BINDIR%|\"${bindir}\"|" \
-  -e "s|%OCTAVE_CANONICAL_HOST_TYPE%|\"${canonical_host_type}\"|" \
-  -e "s|%OCTAVE_DATADIR%|\"${datadir}\"|" \
-  -e "s|%OCTAVE_DATAROOTDIR%|\"${datarootdir}\"|" \
-  -e "s|%OCTAVE_DEFAULT_PAGER%|\"${DEFAULT_PAGER}\"|" \
-  -e "s|%OCTAVE_DOC_CACHE_FILE%|\"${doc_cache_file}\"|" \
-  -e "s|%OCTAVE_EXEC_PREFIX%|\"${exec_prefix}\"|" \
-  -e "s|%OCTAVE_FCNFILEDIR%|\"${fcnfiledir}\"|" \
-  -e "s|%OCTAVE_IMAGEDIR%|\"${imagedir}\"|" \
-  -e "s|%OCTAVE_INCLUDEDIR%|\"${includedir}\"|" \
-  -e "s|%OCTAVE_INFODIR%|\"${infodir}\"|" \
-  -e "s|%OCTAVE_INFOFILE%|\"${infofile}\"|" \
-  -e "s|%OCTAVE_LIBDIR%|\"${libdir}\"|" \
-  -e "s|%OCTAVE_LIBEXECDIR%|\"${libexecdir}\"|" \
-  -e "s|%OCTAVE_LOCALAPIFCNFILEDIR%|\"${localapifcnfiledir}\"|" \
-  -e "s|%OCTAVE_LOCALAPIOCTFILEDIR%|\"${localapioctfiledir}\"|" \
-  -e "s|%OCTAVE_LOCALARCHLIBDIR%|\"${localarchlibdir}\"|" \
-  -e "s|%OCTAVE_LOCALFCNFILEDIR%|\"${localfcnfiledir}\"|" \
-  -e "s|%OCTAVE_LOCALOCTFILEDIR%|\"${localoctfiledir}\"|" \
-  -e "s|%OCTAVE_LOCALSTARTUPFILEDIR%|\"${localstartupfiledir}\"|" \
-  -e "s|%OCTAVE_LOCALAPIARCHLIBDIR%|\"${localapiarchlibdir}\"|" \
-  -e "s|%OCTAVE_LOCALVERARCHLIBDIR%|\"${localverarchlibdir}\"|" \
-  -e "s|%OCTAVE_LOCALVERFCNFILEDIR%|\"${localverfcnfiledir}\"|" \
-  -e "s|%OCTAVE_LOCALVEROCTFILEDIR%|\"${localveroctfiledir}\"|" \
-  -e "s|%OCTAVE_MAN1DIR%|\"${man1dir}\"|" \
-  -e "s|%OCTAVE_MAN1EXT%|\"${man1ext}\"|" \
-  -e "s|%OCTAVE_MANDIR%|\"${mandir}\"|" \
-  -e "s|%OCTAVE_OCTFILEDIR%|\"${octfiledir}\"|" \
-  -e "s|%OCTAVE_OCTETCDIR%|\"${octetcdir}\"|" \
-  -e "s|%OCTAVE_OCTINCLUDEDIR%|\"${octincludedir}\"|" \
-  -e "s|%OCTAVE_OCTLIBDIR%|\"${octlibdir}\"|" \
-  -e "s|%OCTAVE_STARTUPFILEDIR%|\"${startupfiledir}\"|" \
-  -e "s|%OCTAVE_PREFIX%|\"${prefix}\"|" \
-  -e "s|%OCTAVE_API_VERSION%|\"${api_version}\"|" \
-  -e "s|%OCTAVE_RELEASE%|\"${OCTAVE_RELEASE}\"|" \
-  -e "s|%OCTAVE_VERSION%|\"${version}\"|"
-$(simple-move-if-change-rule)
-endef
-
-define do-subst-texinfo-vals
-echo "making $@ from $<"
-$(SED) < $< \
-  -e "s|%abs_top_srcdir%|${abs_top_srcdir}|" \
-  -e "s|%top_srcdir%|${top_srcdir}|" \
-  -e "s|%OCTAVE_HOME%|${prefix}|" \
-  -e "s|%OCTAVE_VERSION%|${version}|" \
-  -e "s|%TEXINFO_COLAMD%|${TEXINFO_COLAMD}|" \
-  -e "s|%TEXINFO_CHOLMOD%|${TEXINFO_CHOLMOD}|" \
-  -e "s|%TEXINFO_UMFPACK%|${TEXINFO_UMFPACK}|" \
-  -e "s|%TEXINFO_QHULL%|${TEXINFO_QHULL}|" | \
-  $(SED) -e "s|%OCTAVE_CONF_DEFS%|\"${UGLY_DEFS}\"|" > $@-t
-$(simple-move-if-change-rule)
-endef
-
-define do-subst-script-vals
-echo "making $@ from $<"
-$(SED) < $< \
-  -e "s|%AWK%|${AWK}|g" \
-  -e "s|%FIND%|${FIND}|g" \
-  -e "s|%SED%|${SED}|g" \
-  -e "s|%library_path_var%|${library_path_var}|g" \
-  -e "s|%liboctinterp%|${SHLPRE}octinterp.${SHLEXT}|g" \
-  -e "s|%liboctave%|${SHLPRE}octave.${SHLEXT}|g" \
-  -e "s|%libcruft%|${SHLPRE}cruft.${SHLEXT}|g" \
-  -e "s|%ldpreloadsep%|${ldpreloadsep}|g" \
-  -e "s|%srcdir%|${srcdir}|" \
-  -e "s|%top_srcdir%|${top_srcdir}|" \
-  -e "s|%abs_top_srcdir%|${abs_top_srcdir}|" \
-  -e "s|%builddir%|$(shell pwd)|" > $@-t
-$(simple-move-if-change-rule)
-endef
-
-define do-subst-f77-mangling
-echo "making $@ from $<"
-$(SED) < $< \
-  -e "s|%F77_TOLOWER%|${F77_TOLOWER}|g" \
-  -e "s|%F77_APPEND_UNDERSCORE%|${F77_APPEND_UNDERSCORE}|" \
-  -e "s|%F77_APPEND_EXTRA_UNDERSCORE%|${F77_APPEND_EXTRA_UNDERSCORE}|" > $@-t
-$(simple-move-if-change-rule)
-endef
-
-define do-mkpkgadd
-$(top_srcdir)/mkpkgadd $(srcdir) > PKG_ADD.t
-if [ -n "`cat PKG_ADD.t`" ]; then \
-  mv PKG_ADD.t PKG_ADD ; \
-else \
-  rm -f PKG_ADD.t ; \
-fi
-endef
-
-define do-script-install
-$(top_srcdir)/mkinstalldirs \
-  $(addprefix $(DESTDIR), $(fcnfiledir)/$(script_sub_dir))
-for f in $(FCN_FILES); do \
-  fbase=`basename $$f`; \
-  rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$fbase; \
-  $(INSTALL_DATA) $$f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$fbase; \
-done
-$(top_srcdir)/mkpkgadd $(DESTDIR)$(fcnfiledir)/$(script_sub_dir) > $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t
-if [ -n "`cat $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t`" ]; then \
-  $(INSTALL_DATA) $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD ; \
-else \
-  rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t ; \
-fi
-endef
-
-define do-script-uninstall
-for f in $(FCN_FILES_NO_DIR); \
-  do rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$f; \
-done
-rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD
--rmdir $(addprefix $(DESTDIR), $(fcnfiledir)/$(script_sub_dir))
-endef
-
-define do-check-m-sources
-for f in $(notdir $(wildcard $(srcdir)/*.m)); do \
-  found=false; \
-  for m in $(SOURCES); do \
-    if [ "$$f" = "$$m" ]; then \
-      found=true; \
-      break; \
-    fi; \
-  done; \
-  if $$found; then \
-    true; \
-  else \
-    echo "$(script_sub_dir)/$$f: not listed in SOURCES"; \
-  fi; \
-done
-endef
deleted file mode 100644
--- a/Makefile
+++ /dev/null
@@ -1,129 +0,0 @@
-# Makefile for octave's src directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2004,
-#               2005, 2006, 2007, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TARGETS = octave-bug octave-config mkoctfile libcruft liboctave \
-	dlfcn readline src scripts doc check octave.info \
-	INSTALL.OCTAVE BUGS install install-strip uninstall \
-	tags TAGS dist conf-dist snapshot snapshot-version \
-	.gdbinit run-octave
-
-NO_DEP_TARGETS = clean mostlyclean distclean maintainer-clean
-
-all: header-msg config-check
-	$(MAKE) -f octMakefile all
-
-configfiles: FORCE
-	$(MAKE) -f octMakefile configfiles
-
-$(TARGETS): FORCE
-	$(MAKE) -f octMakefile $@
-
-$(NO_DEP_TARGETS): FORCE
-	$(MAKE) -f octMakefile omit_deps=true $@
-
-# Maybe this message will prevent people from asking why the
-# Makefiles don't work for them.  Maybe not.
-
-header-msg: FORCE
-	@echo ""
-	@echo "***********************************************************"
-	@echo "*"
-	@echo "*  To compile Octave, you will need a recent versions of"
-	@echo "*  the following software:"
-	@echo "*"
-	@echo "*    GNU Make (a recent version)"
-	@echo "*"
-	@echo "*    g++ (preferably a recent 4.x version)"
-	@echo "*"
-	@echo "*    flex (2.5.4 or a more recent version) -- required if"
-	@echo "*    you need to recreate lex.cc from lex.l"
-	@echo "*"
-	@echo "*    bison (1.31 or a more recent version) -- required if"
-	@echo "*    you need to recreate parse.cc from parse.y"
-	@echo "*"
-	@echo "*    gperf (3.0.1 or a more recent version) -- required if"
-	@echo "*    you need to recreate oct-gperf.h from octave.gperf"
-	@echo "*"
-	@echo "*  Now would be a good time to read INSTALL.OCTAVE if"
-	@echo "*  you have not done so already."
-	@echo "*"
-	@echo "***********************************************************"
-	@echo ""
-
-help: header-msg
-	@echo ""
-	@echo "For more information, please read the files INSTALL,"
-	@echo "INSTALL.OCTAVE, and any other system-specific README"
-	@echo "files that apply (e.g., README.Linux)."
-	@echo ""
-	@echo "The following targets are available:"
-	@echo ""
-	@echo "  all                  build everything"
-	@echo "  check                run self tests"
-	@echo "  install              install files"
-	@echo "  install-strip        same as install but strip binaries"
-	@echo "  uninstall            delete installed files"
-	@echo ""
-	@echo "  dist                 create a source distribution"
-	@echo "  conf-dist            create a config files distribution"
-	@echo ""
-	@echo "  clean                remove files created by make all"
-	@echo "  mostlyclean          remove most files created by make all"
-	@echo "  distclean            remove all files not in distribution"
-	@echo "  maintainer-clean     clean up everything"
-	@echo ""
-	@echo "  octave-bug           create octave-bug script"
-	@echo "  octave-config        create octave-config script"
-	@echo "  mkoctfile            create mkoctfile script"
-	@echo "  INSTALL.OCTAVE       create INSTALL.OCTAVE doc file"
-	@echo "  BUGS                 create BUGS doc file"
-	@echo "  tags                 create tags files"
-	@echo "  TAGS                 create TAGS files"
-	@echo ""
-	@echo "  dlfcn                make all in subdirectory dlfcn"
-	@echo "  doc                  make all in subdirectory doc"
-	@echo "  libcruft             make all in subdirectory libcruft"
-	@echo "  liboctave            make all in subdirectory liboctave"
-	@echo "  scripts              make all in subdirectory scripts"
-	@echo "  src                  make all in subdirectory src"
-	@echo ""
-	@echo "  configfiles          update the configuration files"
-	@echo ""
-	@echo "  help                 print this message"
-	@echo ""
-
-config-check:
-	@if test -f octMakefile; then \
-	  true; \
-	else \
-	  echo ""; \
-	  echo "*** You must run configure before running make."; \
-	  echo "***"; \
-	  echo "*** Please read the INSTALL and INSTALL.OCTAVE files"; \
-	  echo "*** for more information about how to configure and"; \
-	  echo "*** compile Octave."; \
-	  echo ""; \
-	  exit 1; \
-	fi
-
-FORCE:
-
-.NOTPARALLEL:
new file mode 100644
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,253 @@
+# Makefile for octave
+#
+# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = .
+
+include common.mk
+
+ACLOCAL_AMFLAGS = -I m4
+
+SCRIPTS_EXE_SUFFIX = @SCRIPTS_EXE_SUFFIX@
+
+BUILT_DISTFILES = BUGS INSTALL.OCTAVE
+
+EXTRA_DIST = \
+  BUGS \
+  COPYING \
+  ChangeLog \
+  ChangeLog.1 \
+  INSTALL \
+  INSTALL.OCTAVE \
+  NEWS \
+  NEWS.1 \
+  NEWS.2 \
+  NEWS.3 \
+  PROJECTS \
+  README \
+  README.Cygwin \
+  README.Linux \
+  README.MSVC \
+  README.Windows \
+  README.kpathsea \
+  ROADMAP \
+  SENDING-PATCHES \
+  autogen.sh \
+  missing \
+  mk-opts.pl \
+  mkinstalldirs \
+  mkoctfile.cc.in \
+  mkoctfile.in \
+  move-if-change \
+  octave-bug.cc.in \
+  octave-bug.in \
+  octave-config.cc.in \
+  octave-config.in \
+  octave-sh \
+  run-octave.in
+
+include emacs/module.mk
+include m4/module.mk
+
+# Subdirectories in which to run `make all'.
+SUBDIRS = libcruft liboctave src scripts doc examples test
+
+BUILT_SHELL_FILES = \
+  mkoctfile$(SCRIPTS_EXE_SUFFIX) \
+  octave-config$(SCRIPTS_EXE_SUFFIX) \
+  octave-bug$(SCRIPTS_EXE_SUFFIX) \
+  run-octave
+
+bin_SCRIPTS = \
+  mkoctfile$(SCRIPTS_EXE_SUFFIX) \
+  octave-config$(SCRIPTS_EXE_SUFFIX) \
+  octave-bug$(SCRIPTS_EXE_SUFFIX)
+
+CLEANFILES = $(BUILT_SHELL_FILES)
+
+INFO_FILES = \
+  INSTALL.OCTAVE \
+  BUGS
+
+CONFIG_FILES = @ac_config_headers@ @ac_config_files@
+
+BUILT_SOURCES = run-octave
+
+nodist_octinclude_HEADERS = config.h
+
+all-local: $(bin_SCRIPTS) $(INFO_FILES)
+	@echo ""
+	@echo "Octave successfully built.  Now choose from the following:"
+	@echo ""
+	@echo "   ./run-octave    - to run in place to test before installing"
+	@echo "   make check      - to run the tests"
+	@echo "   make install    - to install (PREFIX=$(prefix))"
+	@echo ""
+.PHONY: all
+
+octave-bug: octave-bug.in Makefile
+	@$(do_subst_config_vals)
+	chmod a+rx $@
+
+octave-bug.cc: octave-bug.cc.in Makefile
+	@$(do_subst_config_vals)
+
+# ifneq ($(EXEEXT),)
+# octave-bug$(EXEEXT): octave-bug.o
+# 	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
+# 	    $(ALL_LDFLAGS) -o $@ octave-bug.o
+# endif
+
+octave-config: octave-config.in Makefile
+	@$(do_subst_default_vals)
+	chmod a+rx $@
+
+octave-config.cc: octave-config.cc.in Makefile
+	@$(do_subst_default_vals)
+
+# ifneq ($(EXEEXT),)
+# octave-config$(EXEEXT): octave-config.o
+# 	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
+# 	    $(ALL_LDFLAGS) -o $@ octave-config.o
+# endif
+
+mkoctfile: mkoctfile.in Makefile
+	@$(do_subst_config_vals)
+	chmod a+rx $@
+
+mkoctfile.cc: mkoctfile.cc.in Makefile
+	@$(do_subst_config_vals)
+
+# ifneq ($(EXEEXT),)
+# mkoctfile$(EXEEXT): mkoctfile.o
+# 	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
+# 	    $(ALL_LDFLAGS) -o $@ mkoctfile.o
+# endif
+
+run-octave: run-octave.in Makefile
+	@$(do_subst_script_vals)
+	chmod a+rx "$@"
+
+BUGS INSTALL.OCTAVE:
+	$(MAKE) -C doc ../$@
+.PHONY: BUGS INSTALL.OCTAVE
+
+DIRS_TO_MAKE = \
+  $(localfcnfiledir) \
+  $(localapifcnfiledir) \
+  $(localverfcnfiledir) \
+  $(localoctfiledir) \
+  $(localapioctfiledir) \
+  $(localveroctfiledir) \
+  $(localarchlibdir) \
+  $(localapiarchlibdir) \
+  $(localverarchlibdir)
+
+installdirs-local:
+	$(MKDIR_P) $(addprefix $(DESTDIR), $(DIRS_TO_MAKE))
+.PHONY: installdirs-local
+
+install-data-local: installdirs-local install-extras
+.PHONY: install-data-local
+
+install-exec-hook: make-version-links
+.PHONY: install-exec-hook
+
+uninstall-local: remove-version-links uninstall-extras
+.PHONY: uninstall-local
+
+install-extras:
+	$(MKDIR_P) $(DESTDIR)$(octetcdir)
+	$(INSTALL_DATA) $(srcdir)/NEWS $(DESTDIR)$(octetcdir)/NEWS
+.PHONY: install-extras
+
+uninstall-extras:
+	rm -f $(DESTDIR)$(octetcdir)/NEWS
+.PHONY: uninstall-extras
+
+make-version-links:
+	cd $(DESTDIR)$(bindir) && \
+	for f in $(basename $(bin_SCRIPTS)); do \
+	  mv $$f$(EXEEXT) $$f-$(version)$(EXEEXT) && \
+	    $(LN_S) $$f-$(version)$(EXEEXT) $$f$(EXEEXT); \
+	done
+.PHONY: make-version-links
+
+remove-version-links:
+	for f in $(basename $(bin_SCRIPTS)); do \
+	  rm -f $(DESTDIR)$(bindir)/$$f-$(version)$(EXEEXT); \
+	done
+.PHONY: remove-version-links
+
+# install install-strip ::
+# 	$(MKDIR_P) $(addprefix $(DESTDIR), $(DIRS_TO_MAKE))
+# 	rm -f $(DESTDIR)$(bindir)/octave-bug$(SCRIPTS_EXE_SUFFIX)
+# 	$(INSTALL_SCRIPT) octave-bug$(SCRIPTS_EXE_SUFFIX) \
+# 	    $(DESTDIR)$(bindir)/octave-bug-$(version)$(SCRIPTS_EXE_SUFFIX)
+# 	(cd $(DESTDIR)$(bindir); $(LN_S) octave-bug-$(version)$(SCRIPTS_EXE_SUFFIX) \
+# 	    $(DESTDIR)$(bindir)/octave-bug$(SCRIPTS_EXE_SUFFIX))
+# 	rm -f $(DESTDIR)$(bindir)/octave-config$(SCRIPTS_EXE_SUFFIX)
+# 	$(INSTALL_SCRIPT) \
+# 	  octave-config$(SCRIPTS_EXE_SUFFIX) $(DESTDIR)$(bindir)/octave-config-$(version)$(SCRIPTS_EXE_SUFFIX)
+# 	(cd $(DESTDIR)$(bindir); $(LN_S) octave-config-$(version)$(SCRIPTS_EXE_SUFFIX) \
+# 	    $(DESTDIR)$(bindir)/octave-config$(SCRIPTS_EXE_SUFFIX))
+# 	rm -f $(DESTDIR)$(bindir)/mkoctfile$(SCRIPTS_EXE_SUFFIX)
+# 	$(INSTALL_SCRIPT) mkoctfile$(SCRIPTS_EXE_SUFFIX) \
+# 	    $(DESTDIR)$(bindir)/mkoctfile-$(version)$(SCRIPTS_EXE_SUFFIX)
+# 	(cd $(DESTDIR)$(bindir); $(LN_S) mkoctfile-$(version)$(SCRIPTS_EXE_SUFFIX) \
+# 	    $(DESTDIR)$(bindir)/mkoctfile$(SCRIPTS_EXE_SUFFIX))
+# 	$(INSTALL_DATA) config.h $(DESTDIR)$(octincludedir)/octave/config.h
+
+# uninstall::
+# 	rm -f $(DESTDIR)$(bindir)/octave-bug$(SCRIPTS_EXE_SUFFIX)
+# 	rm -f $(DESTDIR)$(bindir)/octave-bug-$(version)$(SCRIPTS_EXE_SUFFIX)
+# 	rm -f $(DESTDIR)$(bindir)/octave-config$(SCRIPTS_EXE_SUFFIX)
+# 	rm -f $(DESTDIR)$(bindir)/octave-config-$(version)$(SCRIPTS_EXE_SUFFIX)
+# 	rm -f $(DESTDIR)$(bindir)/mkoctfile$(SCRIPTS_EXE_SUFFIX)
+# 	rm -f $(DESTDIR)$(bindir)/mkoctfile-$(version)$(SCRIPTS_EXE_SUFFIX)
+# 	rm -f $(DESTDIR)$(octincludedir)/octave/config.h
+# 	rm -f $(DESTDIR)$(octetcdir)/NEWS
+
+# maintainer-clean::
+# 	@echo ""
+# 	@echo "************************************************************"
+# 	@echo "*                                                          *"
+# 	@echo "* This command is intended for maintainers to use; it      *"
+# 	@echo "* deletes files that may require special tools to rebuild. *"
+# 	@echo "*                                                          *"
+# 	@echo "************************************************************"
+# 	@echo ""
+
+# maintainer-clean distclean::
+# 	rm -f Makefile
+# 	rm -f config.cache config.h config.log config.status
+# 	rm -rf autom4te.cache
+# 	rm -f $(SHELL_FILES)
+# 	rm -f mkoctfile.cc octave-config.cc octave-bug.cc
+# 	rm -f unistd.h
+
+# maintainer-clean::
+# 	rm -f configure config.h.in BUGS INSTALL.OCTAVE
+
+# maintainer-clean distclean clean::
+# 	rm -f mkoctfile$(EXEEXT) octave-config$(EXEEXT) octave-bug$(EXEEXT)
+# 	rm -f mkoctfile.o octave-config.o octave-bug.o
+
+.NOTPARALLEL:
rename from aclocal.m4
rename to acinclude.m4
--- a/aclocal.m4
+++ b/acinclude.m4
@@ -569,7 +569,7 @@
   AC_PROG_LEX
   case "$LEX" in
     flex*)
-      LFLAGS="-t -I"
+      LFLAGS="-I"
       AC_MSG_RESULT([defining LFLAGS to be $LFLAGS])
       LEXLIB=
     ;;
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,9 +2,88 @@
 # autogen.sh
 # Run this to generate all the initial makefiles, etc.
 
-# copied from the accelerated glx project
+set -e
+
+# Originally copied from the accelerated glx project.
+
+acincludeflags="-I m4"
+
+echo "calling libtoolize..."
+
+(libtoolize --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+        echo "You must have libtoolize (part of the libtool package)"
+	echo "installed to build Octave.  Download the appropriate"
+	echo "package for your distribution, or get the source"
+	echo "tarball at ftp://ftp.gnu.org/pub/gnu/"
+        exit 1
+}
+
+libtoolize
+
+echo "calling aclocal..."
+
+(aclocal --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+        echo "You must have aclocal (part of the automake package)"
+	echo "installed to build Octave.  Download the appropriate"
+	echo "package for your distribution, or get the source"
+	echo "tarball at ftp://ftp.gnu.org/pub/gnu/"
+        exit 1
+}
+
+aclocal $acincludeflags
+
+echo "generating source lists for liboctave/Makefile..."
+
+(cd liboctave; ./config-ops.sh)
+
+echo "generating doc/interpreter/images.mk..."
+
+(cd doc/interpreter; ./config-images.sh)
 
-echo "calling autoconf and autoheader..."
+echo "generating src/DLD-FUNCTIONS/module.mk..."
+
+(cd src/DLD-FUNCTIONS; ./config-module.sh)
+
+echo "calling autoheader..."
+
+(autoheader --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+        echo "You must have autoheader (part of the autoconf package)"
+	echo "installed to build Octave.  Download the appropriate"
+	echo "package for your distribution, or get the source"
+	echo "tarball at ftp://ftp.gnu.org/pub/gnu/"
+        exit 1
+}
+
+autoheader $acincludeflags --force
+
+echo "calling automake..."
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+        echo "You must have automake installed to build Octave."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        exit 1
+}
+
+automake --warnings=no-portability --add-missing \
+  Makefile \
+  doc/Makefile \
+  doc/faq/Makefile \
+  doc/interpreter/Makefile \
+  doc/liboctave/Makefile \
+  doc/refcard/Makefile \
+  examples/Makefile \
+  libcruft/Makefile \
+  liboctave/Makefile \
+  scripts/Makefile \
+  src/Makefile \
+  test/Makefile
+
+echo "calling autoconf..."
 
 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
 	echo
@@ -14,28 +93,4 @@
         exit 1
 }
 
-(autoheader --version) < /dev/null > /dev/null 2>&1 || {
-	echo
-        echo "You must have autoheader installed to build Octave."
-        echo "Download the appropriate package for your distribution,"
-        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-        exit 1
-}
-
-for i in `find . -name configure.ac -print`; do (
-    dir=`dirname $i`
-    cd $dir
-    pwd
-    if [ -f skip-autoconf ]; then
-      echo "skipping autoconf in $dir"
-    else
-      autoconf --force
-    fi
-    if [ -f skip-autoheader ]; then
-      echo "skipping autoheader in $dir"
-    else
-      autoheader --force
-    fi
-); done
-
-echo done
+autoconf $acincludeflags --force
new file mode 100644
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,676 @@
+SHELL = /bin/sh
+
+AWK = @AWK@
+export AWK
+
+SED = @SED@
+export SED
+
+FIND = @FIND@
+export FIND
+
+PERL = @PERL@
+export PERL
+
+PYTHON = @PYTHON@
+
+GNUPLOT = @GNUPLOT@
+
+DESKTOP_FILE_INSTALL = @DESKTOP_FILE_INSTALL@
+
+version = @OCTAVE_VERSION@
+api_version = @OCTAVE_API_VERSION@
+
+## AM_LIBTOOLFLAGS = --silent
+
+#### Start of system configuration section. ####
+
+EXEEXT = @EXEEXT@
+
+BUILD_EXEEXT = @BUILD_EXEEXT@
+
+LEX = @LEX@
+AM_LFLAGS = @LFLAGS@
+LEXLIB = @LEXLIB@
+
+YACC = @YACC@
+AM_YFLAGS = -dv
+
+GPERF = @GPERF@
+
+AR = @AR@
+ARFLAGS = @ARFLAGS@ 
+
+TEMPLATE_AR = @TEMPLATE_AR@
+TEMPLATE_ARFLAGS = @TEMPLATE_ARFLAGS@
+
+RANLIB = @RANLIB@
+
+LN_S = @LN_S@
+
+MAKEINFO = @MAKEINFO@
+TEXI2DVI = @TEXI2DVI@
+TEXI2PDF = @TEXI2PDF@
+
+GHOSTSCRIPT = @GHOSTSCRIPT@
+
+DEFAULT_PAGER = @DEFAULT_PAGER@
+
+ENABLE_DYNAMIC_LINKING = @ENABLE_DYNAMIC_LINKING@
+
+SHLEXT = @SHLEXT@
+SHLEXT_VER = @SHLEXT_VER@
+SHLLIB = @SHLLIB@
+SHLLIB_VER = @SHLLIB_VER@
+SHLBIN = @SHLBIN@
+SHLBIN_VER = @SHLBIN_VER@
+SHLLINKEXT=
+
+LIBEXT = a
+LIBPRE = @LIBPRE@
+SHLPRE = @SHLPRE@
+SHLLIBPRE = @SHLLIBPRE@
+SHLBINPRE = @SHLBINPRE@
+
+# Fortran compiler flags.
+
+FC = @FC@
+F77 = @F77@
+AM_FFLAGS = @FFLAGS@
+FPICFLAG = @FPICFLAG@
+ALL_FFLAGS = $(FFLAGS)
+F77_FLOAT_STORE_FLAG = @F77_FLOAT_STORE_FLAG@
+
+F77_TOLOWER=@F77_TOLOWER@
+F77_APPEND_UNDERSCORE=@F77_TOLOWER@
+F77_APPEND_EXTRA_UNDERSCORE=@F77_TOLOWER@
+
+X11_INCFLAGS = @X11_INCFLAGS@
+X11_LIBS = @X11_LIBS@
+
+CARBON_LIBS = @CARBON_LIBS@
+
+MAGICK_CPPFLAGS = @MAGICK_CPPFLAGS@
+MAGICK_LDFLAGS = @MAGICK_LDFLAGS@
+MAGICK_LIBS = @MAGICK_LIBS@
+
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+
+LIBFLAGS = -L$(TOPDIR)
+
+DEFS = @DEFS@
+
+UGLY_DEFS = @UGLY_DEFS@
+
+CC = @CC@
+CC_VERSION = @CC_VERSION@
+AM_CFLAGS = @CFLAGS@
+CPICFLAG = @CPICFLAG@
+XTRA_CFLAGS = @XTRA_CFLAGS@
+WARN_CFLAGS = @WARN_CFLAGS@
+ALL_CFLAGS = $(INCFLAGS) $(DLL_CDEFS) $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS) $(PTHREAD_CFLAGS)
+BUG_CFLAGS = $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
+
+BUILD_CC = @BUILD_CC@
+BUILD_CFLAGS = @BUILD_CFLAGS@
+
+DEPEND_FLAGS = @DEPEND_FLAGS@
+DEPEND_EXTRA_SED_PATTERN = @DEPEND_EXTRA_SED_PATTERN@
+INCLUDE_DEPS = @INCLUDE_DEPS@
+# ifeq ($(INCLUDE_DEPS),false)
+#   omit_deps = true;
+# endif
+
+GRAPHICS_CFLAGS = @GRAPHICS_CFLAGS@
+
+CXX = @CXX@
+CXX_VERSION = @CXX_VERSION@
+CXXCPP = @CXXCPP@
+CONFIGURE_CXXFLAGS = @CXXFLAGS@
+CXXPICFLAG = @CXXPICFLAG@
+XTRA_CXXFLAGS = @XTRA_CXXFLAGS@
+WARN_CXXFLAGS = @WARN_CXXFLAGS@
+AM_CXXFLAGS = $(CONFIGURE_CXXFLAGS) \
+  $(INCFLAGS) $(DLL_CXXDEFS) $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS) $(PTHREAD_CFLAGS)
+BUG_CXXFLAGS = $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS)
+
+BUILD_CXX = @BUILD_CXX@
+BUILD_CXXFLAGS = @BUILD_CXXFLAGS@
+
+NO_UNDEFINED_LDFLAG = @NO_UNDEFINED_LDFLAG@
+
+LD_CXX = @LD_CXX@
+LD_STATIC_FLAG = @LD_STATIC_FLAG@
+#ALL_LDFLAGS = $(LIBFLAGS) $(LD_STATIC_FLAG) $(CPICFLAG) $(LDFLAGS)
+
+BUILD_LDFLAGS = @BUILD_LDFLAGS@
+
+SH_LD = @SH_LD@
+SH_LDFLAGS = @SH_LDFLAGS@
+
+DL_LD = @DL_LD@
+DL_LDFLAGS = @DL_LDFLAGS@
+
+SONAME_FLAGS = @SONAME_FLAGS@
+
+RDYNAMIC_FLAG = @RDYNAMIC_FLAG@
+
+RLD_FLAG = @RLD_FLAG@
+
+FLIBS = @FLIBS@
+
+LIBGLOB = @LIBGLOB@
+LIBOCTINTERP = @LIBOCTINTERP@
+LIBOCTAVE = @LIBOCTAVE@
+LIBCRUFT = @LIBCRUFT@
+
+FT2_LIBS = @FT2_LIBS@
+
+HDF5_CPPFLAGS = @HDF5_CPPFLAGS@
+HDF5_LDFLAGS = @HDF5_LDFLAGS@
+HDF5_LIBS = @HDF5_LIBS@
+
+Z_CPPFLAGS = @Z_CPPFLAGS@
+Z_LDFLAGS = @Z_LDFLAGS@
+Z_LIBS = @Z_LIBS@
+
+GRAPHICS_LIBS = @GRAPHICS_LIBS@
+
+QHULL_CPPFLAGS = @QHULL_CPPFLAGS@
+QHULL_LDFLAGS = @QHULL_LDFLAGS@
+QHULL_LIBS = @QHULL_LIBS@
+
+REGEX_LIBS = @REGEX_LIBS@
+
+LAPACK_LIBS = @LAPACK_LIBS@
+BLAS_LIBS = @BLAS_LIBS@
+
+FFTW3_CPPFLAGS = @FFTW3_CPPFLAGS@
+FFTW3_LDFLAGS = @FFTW3_LDFLAGS@
+FFTW3_LIBS = @FFTW3_LIBS@
+
+FFTW3F_CPPFLAGS = @FFTW3F_CPPFLAGS@
+FFTW3F_LDFLAGS = @FFTW3F_LDFLAGS@
+FFTW3F_LIBS = @FFTW3F_LIBS@
+
+GLPK_CPPFLAGS = @GLPK_CPPFLAGS@
+GLPK_LDFLAGS = @GLPK_LDFLAGS@
+GLPK_LIBS = @GLPK_LIBS@
+
+CURL_CPPFLAGS = @CURL_CPPFLAGS@
+CURL_LDFLAGS = @CURL_LDFLAGS@
+CURL_LIBS = @CURL_LIBS@
+
+AMD_CPPFLAGS = @AMD_CPPFLAGS@
+AMD_LDFLAGS = @AMD_LDFLAGS@
+AMD_LIBS = @AMD_LIBS@
+
+CAMD_CPPFLAGS = @CAMD_CPPFLAGS@
+CAMD_LDFLAGS = @CAMD_LDFLAGS@
+CAMD_LIBS = @CAMD_LIBS@
+
+COLAMD_CPPFLAGS = @COLAMD_CPPFLAGS@
+COLAMD_LDFLAGS = @COLAMD_LDFLAGS@
+COLAMD_LIBS = @COLAMD_LIBS@
+
+CCOLAMD_CPPFLAGS = @CCOLAMD_CPPFLAGS@
+CCOLAMD_LDFLAGS = @CCOLAMD_LDFLAGS@
+CCOLAMD_LIBS = @CCOLAMD_LIBS@
+
+CHOLMOD_CPPFLAGS = @CHOLMOD_CPPFLAGS@
+CHOLMOD_LDFLAGS = @CHOLMOD_LDFLAGS@
+CHOLMOD_LIBS = @CHOLMOD_LIBS@
+
+CXSPARSE_CPPFLAGS = @CXSPARSE_CPPFLAGS@
+CXSPARSE_LDFLAGS = @CXSPARSE_LDFLAGS@
+CXSPARSE_LIBS = @CXSPARSE_LIBS@
+
+UMFPACK_CPPFLAGS = @UMFPACK_CPPFLAGS@
+UMFPACK_LDFLAGS = @UMFPACK_LDFLAGS@
+UMFPACK_LIBS = @UMFPACK_LIBS@
+
+OPENGL_LIBS = @OPENGL_LIBS@
+
+QRUPDATE_CPPFLAGS = @QRUPDATE_CPPFLAGS@
+QRUPDATE_LDFLAGS = @QRUPDATE_LDFLAGS@
+QRUPDATE_LIBS = @QRUPDATE_LIBS@
+
+READLINE_LIBS = @READLINE_LIBS@
+TERM_LIBS = @TERM_LIBS@
+
+ARPACK_CPPFLAGS = @ARPACK_CPPFLAGS@
+ARPACK_LDFLAGS = @ARPACK_LDFLAGS@
+ARPACK_LIBS = @ARPACK_LIBS@
+
+DL_LIBS = @DL_LIBS@
+LIBS = @LIBS@
+
+ALL_CPPFLAGS = $(CPPFLAGS) $(HDF5_CPPFLAGS) $(Z_CPPFLAGS)
+
+SPARSE_XCPPFLAGS = \
+  $(CHOLMOD_CPPFLAGS) $(UMFPACK_CPPFLAGS) \
+  $(AMD_CPPFLAGS) $(CAMD_CPPFLAGS) $(COLAMD_CPPFLAGS) \
+  $(CCOLAMD_CPPFLAGS) $(CXSPARSE_CPPFLAGS)
+
+SPARSE_XLDFLAGS = \
+  $(CHOLMOD_LDFLAGS) $(UMFPACK_LDFLAGS) \
+  $(AMD_LDFLAGS) $(CAMD_LDFLAGS) $(COLAMD_LDFLAGS) \
+  $(CCOLAMD_LDFLAGS) $(CXSPARSE_LDFLAGS)
+
+## Order matters, at least on some systems (Cygwin, for example).
+SPARSE_XLIBS = \
+    $(CHOLMOD_LIBS) $(UMFPACK_LIBS) \
+    $(AMD_LIBS) $(CAMD_LIBS) $(COLAMD_LIBS) \
+    $(CCOLAMD_LIBS) $(CXSPARSE_LIBS)
+
+FFTW_XCPPFLAGS = $(FFTW3_CPPFLAGS) $(FFTW3F_CPPFLAGS)
+
+FFTW_XLDFLAGS = $(FFTW3_LDFLAGS) $(FFTW3F_LDFLAGS)
+
+FFTW_XLIBS = $(FFTW3_LIBS) $(FFTW3F_LIBS)
+
+USE_64_BIT_IDX_T = @USE_64_BIT_IDX_T@
+
+TEXINFO_COLAMD = @TEXINFO_COLAMD@
+TEXINFO_CHOLMOD = @TEXINFO_CHOLMOD@
+TEXINFO_UMFPACK = @TEXINFO_UMFPACK@
+TEXINFO_QHULL = @TEXINFO_QHULL@
+
+# The arguments passed to configure.
+config_opts = @config_opts@
+
+CONFIG_SUBDIRS = @subdirs@
+
+# ==================== Where To Install Things ====================
+
+# The default location for installation.  Everything is placed in
+# subdirectories of this directory.  The default values for many of
+# the variables below are expressed in terms of this one, so you may
+# not need to change them.  This defaults to /usr/local.
+prefix = @prefix@
+
+# Like `prefix', but used for architecture-specific files.
+exec_prefix = @exec_prefix@
+
+# Where to install Octave and other binaries that people will want to
+# run directly.
+bindir = @bindir@
+
+# Normally the directory for installing executables that system
+# administrators run.  This is the same as libexecdir on Cygwin systems.
+sbindir = @sbindir@
+
+# The root of the directory tree for read-only
+# architecture-independent data files.
+datarootdir = @datarootdir@
+
+# Where to install architecture-independent data files.  ${fcnfiledir}
+# and ${localfcnfiledir} are subdirectories of this.
+datadir = @datadir@
+
+libdir = @libdir@
+
+# Where to install and expect extra files like NEWS and doc-cache.
+octetcdir = @octetcdir@
+
+# Where to install and expect libraries like libcruft.a, liboctave.a,
+# and other architecture-dependent data.
+octlibdir = @octlibdir@
+
+# Where to install and expect executable programs to be run by Octave
+# rather than directly by users.
+libexecdir = @libexecdir@
+
+# The prefix for Octave's include file directory.  The default is
+# ${prefix}/include
+includedir = @includedir@
+
+# Where to install Octave's man pages, and what extension they should
+# have.  The default is ${prefix}/man/man1
+mandir = @mandir@
+man1dir = @man1dir@
+man1ext = @man1ext@
+
+# The full path to the default doc cache file.
+doc_cache_file = @doc_cache_file@
+
+# Where to install and expect the info files describing Octave..
+infodir = @infodir@
+
+# The full path to the default info file.
+infofile = @infofile@
+
+# ==================== Octave-specific directories ====================
+
+# These variables hold the values specific to Octave.  They are
+# based on the values of the standard Make variables above.
+
+# What is the path separation character
+sepchar = @sepchar@
+
+# Where to install Octave's include files.  The default is
+# ${includedir}/octave-${version}/octave
+octincludedir = @octincludedir@
+
+# Where to install the function file distributed with
+# Octave.  This includes the Octave version, so that the
+# function files for different versions of Octave will install
+# themselves in separate directories.
+fcnfiledir = @fcnfiledir@
+
+# Directories Octave should search for function files specific
+# to this site (i.e. customizations), before consulting
+# ${fcnfiledir}.  This should be a colon-separated list of
+# directories.
+localfcnfiledir = @localfcnfiledir@
+localapifcnfiledir = @localapifcnfiledir@
+localverfcnfiledir = @localverfcnfiledir@
+
+# Where to put executables to be run by Octave rather than
+# the user.  This path usually includes the Octave version
+# and configuration name, so that multiple configurations
+# for multiple versions of Octave may be installed at once.
+archlibdir = @archlibdir@
+
+# Where to put executables to be run by Octave rather than by the
+# user that are specific to this site.
+localarchlibdir = @localarchlibdir@
+localapiarchlibdir = @localapiarchlibdir@
+localverarchlibdir = @localverarchlibdir@
+
+# Where to put object files that will by dynamically loaded.
+# This path usually includes the Octave version and configuration
+# name, so that multiple configurations for multiple versions of
+# Octave may be installed at once. 
+octfiledir = @octfiledir@
+
+# Directories Octave should search for object files that will be
+# dynamically loaded and that are specific to this site
+# (i.e. customizations), before consulting ${octfiledir}.  This should
+# be a colon-separated list of directories.
+localoctfiledir = @localoctfiledir@
+localapioctfiledir = @localapioctfiledir@
+localveroctfiledir = @localveroctfiledir@
+
+# Where Octave will search to find image files.
+imagedir = @imagedir@
+
+# The type of computer we are running on.
+canonical_host_type = @canonical_host_type@
+
+# Where Octave will look for startup files
+startupfiledir = ${fcnfiledir}/startup
+localstartupfiledir = ${localfcnfiledir}/startup
+
+# LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PATH, ...
+library_path_var = @library_path_var@
+
+# The separator used for elements of the LD_PRELOAD variable (might be
+# a space, so protect with $(null))
+null =
+ldpreloadsep = $(null)@ldpreloadsep@$(null)
+
+NO_OCT_FILE_STRIP = @NO_OCT_FILE_STRIP@
+
+# The following pattern rules and the substitution functions require
+# GNU make.  If you don't have it, get it!
+
+define simple_move_if_change_rule
+if [ -s $@-t ]; then \
+  $(top_srcdir)/move-if-change $@-t $@; \
+else \
+  echo "$@-t is empty!" 1>&2; \
+  rm -f $@-t; \
+  exit 1; \
+fi
+endef
+
+# Yes, the second sed command near the end is needed, to avoid limits
+# in command lengths for some versions of sed.  UGLY_DEFS is often
+# quite large, so it makes sense to split this command there.
+
+define do_subst_config_vals
+echo "making $@ from $<"
+$(SED) < $< \
+  -e "s|%NO_OCT_FILE_STRIP%|${NO_OCT_FILE_STRIP}|" \
+  -e "s|%OCTAVE_BINDIR%|\"${bindir}\"|" \
+  -e "s|%OCTAVE_CONF_ALL_CFLAGS%|\"${ALL_CFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_ALL_CXXFLAGS%|\"${ALL_CXXFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_ALL_FFLAGS%|\"${ALL_FFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_ALL_LDFLAGS%|\"${ALL_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_AMD_CPPFLAGS%|\"${AMD_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_AMD_LDFLAGS%|\"${AMD_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_AMD_LIBS%|\"${AMD_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_AR%|\"${AR}\"|" \
+  -e "s|%OCTAVE_CONF_ARFLAGS%|\"${ARFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_ARPACK_CPPFLAGS%|\"${ARPACK_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_ARPACK_LDFLAGS%|\"${ARPACK_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_ARPACK_LIBS%|\"${ARPACK_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_BLAS_LIBS%|\"${BLAS_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_CAMD_CPPFLAGS%|\"${CAMD_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CAMD_LDFLAGS%|\"${CAMD_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CAMD_LIBS%|\"${CAMD_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_CANONICAL_HOST_TYPE%|\"${canonical_host_type}\"|" \
+  -e "s|%OCTAVE_CONF_CARBON_LIBS%|\"${CARBON_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_CC%|\"${CC}\"|" \
+  -e "s|%OCTAVE_CONF_CC_VERSION%|\"${CC_VERSION}\"|" \
+  -e "s|%OCTAVE_CONF_CCOLAMD_CPPFLAGS%|\"${CCOLAMD_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CCOLAMD_LDFLAGS%|\"${CCOLAMD_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CCOLAMD_LIBS%|\"${CCOLAMD_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_CFLAGS%|\"${CFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CHOLMOD_CPPFLAGS%|\"${CHOLMOD_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CHOLMOD_LDFLAGS%|\"${CHOLMOD_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CHOLMOD_LIBS%|\"${CHOLMOD_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_COLAMD_CPPFLAGS%|\"${COLAMD_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_COLAMD_LDFLAGS%|\"${COLAMD_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_COLAMD_LIBS%|\"${COLAMD_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_CPICFLAG%|\"${CPICFLAG}\"|" \
+  -e "s|%OCTAVE_CONF_CPPFLAGS%|\"${CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CURL_CPPFLAGS%|\"${CURL_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CURL_LDFLAGS%|\"${CURL_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CURL_LIBS%|\"${CURL_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_CXSPARSE_CPPFLAGS%|\"${CXSPARSE_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CXSPARSE_LDFLAGS%|\"${CXSPARSE_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CXSPARSE_LIBS%|\"${CXSPARSE_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_CXX%|\"${CXX}\"|" \
+  -e "s|%OCTAVE_CONF_CXXCPP%|\"${CXXCPP}\"|" \
+  -e "s|%OCTAVE_CONF_CXXFLAGS%|\"${CXXFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_CXXPICFLAG%|\"${CXXPICFLAG}\"|" \
+  -e "s|%OCTAVE_CONF_CXX_VERSION%|\"${CXX_VERSION}\"|" \
+  -e "s|%OCTAVE_CONF_DEFAULT_PAGER%|\"${DEFAULT_PAGER}\"|" \
+  -e "s|%OCTAVE_CONF_DEPEND_FLAGS%|\"${DEPEND_FLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%|\"${DEPEND_EXTRA_SED_PATTERN}\"|" \
+  -e "s|%OCTAVE_CONF_DL_LD%|\"${DL_LD}\"|" \
+  -e "s|%OCTAVE_CONF_DL_LDFLAGS%|\"${DL_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_DL_LIBS%|\"${DL_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_EXEEXT%|\"${EXEEXT}\"|" \
+  -e "s|%OCTAVE_CONF_F77%|\"${F77}\"|" \
+  -e "s|%OCTAVE_CONF_F77_FLOAT_STORE_FLAG%|\"${F77_FLOAT_STORE_FLAG}\"|" \
+  -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \
+  -e "s|%OCTAVE_CONF_FFLAGS%|\"${FFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_FFTW3_CPPFLAGS%|\"${FFTW3_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_FFTW3_LDFLAGS%|\"${FFTW3_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_FFTW3_LIBS%|\"${FFTW3_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_FFTW3F_CPPFLAGS%|\"${FFTW3F_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_FFTW3F_LDFLAGS%|\"${FFTW3F_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_FFTW3F_LIBS%|\"${FFTW3F_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_FLIBS%|\"${FLIBS}\"|" \
+  -e "s|%OCTAVE_CONF_FPICFLAG%|\"${FPICFLAG}\"|" \
+  -e "s|%OCTAVE_CONF_FT2_LIBS%|\"${FT2_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_GLPK_CPPFLAGS%|\"${GLPK_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_GLPK_LDFLAGS%|\"${GLPK_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_GLPK_LIBS%|\"${GLPK_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_GNUPLOT%|\"${GNUPLOT}\"|" \
+  -e "s|%OCTAVE_CONF_GRAPHICS_LIBS%|\"${GRAPHICS_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_HDF5_CPPFLAGS%|\"${HDF5_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_HDF5_LDFLAGS%|\"${HDF5_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_HDF5_LIBS%|\"${HDF5_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_INCFLAGS%|\"${INCFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_INCLUDEDIR%|\"${includedir}\"|" \
+  -e "s|%OCTAVE_CONF_LAPACK_LIBS%|\"${LAPACK_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_LD_CXX%|\"${LD_CXX}\"|" \
+  -e "s|%OCTAVE_CONF_LDFLAGS%|\"${LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_LD_STATIC_FLAG%|\"${LD_STATIC_FLAG}\"|" \
+  -e "s|%OCTAVE_CONF_LEX%|\"${LEX}\"|" \
+  -e "s|%OCTAVE_CONF_LEXLIB%|\"${LEXLIB}\"|" \
+  -e "s|%OCTAVE_CONF_LFLAGS%|\"${LFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_LIBCRUFT%|\"${LIBCRUFT}\"|" \
+  -e "s|%OCTAVE_CONF_LIBDIR%|\"${libdir}\"|" \
+  -e "s|%OCTAVE_CONF_LIBEXT%|\"${LIBEXT}\"|" \
+  -e "s|%OCTAVE_CONF_LIBFLAGS%|\"${LIBFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_LIBGLOB%|\"${LIBGLOB}\"|" \
+  -e "s|%OCTAVE_CONF_LIBOCTAVE%|\"${LIBOCTAVE}\"|" \
+  -e "s|%OCTAVE_CONF_LIBOCTINTERP%|\"${LIBOCTINTERP}\"|" \
+  -e "s|%OCTAVE_CONF_LIBS%|\"${LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_LN_S%|\"${LN_S}\"|" \
+  -e "s|%OCTAVE_CONF_MAGICK_CPPFLAGS%|\"${MAGICK_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_MAGICK_LDFLAGS%|\"${MAGICK_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_MAGICK_LIBS%|\"${MAGICK_LIBS}\"|" \
+  -e 's|%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%|\"@MKOCTFILE_DL_LDFLAGS@\"|' \
+  -e "s|%OCTAVE_CONF_OCTINCLUDEDIR%|\"${octincludedir}\"|" \
+  -e "s|%OCTAVE_CONF_OCTLIBDIR%|\"${octlibdir}\"|" \
+  -e "s|%OCTAVE_CONF_OPENGL_LIBS%|\"${OPENGL_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_PREFIX%|\"${prefix}\"|" \
+  -e "s|%OCTAVE_CONF_PTHREAD_CFLAGS%|\"${PTHREAD_CFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_PTHREAD_LIBS%|\"${PTHREAD_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_QHULL_CPPFLAGS%|\"${QHULL_CPPFLAGSS}\"|" \
+  -e "s|%OCTAVE_CONF_QHULL_LDFLAGS%|\"${QHULL_LDFLAGSS}\"|" \
+  -e "s|%OCTAVE_CONF_QHULL_LIBS%|\"${QHULL_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_QRUPDATE_CPPFLAGS%|\"${QRUPDATE_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_QRUPDATE_LDFLAGS%|\"${QRUPDATE_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_QRUPDATE_LIBS%|\"${QRUPDATE_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_RANLIB%|\"${RANLIB}\"|" \
+  -e "s|%OCTAVE_CONF_RDYNAMIC_FLAG%|\"${RDYNAMIC_FLAG}\"|" \
+  -e "s|%OCTAVE_CONF_READLINE_LIBS%|\"${READLINE_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_REGEX_LIBS%|\"${REGEX_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_RLD_FLAG%|\"${RLD_FLAG}\"|" \
+  -e "s|%OCTAVE_CONF_SED%|\"${SED}\"|" \
+  -e "s|%OCTAVE_CONF_SHARED_LIBS%|\"${SHARED_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_SHLEXT%|\"${SHLEXT}\"|" \
+  -e "s|%OCTAVE_CONF_SHLLINKEXT%|\"${SHLLINKEXT}\"|" \
+  -e "s|%OCTAVE_CONF_SHLEXT_VER%|\"${SHLEXT_VER}\"|" \
+  -e "s|%OCTAVE_CONF_SH_LD%|\"${SH_LD}\"|" \
+  -e "s|%OCTAVE_CONF_SH_LDFLAGS%|\"${SH_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_SONAME_FLAGS%|\"${SONAME_FLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_STATIC_LIBS%|\"${STATIC_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_TERM_LIBS%|\"${TERM_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_UGLY_DEFS%|\"${UGLY_DEFS}\"|" \
+  -e "s|%OCTAVE_CONF_UMFPACK_CPPFLAGS%|\"${UMFPACK_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_UMFPACK_LDFLAGS%|\"${UMFPACK_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_UMFPACK_LIBS%|\"${UMFPACK_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_USE_64_BIT_IDX_T%|\"${USE_64_BIT_IDX_T}\"|" \
+  -e "s|%OCTAVE_CONF_VERSION%|\"${version}\"|" \
+  -e "s|%OCTAVE_CONF_ENABLE_DYNAMIC_LINKING%|\"${ENABLE_DYNAMIC_LINKING}\"|" \
+  -e "s|%OCTAVE_CONF_X11_INCFLAGS%|\"${X11_INCFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_X11_LIBS%|\"${X11_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_XTRA_CFLAGS%|\"${XTRA_CFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_XTRA_CXXFLAGS%|\"${XTRA_CXXFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_YACC%|\"${YACC}\"|" \
+  -e "s|%OCTAVE_CONF_YFLAGS%|\"${YFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_Z_CPPFLAGS%|\"${Z_CPPFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_Z_LDFLAGS%|\"${Z_LDFLAGS}\"|" \
+  -e "s|%OCTAVE_CONF_Z_LIBS%|\"${Z_LIBS}\"|" \
+  -e "s|%OCTAVE_CONF_config_opts%|\"${config_opts}\"|" | \
+  $(SED)  -e "s|%OCTAVE_CONF_DEFS%|\"${UGLY_DEFS}\"|" > $@-t
+$(simple_move_if_change_rule)
+endef
+
+define do_subst_default_vals
+echo "making $@ from $<"
+$(SED) < $< > $@-t \
+  -e "s|%OCTAVE_ARCHLIBDIR%|\"${archlibdir}\"|" \
+  -e "s|%OCTAVE_BINDIR%|\"${bindir}\"|" \
+  -e "s|%OCTAVE_CANONICAL_HOST_TYPE%|\"${canonical_host_type}\"|" \
+  -e "s|%OCTAVE_DATADIR%|\"${datadir}\"|" \
+  -e "s|%OCTAVE_DATAROOTDIR%|\"${datarootdir}\"|" \
+  -e "s|%OCTAVE_DEFAULT_PAGER%|\"${DEFAULT_PAGER}\"|" \
+  -e "s|%OCTAVE_DOC_CACHE_FILE%|\"${doc_cache_file}\"|" \
+  -e "s|%OCTAVE_EXEC_PREFIX%|\"${exec_prefix}\"|" \
+  -e "s|%OCTAVE_FCNFILEDIR%|\"${fcnfiledir}\"|" \
+  -e "s|%OCTAVE_IMAGEDIR%|\"${imagedir}\"|" \
+  -e "s|%OCTAVE_INCLUDEDIR%|\"${includedir}\"|" \
+  -e "s|%OCTAVE_INFODIR%|\"${infodir}\"|" \
+  -e "s|%OCTAVE_INFOFILE%|\"${infofile}\"|" \
+  -e "s|%OCTAVE_LIBDIR%|\"${libdir}\"|" \
+  -e "s|%OCTAVE_LIBEXECDIR%|\"${libexecdir}\"|" \
+  -e "s|%OCTAVE_LOCALAPIFCNFILEDIR%|\"${localapifcnfiledir}\"|" \
+  -e "s|%OCTAVE_LOCALAPIOCTFILEDIR%|\"${localapioctfiledir}\"|" \
+  -e "s|%OCTAVE_LOCALARCHLIBDIR%|\"${localarchlibdir}\"|" \
+  -e "s|%OCTAVE_LOCALFCNFILEDIR%|\"${localfcnfiledir}\"|" \
+  -e "s|%OCTAVE_LOCALOCTFILEDIR%|\"${localoctfiledir}\"|" \
+  -e "s|%OCTAVE_LOCALSTARTUPFILEDIR%|\"${localstartupfiledir}\"|" \
+  -e "s|%OCTAVE_LOCALAPIARCHLIBDIR%|\"${localapiarchlibdir}\"|" \
+  -e "s|%OCTAVE_LOCALVERARCHLIBDIR%|\"${localverarchlibdir}\"|" \
+  -e "s|%OCTAVE_LOCALVERFCNFILEDIR%|\"${localverfcnfiledir}\"|" \
+  -e "s|%OCTAVE_LOCALVEROCTFILEDIR%|\"${localveroctfiledir}\"|" \
+  -e "s|%OCTAVE_MAN1DIR%|\"${man1dir}\"|" \
+  -e "s|%OCTAVE_MAN1EXT%|\"${man1ext}\"|" \
+  -e "s|%OCTAVE_MANDIR%|\"${mandir}\"|" \
+  -e "s|%OCTAVE_OCTFILEDIR%|\"${octfiledir}\"|" \
+  -e "s|%OCTAVE_OCTETCDIR%|\"${octetcdir}\"|" \
+  -e "s|%OCTAVE_OCTINCLUDEDIR%|\"${octincludedir}\"|" \
+  -e "s|%OCTAVE_OCTLIBDIR%|\"${octlibdir}\"|" \
+  -e "s|%OCTAVE_STARTUPFILEDIR%|\"${startupfiledir}\"|" \
+  -e "s|%OCTAVE_PREFIX%|\"${prefix}\"|" \
+  -e "s|%OCTAVE_API_VERSION%|\"${api_version}\"|" \
+  -e "s|%OCTAVE_RELEASE%|\"${OCTAVE_RELEASE}\"|" \
+  -e "s|%OCTAVE_VERSION%|\"${version}\"|"
+$(simple_move_if_change_rule)
+endef
+
+define do_subst_texinfo_vals
+echo "making $@ from $<"
+$(SED) < $< \
+  -e "s|%abs_top_srcdir%|${abs_top_srcdir}|" \
+  -e "s|%top_srcdir%|${top_srcdir}|" \
+  -e "s|%OCTAVE_HOME%|${prefix}|" \
+  -e "s|%OCTAVE_VERSION%|${version}|" \
+  -e "s|%TEXINFO_COLAMD%|${TEXINFO_COLAMD}|" \
+  -e "s|%TEXINFO_CHOLMOD%|${TEXINFO_CHOLMOD}|" \
+  -e "s|%TEXINFO_UMFPACK%|${TEXINFO_UMFPACK}|" \
+  -e "s|%TEXINFO_QHULL%|${TEXINFO_QHULL}|" | \
+  $(SED) -e "s|%OCTAVE_CONF_DEFS%|\"${UGLY_DEFS}\"|" > $@-t
+$(simple_move_if_change_rule)
+endef
+
+define do_subst_script_vals
+echo "making $@ from $<"
+$(SED) < $< \
+  -e "s|%AWK%|${AWK}|g" \
+  -e "s|%FIND%|${FIND}|g" \
+  -e "s|%SED%|${SED}|g" \
+  -e "s|%library_path_var%|${library_path_var}|g" \
+  -e "s|%liboctinterp%|${SHLPRE}octinterp.${SHLEXT}|g" \
+  -e "s|%liboctave%|${SHLPRE}octave.${SHLEXT}|g" \
+  -e "s|%libcruft%|${SHLPRE}cruft.${SHLEXT}|g" \
+  -e "s|%ldpreloadsep%|${ldpreloadsep}|g" \
+  -e "s|%srcdir%|${srcdir}|" \
+  -e "s|%top_srcdir%|${top_srcdir}|" \
+  -e "s|%abs_top_srcdir%|${abs_top_srcdir}|" \
+  -e "s|%builddir%|$(shell pwd)|" > $@-t
+$(simple_move_if_change_rule)
+endef
+
+define do_script_install
+$(top_srcdir)/mkinstalldirs $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)
+for f in $(FCN_FILES); do \
+  fbase=`basename $$f`; \
+  rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$fbase; \
+  $(INSTALL_DATA) $$f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$fbase; \
+done
+$(top_srcdir)/mkpkgadd $(DESTDIR)$(fcnfiledir)/$(script_sub_dir) > $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t
+if [ -n "`cat $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t`" ]; then \
+  $(INSTALL_DATA) $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD ; \
+else \
+  rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD.t ; \
+fi
+endef
+
+define do_script_uninstall
+for f in $(FCN_FILES_NO_DIR); \
+  do rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$f; \
+done
+rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/PKG_ADD
+-rmdir $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)
+endef
--- a/configure.ac
+++ b/configure.ac
@@ -29,11 +29,24 @@
 EXTERN_CFLAGS="$CFLAGS"
 EXTERN_CXXFLAGS="$CXXFLAGS"
 
-AC_INIT
+AC_INIT([GNU Octave], [3.3.50+], [bug@octave.org], [octave], [http://www.octave.org])
+
+dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
+OCTAVE_VERSION="$PACKAGE_VERSION"
+OCTAVE_API_VERSION="api-v38+"
+OCTAVE_RELEASE_DATE="2009-09-12"
+OCTAVE_COPYRIGHT="Copyright (C) 2009 John W. Eaton and others."
+AC_SUBST(OCTAVE_VERSION)
+AC_SUBST(OCTAVE_API_VERSION)
+AC_SUBST(OCTAVE_RELEASE_DATE)
+AC_SUBST(OCTAVE_COPYRIGHT)
+
+AM_INIT_AUTOMAKE([1.11 tar-ustar])
 AC_REVISION($Revision: 1.603 $)
 AC_PREREQ(2.60)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
+AC_CONFIG_MACRO_DIR([m4])
 
 OCTAVE_HOST_TYPE
 
@@ -87,7 +100,7 @@
 OCTAVE_SET_DEFAULT(man1ext, '.1')
 OCTAVE_SET_DEFAULT(doc_cache_file, '$(octetcdir)/doc-cache')
 OCTAVE_SET_DEFAULT(infofile, '$(infodir)/octave.info')
-OCTAVE_SET_DEFAULT(octincludedir, '$(includedir)/octave-$(version)')
+OCTAVE_SET_DEFAULT(octincludedir, '$(includedir)/octave-$(version)/octave')
 OCTAVE_SET_DEFAULT(fcnfiledir, '$(datadir)/octave/$(version)/m')
 OCTAVE_SET_DEFAULT(localfcnfiledir, '$(datadir)/octave/site/m')
 OCTAVE_SET_DEFAULT(localapifcnfiledir,
@@ -217,13 +230,7 @@
 gcc_version=`$CC -v 2>&1 | grep "^.*gcc version" | \
   sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//'`
 case "$gcc_version" in
-  2.*)
-    if test -z "$LDFLAGS"; then
-      LDFLAGS="-g"
-      AC_MSG_NOTICE([defining LDFLAGS to be $LDFLAGS])
-    fi
-  ;;
-  1.*)
+  [12].*)
     warn_gcc_version="gcc version $gcc_version is likely to cause problems"
     AC_MSG_WARN($warn_gcc_version)
   ;;
@@ -654,9 +661,8 @@
   [FFTW3F library not found.  The slower FFTPACK library will be used instead.],
   [fftw3.h], [fftwf_plan_dft_1d])
 
-if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then
-  FFT_DIR=
-fi
+AM_CONDITIONAL([AMCOND_HAVE_FFTW],
+  [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"])
 
 # Checks for GLPK header and library.
 
@@ -873,7 +879,20 @@
 
 OCTAVE_PROG_AR
 
-AC_PROG_RANLIB
+LT_PREREQ([2.2.2])
+LT_INIT([disable-static dlopen win32-dll])
+
+if test x$enable_shared = xyes; then
+  SHARED_LIBS=true
+else
+  SHARED_LIBS=false
+fi
+
+if test x$enable_static = xyes; then
+  STATIC_LIBS=true
+else
+  STATIC_LIBS=false
+fi
 
 XTRA_CRUFT_SH_LDFLAGS=
 case "$canonical_host_type" in
@@ -886,10 +905,11 @@
 
 ### Checks for BLAS and LAPACK libraries:
 # (Build subdirectories of libcruft if they aren't found on the system.)
-ACX_BLAS_WITH_F77_FUNC([], [BLAS_DIR="blas"])
-ACX_LAPACK([BLAS_LIBS="$LAPACK_LIBS $BLAS_LIBS"], [LAPACK_DIR="lapack"])
-AC_SUBST(BLAS_DIR)
-AC_SUBST(LAPACK_DIR)
+ACX_BLAS_WITH_F77_FUNC([:], [:])
+ACX_LAPACK([:], [:])
+
+AM_CONDITIONAL([AMCOND_HAVE_BLAS], [test x$acx_blas_ok = xyes])
+AM_CONDITIONAL([AMCOND_HAVE_LAPACK], [test x$acx_lapack_ok = xyes])
 
 if test "x$acx_blas_f77_func_ok" = "xno"; then
   warn_blas_f77_incompatible="A BLAS library was detected but found incompatible with your Fortran 77 compiler.  The reference BLAS implementation will be used. To improve performance, consider using a different Fortran compiler or a switch like -ff2c to make your Fortran compiler use a calling convention compatible with the way your BLAS library was compiled, or use a different BLAS library."
@@ -899,7 +919,7 @@
 # Check for the qrupdate library
 
 save_LIBS="$LIBS"
-LIBS="$BLAS_LIBS $FLIBS $LIBS"
+LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
 OCTAVE_CHECK_LIBRARY(qrupdate, qrupdate,
   [qrupdate not found.  The QR & Cholesky updating functions will be slow.],
   [],
@@ -957,7 +977,7 @@
 # then you will need to configure with --with-cholmod="-lcholmod -lcblas".
 
 save_LIBS="$LIBS"
-LIBS="$BLAS_LIBS $FLIBS $LIBS"
+LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
 OCTAVE_CHECK_LIBRARY(cholmod, CHOLMOD,
   [CHOLMOD library not found.  This will result in some lack of functionality for sparse matrices.],
   [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h],
@@ -1019,39 +1039,19 @@
   [Fortran 77], [don't use the ARPACK library, disable eigs function])
 LIBS="$save_LIBS"
 
-### Handle shared library options.
-
-### Enable creation of static libraries.
-
-AC_ARG_ENABLE(static,
-  [AS_HELP_STRING([--enable-static], [create static libraries])],
-  [if test "$enableval" = no; then STATIC_LIBS=false;
-   else STATIC_LIBS=true; fi],
-  STATIC_LIBS=false)
-AC_SUBST(STATIC_LIBS)
-
-### Enable creation of shared libraries.  Currently only works with
-### gcc on some systems.
-
-AC_ARG_ENABLE(shared,
-  [AS_HELP_STRING([--enable-shared],
-     [create shared libraries (not all systems)])],
-  [if test "$enableval" = no; then SHARED_LIBS=false;
-   else SHARED_LIBS=true; fi],
-  SHARED_LIBS=true)
-AC_SUBST(SHARED_LIBS)
-
 ### Enable dynamic linking.  --enable-shared implies this, so
 ### --enable-dl is only need if you are only building static libraries
 ### and want to try dynamic linking too (works on some systems, for
 ### example, OS X and Windows).
 
-AC_ARG_ENABLE(dl,
-  [AS_HELP_STRING([--enable-dl],
-     [create shared libraries (not all systems)])],
-  [if test "$enableval" = no; then ENABLE_DYNAMIC_LINKING=false;
-   else ENABLE_DYNAMIC_LINKING=true; fi],
-  ENABLE_DYNAMIC_LINKING=true)
+AC_ARG_ENABLE([dl], [
+  AS_HELP_STRING([--enable-dl],
+    [create shared libraries (not all systems)])], [
+  case "${enableval}" in
+    yes) ENABLE_DYNAMIC_LINKING=true ;;
+    no) ENABLE_DYNAMIC_LINKING=false ;;
+    *) AC_MSG_ERROR([bad value ${enableval} for --enable-dl]) ;;
+  esac], [ENABLE_DYNAMIC_LINKING=true])
 
 if $STATIC_LIBS || $SHARED_LIBS; then
   true
@@ -1352,15 +1352,18 @@
 AC_CHECK_FUNCS(gethostname, [], [AC_CHECK_LIB(socket, gethostname)])
 AC_CHECK_FUNCS(getpwnam, [], [AC_CHECK_LIB(sun, getpwnam)])
 
+NO_UNDEFINED_LDFLAG=
 case "$canonical_host_type" in
   *-*-cygwin*)
    AC_CHECK_LIB(wsock32, gethostname)
    LIBS="$LIBS -lwsock32"
   ;;
   *-*-msdosmsvc* | *-*-mingw*)
-  LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
+    LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
+    NO_UNDEFINED_LDFLAG=-no-undefined
   ;;
 esac
+AC_SUBST(NO_UNDEFINED_LDFLAG)
 
 ### Type stuff.
 
@@ -1569,6 +1572,9 @@
 ### Dynamic linking is now enabled only if we are building shared
 ### libs and some API for dynamic linking is detected.
 
+## FIXME -- a lot of the following duplicates the functionality of
+## code generated by the dlopen option for LT_INIT.
+
 LD_CXX='$(CXX)'
 RDYNAMIC_FLAG=
 DL_API_MSG=""
@@ -1608,20 +1614,27 @@
       if test "$ac_cv_func_loadlibrary" = yes; then
         loadlibrary_api=true
       else
-        AC_CHECK_LIB(dl, dlopen, [DL_LIBS=-ldl; LIBS="$LIBS $DL_LIBS"])
-        AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
-        if test "$ac_cv_func_dlclose" = yes \
-          && test "$ac_cv_func_dlerror" = yes \
-          && test "$ac_cv_func_dlopen" = yes \
-          && test "$ac_cv_func_dlsym" = yes; then
-          dlopen_api=true
-        else
-	  case "$canonical_host_type" in
-	    i[[3456]]86-*-sco3.2v5*)
-	      LD_CXX='LD_RUN_PATH=$LD_RUN_PATH:$(octlibdir) $(CXX)'
-	      dlopen_api=true
-	    ;;
-	  esac
+        ## With the dlopen option, LT_INIT has already checked for
+	## dlopen and the -ldl library.  So we just look at cache values.
+        if test "x$ac_cv_lib_dl_dlopen" = xyes; then
+	  DL_LIBS=-ldl;
+	  LIBS="$LIBS $DL_LIBS"
+        fi
+	if test "x$ac_cv_func_dlopen" = xyes \
+          || test "x$ac_cv_lib_dl_dlopen" = xyes; then
+          AC_CHECK_FUNCS(dlsym dlerror dlclose)
+          if test "x$ac_cv_func_dlclose" = xyes \
+            && test "x$ac_cv_func_dlerror" = xyes \
+            && test "x$ac_cv_func_dlsym" = xyes; then
+            dlopen_api=true
+          else
+	    case "$canonical_host_type" in
+	      i[[3456]]86-*-sco3.2v5*)
+	        LD_CXX='LD_RUN_PATH=$LD_RUN_PATH:$(octlibdir) $(CXX)'
+	        dlopen_api=
+	      ;;
+	    esac
+          fi
 	fi
       fi
     fi
@@ -1661,6 +1674,9 @@
   fi
 fi
 
+AM_CONDITIONAL([AMCOND_ENABLE_DYNAMIC_LINKING],
+  [test x$ENABLE_DYNAMIC_LINKING = xtrue])
+
 if $SHARED_LIBS; then
    LIBOCTINTERP=-loctinterp$SHLLINKEXT
    LIBOCTAVE=-loctave$SHLLINKEXT
@@ -1836,6 +1852,8 @@
 OCTAVE_PROG_PYTHON
 
 OCTAVE_PROG_FLEX
+AC_SUBST([LEX_OUTPUT_ROOT], [lex.octave_])
+
 OCTAVE_PROG_BISON
 
 AC_PROG_LN_S
@@ -1946,8 +1964,6 @@
 export CXX
 export F77
 
-AC_CONFIG_SUBDIRS(scripts)
-
 ### Some things to add to the bottom of config.h.
 
 AH_BOTTOM([
@@ -2154,28 +2170,24 @@
 
 ### Do the substitutions in all the Makefiles.
 
-AC_CONFIG_COMMANDS([Makefile], [if test "$ac_srcdir" != "."; then
-  cp $srcdir/Makefile .
-fi])
-
 AC_SUBST(ac_config_files)
 AC_SUBST(ac_config_headers)
 
-AC_CONFIG_FILES([octMakefile Makeconf m4/Makefile test/Makefile
-  doc/Makefile doc/faq/Makefile doc/interpreter/Makefile
-  doc/liboctave/Makefile doc/refcard/Makefile emacs/Makefile
-  examples/Makefile examples/@polynomial/Makefile 
-  examples/@FIRfilter/Makefile liboctave/Makefile
-  src/Makefile src/mxarray.h libcruft/Makefile
-  libcruft/Makerules libcruft/amos/Makefile libcruft/blas/Makefile
-  libcruft/daspk/Makefile libcruft/dasrt/Makefile
-  libcruft/dassl/Makefile libcruft/fftpack/Makefile
-  libcruft/lapack/Makefile 
-  libcruft/misc/Makefile libcruft/odepack/Makefile
-  libcruft/ordered-qz/Makefile libcruft/quadpack/Makefile
-  libcruft/ranlib/Makefile libcruft/slatec-fn/Makefile
-  libcruft/slatec-err/Makefile libcruft/villad/Makefile
-  libcruft/blas-xtra/Makefile libcruft/lapack-xtra/Makefile])
+AC_CONFIG_FILES([
+  Makefile 
+  doc/Makefile
+  doc/faq/Makefile
+  doc/interpreter/Makefile
+  doc/liboctave/Makefile
+  doc/refcard/Makefile
+  examples/Makefile
+  libcruft/Makefile
+  liboctave/Makefile
+  scripts/Makefile
+  src/Makefile
+  src/mxarray.h
+  src/version.h
+  test/Makefile])
 
 AC_OUTPUT
 
@@ -2185,77 +2197,77 @@
 
 Octave is now configured for $canonical_host_type
 
-  Source directory:     $srcdir
-  Installation prefix:  $prefix
-  C compiler:           $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS
-  C++ compiler:         $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS
-  Fortran compiler:     $F77 $FFLAGS
-  Fortran libraries:    $FLIBS
-  Glob libraries:       $LIBGLOB
-  Lex libraries:        $LEXLIB
-  LIBS:                 $LIBS
+  Source directory:            $srcdir
+  Installation prefix:         $prefix
+  C compiler:                  $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS
+  C++ compiler:                $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS
+  Fortran compiler:            $F77 $FFLAGS
+  Fortran libraries:           $FLIBS
+  Glob libraries:              $LIBGLOB
+  Lex libraries:               $LEXLIB
+  LIBS:                        $LIBS
 
-  AMD CPPFLAGS:         $AMD_CPPFLAGS
-  AMD LDFLAGS:          $AMD_LDFLAGS
-  AMD libraries:        $AMD_LIBS
-  ARPACK libraries:     $ARPACK_LIBS
-  BLAS libraries:       $BLAS_LIBS
-  CAMD CPPFLAGS:        $CAMD_CPPFLAGS
-  CAMD LDFLAGS:         $CAMD_LDFLAGS
-  CAMD libraries:       $CAMD_LIBS
-  CARBON libraries:     $CARBON_LIBS
-  CCOLAMD CPPFLAGS:     $CCOLAMD_CPPFLAGS
-  CCOLAMD LDFLAGS:      $CCOLAMD_LDFLAGS
-  CCOLAMD libraries:    $CCOLAMD_LIBS
-  CHOLMOD CPPFLAGS:     $CHOLMOD_CPPFLAGS
-  CHOLMOD LDFLAGS:      $CHOLMOD_LDFLAGS
-  CHOLMOD libraries:    $CHOLMOD_LIBS
-  COLAMD CPPFLAGS:      $COLAMD_CPPFLAGS
-  COLAMD LDFLAGS:       $COLAMD_LDFLAGS
-  COLAMD libraries:     $COLAMD_LIBS
-  CURL CPPFLAGS:        $CURL_CPPFLAGS
-  CURL LDFLAGS:         $CURL_LDFLAGS
-  CURL libraries:       $CURL_LIBS
-  CXSPARSE CPPFLAGS:    $CXSPARSE_CPPFLAGS
-  CXSPARSE LDFLAGS:     $CXSPARSE_LDFLAGS
-  CXSPARSE libraries:   $CXSPARSE_LIBS
-  DL libraries:         $DL_LIBS
-  FFTW3 CPPFLAGS:       $FFTW3_CPPFLAGS
-  FFTW3 LDFLAGS:        $FFTW3_LDFLAGS
-  FFTW3 libraries:      $FFTW3_LIBS
-  FFTW3F CPPFLAGS:      $FFTW3F_CPPFLAGS
-  FFTW3F LDFLAGS:       $FFTW3F_LDFLAGS
-  FFTW3F libraries:     $FFTW3F_LIBS
-  FLTK backend libs:    $GRAPHICS_LIBS
-  GLPK CPPFLAGS:        $GLPK_CPPFLAGS
-  GLPK LDFLAGS:         $GLPK_LDFLAGS
-  GLPK libraries:       $GLPK_LIBS
-  GraphicsMagick++
-    CPPFLAGS:           $MAGICK_CPPFLAGS
-    LDFLAGS:            $MAGICK_LDFLAGS
-    libraries:          $MAGICK_LIBS
-  HDF5 CPPFLAGS:        $HDF5_CPPFLAGS
-  HDF5 LDFLAGS:         $HDF5_LDFLAGS
-  HDF5 libraries:       $HDF5_LIBS
-  OPENGL libraries:     $OPENGL_LIBS
-  PTHREAD flags:        $PTHREAD_CFLAGS
-  PTHREAD libraries:    $PTHREAD_LIBS
-  QHULL CPPFLAGS:       $QHULL_CPPFLAGS
-  QHULL LDFLAGS:        $QHULL_LDFLAGS
-  QHULL libraries:      $QHULL_LIBS
-  QRUPDATE libraries:   $QRUPDATE_LIBS
-  READLINE libraries:   $READLINE_LIBS
-  REGEX libraries:      $REGEX_LIBS
-  TERM libraries:       $TERM_LIBS
-  UMFPACK libraries:    $UMFPACK_LIBS
-  X11 include flags:    $X11_INCFLAGS
-  X11 libraries:        $X11_LIBS
-  Z CPPFLAGS:           $Z_CPPFLAGS
-  Z LDFLAGS:            $Z_LDFLAGS
-  Z libraries:          $Z_LIBS
+  AMD CPPFLAGS:                $AMD_CPPFLAGS
+  AMD LDFLAGS:                 $AMD_LDFLAGS
+  AMD libraries:               $AMD_LIBS
+  ARPACK libraries:            $ARPACK_LIBS
+  BLAS libraries:              $BLAS_LIBS
+  CAMD CPPFLAGS:               $CAMD_CPPFLAGS
+  CAMD LDFLAGS:                $CAMD_LDFLAGS
+  CAMD libraries:              $CAMD_LIBS
+  CARBON libraries:            $CARBON_LIBS
+  CCOLAMD CPPFLAGS:            $CCOLAMD_CPPFLAGS
+  CCOLAMD LDFLAGS:             $CCOLAMD_LDFLAGS
+  CCOLAMD libraries:           $CCOLAMD_LIBS
+  CHOLMOD CPPFLAGS:            $CHOLMOD_CPPFLAGS
+  CHOLMOD LDFLAGS:             $CHOLMOD_LDFLAGS
+  CHOLMOD libraries:           $CHOLMOD_LIBS
+  COLAMD CPPFLAGS:             $COLAMD_CPPFLAGS
+  COLAMD LDFLAGS:              $COLAMD_LDFLAGS
+  COLAMD libraries:            $COLAMD_LIBS
+  CURL CPPFLAGS:               $CURL_CPPFLAGS
+  CURL LDFLAGS:                $CURL_LDFLAGS
+  CURL libraries:              $CURL_LIBS
+  CXSPARSE CPPFLAGS:           $CXSPARSE_CPPFLAGS
+  CXSPARSE LDFLAGS:            $CXSPARSE_LDFLAGS
+  CXSPARSE libraries:          $CXSPARSE_LIBS
+  DL libraries:                $DL_LIBS
+  FFTW3 CPPFLAGS:              $FFTW3_CPPFLAGS
+  FFTW3 LDFLAGS:               $FFTW3_LDFLAGS
+  FFTW3 libraries:             $FFTW3_LIBS
+  FFTW3F CPPFLAGS:             $FFTW3F_CPPFLAGS
+  FFTW3F LDFLAGS:              $FFTW3F_LDFLAGS
+  FFTW3F libraries:            $FFTW3F_LIBS
+  FLTK backend libs:           $GRAPHICS_LIBS
+  GLPK CPPFLAGS:               $GLPK_CPPFLAGS
+  GLPK LDFLAGS:                $GLPK_LDFLAGS
+  GLPK libraries:              $GLPK_LIBS
+  GraphicsMagick++ CPPFLAGS:   $MAGICK_CPPFLAGS
+  GraphicsMagick++ LDFLAGS:    $MAGICK_LDFLAGS
+  GraphicsMagick++ libraries:  $MAGICK_LIBS
+  HDF5 CPPFLAGS:               $HDF5_CPPFLAGS
+  HDF5 LDFLAGS:                $HDF5_LDFLAGS
+  HDF5 libraries:              $HDF5_LIBS
+  LAPACK libraries:            $LAPACK_LIBS
+  OPENGL libraries:            $OPENGL_LIBS
+  PTHREAD flags:               $PTHREAD_CFLAGS
+  PTHREAD libraries:           $PTHREAD_LIBS
+  QHULL CPPFLAGS:              $QHULL_CPPFLAGS
+  QHULL LDFLAGS:               $QHULL_LDFLAGS
+  QHULL libraries:             $QHULL_LIBS
+  QRUPDATE libraries:          $QRUPDATE_LIBS
+  READLINE libraries:          $READLINE_LIBS
+  REGEX libraries:             $REGEX_LIBS
+  TERM libraries:              $TERM_LIBS
+  UMFPACK libraries:           $UMFPACK_LIBS
+  X11 include flags:           $X11_INCFLAGS
+  X11 libraries:               $X11_LIBS
+  Z CPPFLAGS:                  $Z_CPPFLAGS
+  Z LDFLAGS:                   $Z_LDFLAGS
+  Z libraries:                 $Z_LIBS
 
-  Default pager:        $DEFAULT_PAGER
-  gnuplot:              $GNUPLOT
+  Default pager:               $DEFAULT_PAGER
+  gnuplot:                     $GNUPLOT
 
   Do internal array bounds checking:  $BOUNDS_CHECKING
   Build static libraries:             $STATIC_LIBS
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,16 @@
+2009-11-10  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am, faq/Makefile.am, interpreter/Makefile.am,
+	liboctave/Makefile.am, refcard/Makefile.am,
+	interpreter/config-images.sh, interpreter/images,
+	interpreter/images.awk: New files.
+	* Makefile.in, faq/Makefile.in, interpreter/Makefile.in,
+	liboctave/Makefile.in, refcard/Makefile.in: Delete.
+	* interpreter/munge-texi.cc (main, usage): Eliminate unnecessary
+	-d option.
+	* liboctave/liboctave.texi: Surround @direntry in appropriate magic.
+	* faq/OctaveFAQ.texi: Rename from faq/Octave-FAQ.texi.
+
 2009-10-23  Rik <octave@nomad.inbox5.com>
 
 	* various: Periodic grammar check of Octave documentation files to ensure
new file mode 100644
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,52 @@
+# Makefile for octave's doc/interpreter directory
+#
+# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+#               2002, 2003, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ..
+
+include ../common.mk
+
+EXTRA_DIST = \
+  Makefile.am \
+  ChangeLog \
+  conf.texi.in \
+  texinfo.tex \
+  texmf.cnf
+
+SUBDIRS = faq interpreter liboctave refcard
+
+all-local: conf.texi
+
+conf.texi: conf.texi.in $(TOPDIR)/common.mk
+	@echo "making $@ from $<"
+	@$(SED) < $< \
+	  -e "s|%abs_top_srcdir%|${abs_top_srcdir}|" \
+	  -e "s|%top_srcdir%|${top_srcdir}|" \
+	  -e "s|%OCTAVE_HOME%|${prefix}|" \
+	  -e "s|%OCTAVE_VERSION%|${version}|" \
+	  -e "s|%TEXINFO_COLAMD%|${TEXINFO_COLAMD}|" \
+	  -e "s|%TEXINFO_CHOLMOD%|${TEXINFO_CHOLMOD}|" \
+	  -e "s|%TEXINFO_UMFPACK%|${TEXINFO_UMFPACK}|" \
+	  -e "s|%TEXINFO_QHULL%|${TEXINFO_QHULL}|" > $@-t
+	$(simple_move_if_change_rule)
+
+../BUGS ../INSTALL.OCTAVE:
+	$(MAKE) -C interpreter ../$@
+.PHONY: ../BUGS ../INSTALL.OCTAVE
deleted file mode 100644
--- a/doc/Makefile.in
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# Makefile for octave's doc directory
-#
-# John W. Eaton
-# jwe@octave.org
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-abs_top_srcdir = @abs_top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES =
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in conf.texi.in texinfo.tex texmf.cnf ChangeLog)
-
-SUBDIRS = faq interpreter liboctave refcard
-
-DISTSUBDIRS = $(SUBDIRS)
-
-all: conf.texi $(SUBDIRS)
-.PHONY: all
-
-conf.texi: conf.texi.in $(TOPDIR)/Makeconf
-	@$(do-subst-texinfo-vals)
-
-../BUGS ../INSTALL.OCTAVE:
-	$(MAKE) -C interpreter ../$@
-.PHONY: ../BUGS ../INSTALL.OCTAVE
-
-$(SUBDIRS):
-	$(MAKE) -C $@ all
-.PHONY: $(SUBDIRS)
-
-install install-strip uninstall clean mostlyclean distclean maintainer-clean::
-	@$(subdir-for-command)
-.PHONY: install install-strip uninstall
-.PHONY: clean mostlyclean distclean maintainer-clean
-
-tags TAGS:: $(SOURCES)
-	$(SUBDIR_FOR_COMMAND)
-
-tags::
-	ctags $(SOURCES)
-
-TAGS:: $(SOURCES)
-	etags $(SOURCES)
-
-distclean::
-	rm -f Makefile
-
-maintainer-clean::
-	rm -f tags TAGS Makefile
-
-dist:
-	ln $(DISTFILES) ../`cat ../.fname`/doc
-	for dir in $(DISTSUBDIRS); do mkdir ../`cat ../.fname`/doc/$$dir; $(MAKE) -C $$dir $@; done
-.PHONY: dist
new file mode 100644
--- /dev/null
+++ b/doc/faq/Makefile.am
@@ -0,0 +1,39 @@
+# Makefile for octave's doc/faq directory
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
+#               2006, 2007 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ../..
+
+include ../../common.mk
+
+TEXINFO_TEX = ../texinfo.tex
+
+info_TEXINFOS = OctaveFAQ.texi
+
+OctaveFAQ_TEXINFOS = ../conf.texi
+
+../conf.texi:
+	$(MAKE) -C .. conf.texi
+
+all-local: dvi html pdf ps
+
+EXTRA_DIST = OctaveFAQ.dvi OctaveFAQ.html OctaveFAQ.pdf OctaveFAQ.ps
+
+.NOTPARALLEL:
deleted file mode 100644
--- a/doc/faq/Makefile.in
+++ /dev/null
@@ -1,94 +0,0 @@
-# Makefile for octave's doc/faq directory
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
-#               2006, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-################################################################################
-
-TEXINFO := Octave-FAQ.texi
-
-FORMATTED := Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ.pdf
-
-DISTFILES := $(addprefix $(srcdir)/, Makefile.in $(TEXINFO) $(FORMATTED))
-
-SPELL := $(patsubst %.texi, %.spell, $(ALL_TEXINFO))
-
-%.spell : %.texi
-	rm -f $@
-	$(SED) -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@.tmp
-	mv $@.tmp $@
-
-all: Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ.pdf Octave-FAQ.html
-.PHONY: all
-
-Octave-FAQ.info: $(TEXINFO)
-	-$(MAKEINFO) -I.. -I$(srcdir) -I$(srcdir)/.. $<
-
-Octave-FAQ.dvi: $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
-	  $(TEXI2DVI) $<
-
-Octave-FAQ.ps: Octave-FAQ.dvi
-	-dvips -o $@ $<
-
-Octave-FAQ.pdf: $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
-	  $(TEXI2PDF) $<
-
-Octave-FAQ.html: $(TEXINFO)
-	-$(MAKEINFO) --html --ifinfo --no-split --output=$@ -I.. -I$(srcdir) -I$(srcdir)/.. $<
-
-check install install-strip uninstall:
-.PHONY: check install install-strip uninstall
-
-spell: $(SPELL)
-.PHONY: spell
-
-mostlyclean clean:
-	rm -f Octave-FAQ.cp Octave-FAQ.fn Octave-FAQ.ky Octave-FAQ.pg \
-	Octave-FAQ.tp Octave-FAQ.vr Octave-FAQ.cps Octave-FAQ.fns \
-	Octave-FAQ.kys Octave-FAQ.pgs Octave-FAQ.tps Octave-FAQ.vrs \
-	Octave-FAQ.aux	Octave-FAQ.log Octave-FAQ.toc
-.PHONY: mostlyclean clean
-
-distclean: clean
-	rm -f Makefile
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS Octave-FAQ.info Octave-FAQ.info-*
-	rm -f Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ.pdf
-	rm -f Octave-FAQ.html
-.PHONY: maintainer-clean
-
-dist: all
-	ln $(DISTFILES) ../../`cat ../../.fname`/doc/faq
-.PHONY: dist
rename from doc/faq/Octave-FAQ.texi
rename to doc/faq/OctaveFAQ.texi
--- a/doc/faq/Octave-FAQ.texi
+++ b/doc/faq/OctaveFAQ.texi
@@ -19,12 +19,12 @@
 
 \input texinfo.tex      @c -*-texinfo-*-
 
-@setfilename Octave-FAQ.info
+@setfilename OctaveFAQ.info
 @settitle Frequently asked questions about Octave (with answers)
 
 @setchapternewpage off
 @direntry
-* Octave-FAQ: (Octave-FAQ).  Frequently asked questions about Octave
+* OctaveFAQ: (OctaveFAQ).  Frequently asked questions about Octave
 @end direntry
 @titlepage
 @title Octave FAQ
new file mode 100644
--- /dev/null
+++ b/doc/interpreter/Makefile.am
@@ -0,0 +1,234 @@
+# Makefile for octave's doc/interpreter directory
+#
+# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+#               2002, 2003, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ../..
+
+include ../../common.mk
+
+AM_MAKEINFOFLAGS = -I.. -I$(srcdir) -I$(srcdir)/..
+AM_MAKEINFOHTMLFLAGS = -I.. -I$(srcdir) -I$(srcdir)/..
+
+TEXINFO_TEX = ../texinfo.tex
+
+TEXINPUTS := "..$(PATH_SEPARATOR)$(srcdir)$(PATH_SEPARATOR)$(srcdir)/..$(PATH_SEPARATOR)$(TEXINPUTS)$(PATH_SEPARATOR)"
+export TEXINPUTS
+
+TEXMFCNF := "..$(PATH_SEPARATOR)$(srcdir)$(PATH_SEPARATOR)$(srcdir)/..$(PATH_SEPARATOR)$(PATH_SEPARATOR)$(TEXMFCNF)$(PATH_SEPARATOR)"
+export TEXMFCNF
+
+dist_man1_MANS = \
+  mkoctfile.1 \
+  octave-bug.1 \
+  octave-config.1 \
+  octave.1
+
+## The following example files are listed for dependencies.
+## They should not be distributed from this directory.
+
+EXAMPLE_FILES = \
+  $(top_srcdir)/examples/@polynomial/display.m \
+  $(top_srcdir)/examples/@polynomial/double.m \
+  $(top_srcdir)/examples/@polynomial/end.m \
+  $(top_srcdir)/examples/@polynomial/get.m \
+  $(top_srcdir)/examples/@polynomial/mtimes.m \
+  $(top_srcdir)/examples/@polynomial/plot.m \
+  $(top_srcdir)/examples/@polynomial/polynomial.m \
+  $(top_srcdir)/examples/@polynomial/polynomial_superiorto.m \
+  $(top_srcdir)/examples/@polynomial/polyval.m \
+  $(top_srcdir)/examples/@polynomial/set.m \
+  $(top_srcdir)/examples/@polynomial/subsasgn.m \
+  $(top_srcdir)/examples/@polynomial/subsref.m \
+  $(top_srcdir)/examples/addtwomatrices.cc \
+  $(top_srcdir)/examples/celldemo.cc \
+  $(top_srcdir)/examples/firstmexdemo.c \
+  $(top_srcdir)/examples/fortdemo.cc \
+  $(top_srcdir)/examples/fortsub.f \
+  $(top_srcdir)/examples/funcdemo.cc \
+  $(top_srcdir)/examples/globaldemo.cc \
+  $(top_srcdir)/examples/helloworld.cc \
+  $(top_srcdir)/examples/mycell.c \
+  $(top_srcdir)/examples/myfeval.c \
+  $(top_srcdir)/examples/myfunc.c \
+  $(top_srcdir)/examples/mypow2.c \
+  $(top_srcdir)/examples/mysparse.c \
+  $(top_srcdir)/examples/mystring.c \
+  $(top_srcdir)/examples/mystruct.c \
+  $(top_srcdir)/examples/paramdemo.cc \
+  $(top_srcdir)/examples/stringdemo.cc \
+  $(top_srcdir)/examples/structdemo.cc \
+  $(top_srcdir)/examples/unwinddemo.cc
+
+include images.mk
+
+.eps.pdf:
+	if [ -f $< ] ; then $(GHOSTSCRIPT) -dBATCH -dEPSCrop -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $< ; fi
+
+IMAGES = $(IMAGES_EPS) $(IMAGES_PDF) $(IMAGES_PNG) $(IMAGES_TXT)
+
+MUNGED_TEXI_SRC = \
+  arith.texi \
+  audio.texi \
+  basics.texi \
+  bugs.texi \
+  container.texi \
+  contrib.texi \
+  cp-idx.texi \
+  data.texi \
+  debug.texi \
+  diffeq.texi \
+  diagperm.texi \
+  dynamic.texi \
+  emacs.texi \
+  errors.texi \
+  eval.texi \
+  expr.texi \
+  fn-idx.texi \
+  func.texi \
+  geometry.texi \
+  gpl.texi \
+  grammar.texi \
+  image.texi \
+  install.texi \
+  interp.texi \
+  intro.texi \
+  io.texi \
+  linalg.texi \
+  matrix.texi \
+  nonlin.texi \
+  numbers.texi \
+  oop.texi \
+  op-idx.texi \
+  optim.texi \
+  package.texi \
+  plot.texi \
+  poly.texi \
+  preface.texi \
+  quad.texi \
+  set.texi \
+  signal.texi \
+  sparse.texi \
+  stats.texi \
+  stmt.texi \
+  strings.texi \
+  system.texi \
+  testfun.texi \
+  tips.texi \
+  var.texi
+
+info_TEXINFOS = octave.texi
+octave_TEXINFOS = \
+  ../conf.texi \
+  contributors.texi \
+  $(MUNGED_TEXI_SRC)
+
+TXI_SRC = $(MUNGED_TEXI_SRC:.texi=.txi)
+
+../conf.texi:
+	$(MAKE) -C .. conf.texi
+
+$(srcdir)/octave.info: $(octave_TEXINFOS) $(IMAGES_TXT) $(EXAMPLE_FILES)
+
+octave.dvi octave.ps: $(octave_TEXINFOS) $(IMAGES_EPS) $(EXAMPLE_FILES)
+
+octave.pdf: $(octave_TEXINFOS) $(IMAGES_PDF) $(EXAMPLE_FILES)
+
+octave.html: $(octave_TEXINFOS) $(IMAGES_PNG) $(EXAMPLE_FILES)
+
+all-local: dvi html pdf ps doc-cache
+
+install-data-local: install-doc-cache
+.PHONY: install-data-local
+
+uninstall-local: uninstall-doc-cache
+.PHONY: uninstall-local
+
+install-doc-cache:
+	$(MKDIR_P) $(DESTDIR)$(octetcdir)
+	$(INSTALL_DATA) doc-cache $(DESTDIR)$(octetcdir)/doc-cache
+.PHONY: install-doc-cache
+
+uninstall-doc-cache:
+	rm -f $(DESTDIR)$(octetcdir)/doc-cache
+.PHONY: uninstall-doc-cache
+
+EXTRA_DIST = \
+  config-images.sh \
+  contributors.in \
+  images \
+  images.mk \
+  mk_doc_cache.m \
+  mkcontrib.awk \
+  munge-texi.cc \
+  octave.dvi \
+  octave.html \
+  octave.pdf \
+  octave.ps \
+  $(IMAGES) \
+  $(IMAGES_SRC) \
+  $(TXI_SRC)
+
+MAN_SRC = mkoctfile.1 octave.1 octave-bug.1 octave-config.1
+
+# FIXME -- need to include generated figures here...
+#DISTFILES = $(addprefix $(srcdir)/, Makefile.in contributors.in \
+#  mkcontrib.awk dir  munge-texi.cc $(MAN_SRC) $(SOURCES) $(MAIN_TEXINFO)) \
+#  $(SUB_TEXINFO) contributors.texi $(FORMATTED) $(IMAGES) mk_doc_cache.m \
+#  doc-cache stmp-html
+
+DOCSTRING_FILES = $(TOPDIR)/src/DOCSTRINGS $(TOPDIR)/scripts/DOCSTRINGS
+
+$(TOPDIR)/src/DOCSTRINGS:
+	$(MAKE) -C $(TOPDIR)/src DOCSTRINGS
+
+$(TOPDIR)/scripts/DOCSTRINGS:
+	$(MAKE) -C $(TOPDIR)/scripts DOCSTRINGS
+
+doc-cache: $(DOCSTRING_FILES) mk_doc_cache.m
+	$(TOPDIR)/run-octave -f -q -H $(srcdir)/mk_doc_cache.m doc-cache $(DOCSTRING_FILES) || rm -f doc-cache
+
+$(MUNGED_TEXI_SRC): $(DOCSTRING_FILES) munge-texi$(BUILD_EXEEXT)
+
+munge-texi$(BUILD_EXEEXT): munge-texi.cc
+	$(BUILD_CXX) $(BUILD_CXXFLAGS) -o $@ $^ $(BUILD_LDFLAGS)
+
+contributors.texi: contributors.in
+	$(AWK) -f $(srcdir)/mkcontrib.awk $(srcdir)/contributors.in > $@-t
+	mv $@-t $@
+
+.txi.texi:
+	./munge-texi $(DOCSTRING_FILES) < $< > $@-t
+	mv $@-t $@
+
+../../INSTALL.OCTAVE: install.texi
+	rm -f INSTALL
+	-$(MAKEINFO) -D INSTALLONLY \
+	  --no-validate --no-headers --no-split --output INSTALL \
+	  -I.. -I$(srcdir) -I$(srcdir)/.. $<
+	mv INSTALL ../../INSTALL.OCTAVE
+
+../../BUGS: bugs.texi
+	rm -f BUGS
+	-$(MAKEINFO) -D BUGSONLY \
+	  --no-validate --no-headers --no-split --output BUGS \
+	  -I.. -I$(srcdir) -I$(srcdir)/.. $<
+	mv BUGS ../../BUGS
+
+.NOTPARALLEL:
deleted file mode 100644
--- a/doc/interpreter/Makefile.in
+++ /dev/null
@@ -1,387 +0,0 @@
-# Makefile for octave's doc/interpreter directory
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-#               2002, 2003, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-################################################################################
-
-SCRIPT_SOURCES = sparseimages.m interpimages.m geometryimages.m plotimages.m
-
-POLYNOMIAL_FILES_NODIR = \
-  display.m \
-  double.m \
-  end.m \
-  get.m \
-  mtimes.m \
-  plot.m \
-  polynomial.m \
-  polynomial_superiorto.m \
-  polyval.m \
-  set.m \
-  subsasgn.m \
-  subsref.m
-
-EXAMPLE_FILES_NODIR = \
-  addtwomatrices.cc \
-  celldemo.cc \
-  firstmexdemo.c \
-  fortdemo.cc \
-  fortsub.f \
-  funcdemo.cc \
-  globaldemo.cc \
-  helloworld.cc \
-  mycell.c \
-  myfeval.c \
-  myfunc.c \
-  mypow2.c \
-  mysparse.c \
-  mystring.c \
-  mystruct.c \
-  paramdemo.cc \
-  stringdemo.cc \
-  structdemo.cc \
-  unwinddemo.cc \
-  $(addprefix @polynomial/, $(POLYNOMIAL_FILES_NODIR))
-
-EXAMPLE_FILES = $(addprefix $(top_srcdir)/examples/, $(EXAMPLE_FILES_NODIR))
-
-GEOMETRYIMAGES = voronoi triplot griddata convhull delaunay inpolygon
-GEOMETRYIMAGES_EPS = $(addsuffix .eps, $(GEOMETRYIMAGES))
-GEOMETRYIMAGES_PDF = $(addsuffix .pdf, $(GEOMETRYIMAGES))
-GEOMETRYIMAGES_PNG = $(addsuffix .png, $(GEOMETRYIMAGES))
-GEOMETRYIMAGES_TXT = $(addsuffix .txt, $(GEOMETRYIMAGES))
-
-PLOTIMAGES = plot hist errorbar polar mesh plot3 extended
-PLOTIMAGES_EPS = $(addsuffix .eps, $(PLOTIMAGES))
-PLOTIMAGES_PDF = $(addsuffix .pdf, $(PLOTIMAGES))
-PLOTIMAGES_PNG = $(addsuffix .png, $(PLOTIMAGES))
-PLOTIMAGES_TXT = $(addsuffix .txt, $(PLOTIMAGES))
-
-INTERPIMAGES = interpft interpn interpderiv1 interpderiv2
-INTERPIMAGES_EPS = $(addsuffix .eps, $(INTERPIMAGES))
-INTERPIMAGES_PDF = $(addsuffix .pdf, $(INTERPIMAGES))
-INTERPIMAGES_PNG = $(addsuffix .png, $(INTERPIMAGES))
-INTERPIMAGES_TXT = $(addsuffix .txt, $(INTERPIMAGES))
-
-SPARSEIMAGES_1 = gplot grid spmatrix spchol spcholperm
-SPARSEIMAGES_EPS = $(addsuffix .eps, $(SPARSEIMAGES_1))
-SPARSEIMAGES_PDF = $(addsuffix .pdf, $(SPARSEIMAGES_1))
-SPARSEIMAGES_PNG = $(addsuffix .png, $(SPARSEIMAGES_1))
-SPARSEIMAGES_TXT = $(addsuffix .txt, $(SPARSEIMAGES_1))
-
-IMAGES_EPS = $(SPARSEIMAGES_EPS) $(INTERPIMAGES_EPS) \
-	$(GEOMETRYIMAGES_EPS) $(PLOTIMAGES_EPS)
-IMAGES_PDF = $(SPARSEIMAGES_PDF) $(INTERPIMAGES_PDF) \
-	$(GEOMETRYIMAGES_PDF) $(PLOTIMAGES_PDF)
-IMAGES_PNG = $(SPARSEIMAGES_PNG) $(INTERPIMAGES_PNG) \
-	$(GEOMETRYIMAGES_PNG) $(PLOTIMAGES_PNG)
-IMAGES_TXT = $(SPARSEIMAGES_TXT) $(INTERPIMAGES_TXT) \
-	$(GEOMETRYIMAGES_TXT) $(PLOTIMAGES_TXT)
-
-HTML_IMAGES_PNG = $(addprefix HTML/, $(IMAGES_PNG))
-
-IMAGES = $(IMAGES_EPS) $(IMAGES_PDF) $(IMAGES_PNG) $(IMAGES_TXT)
-
-SUB_SOURCE := arith.txi audio.txi basics.txi bugs.txi \
-	container.txi contrib.txi cp-idx.txi data.txi \
-	debug.txi diffeq.txi diagperm.txi dynamic.txi emacs.txi \
-	errors.txi eval.txi expr.txi fn-idx.txi func.txi geometry.txi \
-	gpl.txi grammar.txi image.txi install.txi interp.txi \
-	intro.txi io.txi linalg.txi matrix.txi nonlin.txi numbers.txi \
-	oop.txi op-idx.txi optim.txi package.txi plot.txi poly.txi preface.txi \
-	quad.txi set.txi signal.txi sparse.txi stats.txi \
-	stmt.txi strings.txi system.txi testfun.txi tips.txi var.txi
-
-SOURCES := $(SUB_SOURCE) $(SCRIPT_SOURCES)
-
-MAIN_TEXINFO := $(srcdir)/octave.texi
-
-SUB_TEXINFO := $(SUB_SOURCE:.txi=.texi)
-
-# Don't list ../conf.texi here.
-TEXINFO_SOURCE := $(MAIN_TEXINFO) $(SUB_TEXINFO) contributors.texi
-
-TEXINFO := $(TEXINFO_SOURCE) ../conf.texi
-
-# Do not use --output option argument, because this is not supported
-# by MiKTeX (compilation under Windows/MSVC assumes the use of MiKTeX
-# to build the doc).  Instead, copy the source .texi using the
-# targeted file name (e.g. to generate octave-a4.pdf, copy to
-# octave-a4.texi) and call texi2[dvi|pdf] on it.
-
-TEXI2DVICOMMAND = TEXINPUTS="..$(sepchar)$(srcdir)$(sepchar)$(srcdir)/..$(sepchar)$(TEXINPUTS)$(sepchar)" \
-	TEXMFCNF="..$(sepchar)$(srcdir)$(sepchar)$(srcdir)/..$(sepchar)$(TEXMFCNF)$(sepchar)" \
-	  $(TEXI2DVI)
-
-TEXI2PDFCOMMAND = TEXINPUTS="..$(sepchar)$(srcdir)$(sepchar)$(srcdir)/..$(sepchar)$(TEXINPUTS)$(sepchar)" \
-	TEXMFCNF="..$(sepchar)$(srcdir)$(sepchar)$(srcdir)/..$(sepchar)$(TEXMFCNF)$(sepchar)" \
-	  $(TEXI2PDF)
-
-FORMATTED = octave.info octave.pdf octave-a4.pdf octave.info-[0-9]*
-
-MAN_BASE := mkoctfile octave octave-bug octave-config
-MAN_SRC := $(addsuffix .1, $(MAN_BASE))
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in contributors.in \
-  mkcontrib.awk dir  munge-texi.cc $(MAN_SRC) $(SOURCES) $(MAIN_TEXINFO)) \
-  $(SUB_TEXINFO) contributors.texi $(FORMATTED) $(IMAGES) mk_doc_cache.m \
-  doc-cache stmp-html
-
-DISTDIRS = HTML
-
-SUBDIRS :=
-
-# Look for version.h to get version information.
-xfiles := $(TOPDIR)/src/version.h $(srcdir)/$(TOPDIR)/src/version.h
-
-version_file := $(firstword $(foreach file, $(xfiles), $(wildcard $(file))))
-
-SPELL = $(patsubst %.texi, %.spell, $(TEXINFO))
-
-%.spell : %.texi
-	rm -f $@
-	$(SED) -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@-t
-	mv $@-t $@
-
-all: octave.info octave.pdf octave-a4.pdf HTML/index.html doc-cache
-.PHONY: all
-
-DOCSTRING_FILES := $(TOPDIR)/src/DOCSTRINGS $(TOPDIR)/scripts/DOCSTRINGS
-
-doc-cache: $(DOCSTRING_FILES) mk_doc_cache.m
-	$(TOPDIR)/run-octave -f -q -H $(srcdir)/mk_doc_cache.m doc-cache $(DOCSTRING_FILES) || rm -f doc-cache
-
-$(TEXINFO): $(DOCSTRING_FILES) munge-texi$(BUILD_EXEEXT)
-
-munge-texi$(BUILD_EXEEXT): munge-texi.cc
-	$(BUILD_CXX) $(BUILD_CXXFLAGS) -o $@ $^ $(BUILD_LDFLAGS)
-
-$(DOCSTRING_FILES):
-	$(MAKE) -C $(dir $@) $(notdir $@)
-
-contributors.texi: contributors.in
-	$(AWK) -f $(srcdir)/mkcontrib.awk $(srcdir)/contributors.in > $@-t
-	mv $@-t $@
-
-octave-a4.texi: $(MAIN_TEXINFO)
-	cp $< $@
-
-octave-smallbook.texi: $(MAIN_TEXINFO)
-	cp $< $@
-
-$(SUB_TEXINFO) : %.texi : %.txi
-	./munge-texi $(foreach f, $(DOCSTRING_FILES), -d $(f)) < $< > $@-t
-	mv $@-t $@
-
-octave.info: $(IMAGES_TXT) $(TEXINFO) $(EXAMPLE_FILES)
-	-$(MAKEINFO) -I.. -I$(srcdir) -I$(srcdir)/.. $(MAIN_TEXINFO)
-
-octave.dvi: $(IMAGES_EPS) $(TEXINFO) $(EXAMPLE_FILES)
-	-$(TEXI2DVICOMMAND) $(MAIN_TEXINFO)
-
-octave-a4.dvi: $(IMAGES_EPS) $(TEXINFO) $(EXAMPLE_FILES) octave-a4.texi
-	-$(TEXI2DVICOMMAND) octave-a4.texi -t @afourpaper
-
-octave-smallbook.dvi: $(IMAGES_EPS) $(TEXINFO) $(EXAMPLE_FILES) octave-smallbook.texi
-	-$(TEXI2DVICOMMAND) octave-smallbook.texi -t @smallbook
-
-octave.ps: octave.dvi
-	-dvips -o $@ $<
-
-octave-a4.ps: octave-a4.dvi
-	-dvips -o $@ $<
-
-octave-smallbook.ps: octave-smallbook.dvi
-	-dvips -o $@ $<
-
-octave.pdf: $(IMAGES_PDF) $(TEXINFO) $(EXAMPLE_FILES)
-	-$(TEXI2PDFCOMMAND) $(MAIN_TEXINFO)
-
-octave-a4.pdf: $(IMAGES_PDF) $(TEXINFO) $(EXAMPLE_FILES) octave-a4.texi
-	-$(TEXI2PDFCOMMAND) octave-a4.texi -t @afourpaper
-
-octave-smallbook.pdf: $(IMAGES_PDF) $(TEXINFO) $(EXAMPLE_FILES) octave-smallbook.texi
-	-$(TEXI2PDFCOMMAND) octave-smallbook.texi -t @smallbook
-
-../../INSTALL.OCTAVE: install.texi
-	rm -f INSTALL
-	-$(MAKEINFO) -D INSTALLONLY \
-	  --no-validate --no-headers --no-split --output INSTALL \
-	  -I.. -I$(srcdir) -I$(srcdir)/.. $<
-	mv INSTALL ../../INSTALL.OCTAVE
-
-../../BUGS: bugs.texi
-	rm -f BUGS
-	-$(MAKEINFO) -D BUGSONLY \
-	  --no-validate --no-headers --no-split --output BUGS \
-	  -I.. -I$(srcdir) -I$(srcdir)/.. $<
-	mv BUGS ../../BUGS
-
-HTML/index.html: $(HTML_IMAGES_PNG) $(TEXINFO) $(EXAMPLE_FILES)
-	-$(MAKEINFO) --html --ifinfo --output=HTML -I.. -I$(srcdir) -I$(srcdir)/.. $(MAIN_TEXINFO)
-
-stmp-html: HTML
-	@if [ -f stmp-html ]; then \
-	  true; \
-	else \
-	  echo "touch stmp-html"; \
-	  touch stmp-html; \
-	fi
-
-HTML:
-	@if [ -d HTML ]; then \
-	  true; \
-	else \
-	  echo "mkdir HTML"; \
-	  mkdir HTML; \
-	fi
-
-$(HTML_IMAGES_PNG): HTML/%.png : %.png stmp-html
-	cp $(filter-out html-dir, $<) HTML
-
-define run-octave
-  $(TOPDIR)/run-octave -f -q -H -p $(srcdir) \
-    --eval "$(notdir $(basename $<)) ('$(notdir $(basename $@))', '$(patsubst .%,%, $(suffix $@))');"
-endef
-
-$(GEOMETRYIMAGES_EPS) $(GEOMETRYIMAGES_PNG) $(GEOMETRYIMAGES_TXT): geometryimages.m
-	$(run-octave)
-
-$(PLOTIMAGES_EPS) $(PLOTIMAGES_PNG) $(PLOTIMAGES_TXT): plotimages.m
-	$(run-octave)
-
-$(INTERPIMAGES_EPS) $(INTERPIMAGES_PNG) $(INTERPIMAGES_TXT): interpimages.m
-	$(run-octave)
-
-$(SPARSEIMAGES_EPS) $(SPARSEIMAGES_PNG) $(SPARSEIMAGES_TXT): sparseimages.m
-	$(run-octave)
-
-$(IMAGES_PDF) : %.pdf : %.eps
-	if [ -f $< ] ; then $(GHOSTSCRIPT) -dBATCH -dEPSCrop -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $< ; fi
-
-check: all
-.PHONY: check
-
-install install-strip: all
-	@$(subdir-for-command)
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(man1dir) $(DESTDIR)$(infodir) $(DESTDIR)$(octetcdir)
-	@if test -d $(DESTDIR)$(man1dir); then \
-	  for f in $(MAN_BASE); do \
-	    rm -f $(DESTDIR)$(man1dir)/$$f$(man1ext); \
-	    echo "installing $(srcdir)/$$f.1 in $(DESTDIR)$(man1dir)"; \
-	    $(INSTALL_DATA) $(srcdir)/$$f.1 $(DESTDIR)$(man1dir)/$$f$(man1ext); \
-	  done ; \
-	fi
-	@if test -d $(DESTDIR)$(infodir); then \
-	  rm -f $(DESTDIR)$(infodir)/octave.info*; \
-	  echo "installing info files in $(DESTDIR)$(infodir)"; \
-	  if test -f octave.info; then \
-	    for f in octave.info*; do \
-	      $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$f; \
-	    done; \
-	  else \
-	    for f in $(srcdir)/octave.info*; do \
-	      $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/`basename $$f`; \
-	    done; \
-	  fi; \
-	  if test -f $(DESTDIR)$(infodir)/dir; then \
-	    if grep "^\* Octave: (octave)." $(DESTDIR)$(infodir)/dir > /dev/null; then \
-	      true; \
-	    else \
-	      echo ""; \
-	      echo "You should add the following entry"; \
-	      echo ""; \
-	      echo "* Octave: (octave)."; \
-	      echo "	Interactive language for numerical computations."; \
-	      echo ""; \
-	      echo "to $(DESTDIR)$(infodir)/dir."; \
-	      echo ""; \
-	    fi; \
-	  else \
-	    echo "installing $(srcdir)/dir in $(DESTDIR)$(infodir)"; \
-	    $(INSTALL_DATA) $(srcdir)/dir $(DESTDIR)$(infodir)/dir; \
-	  fi; \
-	fi
-	$(INSTALL_DATA) doc-cache $(DESTDIR)$(octetcdir)/doc-cache
-.PHONY: install install-strip
-
-uninstall:
-	@$(subdir-for-command)
-	rm -f $(DESTDIR)$(infodir)/octave.info*
-	rm -f $(DESTDIR)$(infodir)/dir
-	rm -f $(DESTDIR)$(octetcdir)/doc-cache
-	for f in $(MAN_BASE); do rm -f $(DESTDIR)$(man1dir)/$$f$(man1ext); done
-.PHONY: uninstall
-
-spell: $(SPELL)
-.PHONY: spell
-
-mostlyclean clean:
-	@$(subdir-for-command)
-	rm -f octave.cp octave.fn octave.in \
-	octave.ky octave.op octave.pg octave.rd octave.tp octave.vr \
-	octave.cps octave.fns octave.ins octave.kys octave.ops \
-	octave.pgs octave.rds octave.tps octave.vrs octave.aux \
-	octave.log octave.toc \
-	munge-texi.o \
-	octave-a4.cp octave-a4.fn octave-a4.in \
-	octave-a4.ky octave-a4.op octave-a4.pg octave-a4.rd octave-a4.tp octave-a4.vr \
-	octave-a4.cps octave-a4.fns octave-a4.ins octave-a4.kys octave-a4.ops \
-	octave-a4.pgs octave-a4.rds octave-a4.tps octave-a4.vrs octave-a4.aux \
-	octave-a4.log octave-a4.toc \
-	octave-smallbook.cp octave-smallbook.fn octave-smallbook.in \
-	octave-smallbook.ky octave-smallbook.op octave-smallbook.pg octave-smallbook.rd octave-smallbook.tp octave-smallbook.vr \
-	octave-smallbook.cps octave-smallbook.fns octave-smallbook.ins octave-smallbook.kys octave-smallbook.ops \
-	octave-smallbook.pgs octave-smallbook.rds octave-smallbook.tps octave-smallbook.vrs octave-smallbook.aux \
-	octave-smallbook.log octave-smallbook.toc
-.PHONY: mostlyclean clean 
-
-distclean: clean
-	@$(subdir-for-command)
-	rm -f Makefile
-.PHONY: distclean
-
-maintainer-clean: distclean clean-texi
-	rm -f munge-texi$(BUILD_EXEEXT) doc-cache stmp-html $(FORMATTED) $(IMAGES)
-	rm -rf HTML
-.PHONY: maintainer-clean
-
-clean-texi:
-	rm -f $(SUB_TEXINFO) contributors.texi octave-a4.texi octave-smallbook.texi
-.PHONY: clean-texi
-
-dist: all
-	ln $(DISTFILES) ../../`cat ../../.fname`/doc/interpreter
-	for dir in $(DISTDIRS); do \
-	  mkdir ../../`cat ../../.fname`/doc/interpreter/$$dir; \
-	  ln ../../doc/interpreter/$$dir/* ../../`cat ../../.fname`/doc/interpreter/$$dir; \
-	done
-.PHONY: dist
new file mode 100755
--- /dev/null
+++ b/doc/interpreter/config-images.sh
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+set -e
+
+: ${AWK=awk}
+
+$AWK -f images.awk images > images.mk-t
+../../move-if-change images.mk-t images.mk
new file mode 100644
--- /dev/null
+++ b/doc/interpreter/images
@@ -0,0 +1,4 @@
+geometryimages.m voronoi triplot griddata convhull delaunay inpolygon
+interpimages.m interpft interpn interpderiv1 interpderiv2
+plotimages.m plot hist errorbar polar mesh plot3 extended
+sparseimages.m gplot grid spmatrix spchol spcholperm
new file mode 100644
--- /dev/null
+++ b/doc/interpreter/images.awk
@@ -0,0 +1,30 @@
+BEGIN {
+  exts[1] = "eps";
+  exts[2] = "pdf";
+  exts[3] = "png";
+  exts[4] = "txt";
+  printf ("IMAGES_SRC =\n");
+  for (i = 1; i <= 4; i++) {
+    printf ("IMAGES_%s =\n", toupper (exts[i]));
+  }
+} {
+  script = $1;
+  basename = script;
+  sub (/\.m$/, "", basename);
+  ubasename = toupper (basename);
+  printf ("IMAGES_SRC += %s\n", script);
+  for (i = 1; i <= 4; i++) {
+    ext = exts[i];
+    uext = toupper (ext);
+
+    printf ("%s_%s =", ubasename, uext);
+    for (j = 2; j <= NF; j++)
+      printf (" %s.%s", $j, ext);
+    printf ("\n");
+
+    printf ("IMAGES_%s += $(%s_%s)\n", uext, ubasename, uext);
+
+    for (j = 2; j <= NF; j++)
+      printf ("%s.%s: %s\n\t$(TOPDIR)/run-octave -f -q -H -p $(srcdir) --eval \"%s ('%s', '%s');\"\n", $j, ext, script, basename, $j, ext);
+  }
+}
--- a/doc/interpreter/munge-texi.cc
+++ b/doc/interpreter/munge-texi.cc
@@ -47,7 +47,7 @@
 static void
 usage (void)
 {
-  std::cerr << "usage: munge-texi -d DOCSTRING-FILE file ...\n";
+  std::cerr << "usage: munge-texi DOCSTRING-FILE file ...\n";
   exit (1);
 }
 
@@ -310,17 +310,7 @@
 main (int argc, char **argv)
 {
   while (*++argv)
-    {
-      if (! strcmp (*argv, "-d"))
-	{
-	  if (*++argv)
-	    process_doc_file (*argv);
-	  else
-	    usage ();
-	}
-      else
-	break;
-    }
+    process_doc_file (*argv);
 
   process_texi_input_file (std::cin, std::cout);
 
new file mode 100644
--- /dev/null
+++ b/doc/liboctave/Makefile.am
@@ -0,0 +1,65 @@
+# Makefile for octave's doc/liboctave directory
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+#               2005, 2006, 2007 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ../..
+
+include ../../common.mk
+
+AM_MAKEINFOFLAGS = -I.. -I$(srcdir) -I$(srcdir)/..
+AM_MAKEINFOHTMLFLAGS = -I.. -I$(srcdir) -I$(srcdir)/..
+
+TEXINFO_TEX = ../texinfo.tex
+
+TEXINPUTS = "..$(PATH_SEPARATOR)$(srcdir)$(PATH_SEPARATOR)$(srcdir)/..$(PATH_SEPARATOR)"
+export TEXINPUTS
+
+info_TEXINFOS = liboctave.texi
+
+liboctave_TEXINFOS = \
+  ../conf.texi \
+  array.texi \
+  bugs.texi \
+  cp-idx.texi \
+  dae.texi \
+  diffeq.texi \
+  error.texi \
+  factor.texi \
+  fn-idx.texi \
+  gpl.texi \
+  install.texi \
+  intro.texi \
+  matvec.texi \
+  nleqn.texi \
+  nlfunc.texi \
+  ode.texi \
+  optim.texi \
+  preface.texi \
+  quad.texi \
+  range.texi
+
+../conf.texi:
+	$(MAKE) -C .. conf.texi
+
+all-local: dvi html pdf ps
+
+EXTRA_DIST = liboctave.dvi liboctave.html liboctave.pdf liboctave.ps
+
+.NOTPARALLEL:
deleted file mode 100644
--- a/doc/liboctave/Makefile.in
+++ /dev/null
@@ -1,119 +0,0 @@
-# Makefile for octave's doc/liboctave directory
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-#               2005, 2006, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-################################################################################
-
-MAIN_TEXINFO = liboctave.texi
-
-SUB_TEXINFO = \
-	array.texi bugs.texi cp-idx.texi dae.texi diffeq.texi \
-	error.texi factor.texi fn-idx.texi install.texi intro.texi \
-	matvec.texi nleqn.texi nlfunc.texi ode.texi \
-	optim.texi preface.texi quad.texi range.texi
-
-TEXINFO_SOURCE = $(MAIN_TEXINFO) $(SUB_TEXINFO)
-
-TEXINFO = $(TEXINFO_SOURCE) ../conf.texi
-
-FORMATTED = liboctave.dvi liboctave.ps liboctave.pdf liboctave.info
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in gpl.texi $(TEXINFO_SOURCE)) \
-	 $(FORMATTED)
-
-DISTDIRS = HTML
-
-SPELL = $(patsubst %.texi, %.spell, $(TEXINFO))
-
-%.spell : %.texi
-	rm -f $@
-	$(SED) -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@.tmp
-	mv $@.tmp $@
-
-all: $(FORMATTED) HTML/index.html
-.PHONY: all
-
-liboctave.info: $(TEXINFO)
-	-$(MAKEINFO) -I.. -I$(srcdir) -I$(srcdir)/.. $<
-
-liboctave.dvi: $(TEXINFO)
-	-TEXINPUTS="..$(sepchar)$(srcdir)$(sepchar)$(srcdir)/..$(sepchar)$(TEXINPUTS)$(sepchar)" \
-	  $(TEXI2DVI) $<
-
-liboctave.ps: liboctave.dvi
-	-dvips -o $@ $<
-
-liboctave.pdf: $(TEXINFO)
-	-TEXINPUTS="..$(sepchar)$(srcdir)$(sepchar)$(srcdir)/..$(sepchar)$(TEXINPUTS)$(sepchar)" \
-	  $(TEXI2PDF) $<
-
-HTML/index.html: $(TEXINFO)
-	-$(MAKEINFO) --html --ifinfo --output=HTML -I.. -I$(srcdir) -I$(srcdir)/.. $<
-
-check:
-.PHONY: check
-
-install install-strip: all
-.PHONY: install install-strip
-
-uninstall:
-	rm -f $(DESTDIR)$(infodir)/liboctave.info*
-.PHONY: uninstall
-
-spell: $(SPELL)
-.PHONY: spell
-
-mostlyclean clean:
-	rm -f liboctave.cp liboctave.fn liboctave.pg liboctave.tp \
-	liboctave.vr liboctave.ky liboctave.op liboctave.vrs \
-	liboctave.kys liboctave.ops liboctave.cps liboctave.fns \
-	liboctave.pgs liboctave.tps liboctave.aux liboctave.log \
-	liboctave.toc
-.PHONY: mostlyclean clean
-
-distclean: clean
-	rm -f Makefile
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS liboctave.info liboctave.info-*
-	rm -f liboctave.dvi liboctave.ps liboctave.pdf
-	rm -rf HTML
-.PHONY: maintainer-clean
-
-dist: all
-	ln $(DISTFILES) ../../`cat ../../.fname`/doc/liboctave
-	for dir in $(DISTDIRS); do \
-	  mkdir ../../`cat ../../.fname`/doc/liboctave/$$dir; \
-	  ln ../../doc/liboctave/$$dir/* ../../`cat ../../.fname`/doc/liboctave/$$dir; \
-	done
-.PHONY: dist
--- a/doc/liboctave/liboctave.texi
+++ b/doc/liboctave/liboctave.texi
@@ -17,11 +17,16 @@
 % <http://www.gnu.org/licenses/>.
 
 
-\input texinfo  @c -*-texinfo-*-
+\input texinfo
 @setfilename liboctave.info
-@direntry
+
+@ifinfo
+@format
+START-INFO-DIR-ENTRY
 * liboctave: (liboctave). Octave C++ Classes
-@end direntry
+END-INFO-DIR-ENTRY
+@end format
+@end ifinfo
 
 @c @smallbook
 @c @setchapternewpage odd
new file mode 100644
--- /dev/null
+++ b/doc/refcard/Makefile.am
@@ -0,0 +1,72 @@
+# Makefile for octave's doc/refcard directory
+#
+# Copyright (C) 1996, 1997, 2003, 2004, 2005, 2007 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ../..
+
+include ../../common.mk
+
+TEX = \
+  refcard.tex \
+  refcard-a4.tex \
+  refcard-legal.tex \
+  refcard-letter.tex 
+
+FORMATTED = \
+  refcard-a4.dvi \
+  refcard-a4.ps \
+  refcard-a4.pdf \
+  refcard-legal.dvi \
+  refcard-legal.ps \
+  refcard-legal.pdf \
+  refcard-letter.dvi \
+  refcard-letter.ps \
+  refcard-letter.pdf
+
+EXTRA_DIST = \
+  $(TEX) $(FORMATTED)
+
+all-local: $(FORMATTED)
+
+refcard-a4.dvi: refcard-a4.tex refcard.tex
+	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" tex $<
+
+refcard-a4.ps: refcard-a4.dvi
+	-dvips -T 297mm,210mm -o $@ $<
+
+refcard-a4.pdf: refcard-a4.tex refcard.tex
+	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" pdftex $<
+
+refcard-legal.dvi: refcard-legal.tex refcard.tex
+	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" tex $<
+
+refcard-legal.ps: refcard-legal.dvi
+	-dvips -T 14in,8.5in -o $@ $<
+
+refcard-legal.pdf: refcard-legal.tex refcard.tex
+	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" pdftex $<
+
+refcard-letter.dvi: refcard-letter.tex refcard.tex
+	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" tex $<
+
+refcard-letter.ps: refcard-letter.dvi
+	-dvips -T 11in,8.5in -o $@ $<
+
+refcard-letter.pdf: refcard-letter.tex refcard.tex
+	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" pdftex $<
deleted file mode 100644
--- a/doc/refcard/Makefile.in
+++ /dev/null
@@ -1,91 +0,0 @@
-# Makefile for octave's doc/refcard directory
-#
-# Copyright (C) 1996, 1997, 2003, 2004, 2005, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-################################################################################
-
-BASENAMES := refcard-letter refcard-a4 refcard-legal
-
-TEX := refcard.tex $(addsuffix .tex, $(BASENAMES))
-
-FORMATTED := $(addsuffix .dvi, $(BASENAMES)) \
-             $(addsuffix .ps,  $(BASENAMES)) \
-             $(addsuffix .pdf, $(BASENAMES))
-
-DISTFILES := $(addprefix $(srcdir)/, Makefile.in $(TEX)) $(FORMATTED)
-
-all: $(FORMATTED)
-
-refcard-a4.dvi: refcard-a4.tex refcard.tex
-	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" tex $<
-
-refcard-a4.ps: refcard-a4.dvi
-	-dvips -T 297mm,210mm -o $@ $<
-
-refcard-a4.pdf: refcard-a4.tex refcard.tex
-	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" pdftex $<
-
-refcard-legal.dvi: refcard-legal.tex refcard.tex
-	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" tex $<
-
-refcard-legal.ps: refcard-legal.dvi
-	-dvips -T 14in,8.5in -o $@ $<
-
-refcard-legal.pdf: refcard-legal.tex refcard.tex
-	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" pdftex $<
-
-refcard-letter.dvi: refcard-letter.tex refcard.tex
-	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" tex $<
-
-refcard-letter.ps: refcard-letter.dvi
-	-dvips -T 11in,8.5in -o $@ $<
-
-refcard-letter.pdf: refcard-letter.tex refcard.tex
-	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" pdftex $<
-
-check install install-strip uninstall:
-.PHONY: check install install-strip uninstall
-
-mostlyclean clean:
-	rm -f refcard-*.log
-.PHONY: mostlyclean clean
-
-distclean: clean
-	rm -f Makefile
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS	refcard-*.dvi refcard-*.ps refcard-*.pdf
-.PHONY: maintainer-clean
-
-dist: all
-	ln $(DISTFILES) ../../`cat ../../.fname`/doc/refcard
-.PHONY: dist
deleted file mode 100644
--- a/emacs/Makefile.in
+++ /dev/null
@@ -1,70 +0,0 @@
-# Makefile for octave's emacs directory
-#
-# Copyright (C) 1997, 1998, 1999, 2003, 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_DATA = @INSTALL_DATA@
-
-EL_FILES = octave-hlp.el octave-inf.el octave-mod.el
-
-SOURCES = $(EL_FILES) octave-tags
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(EL_FILES) octave-tags octave-tags.1 NEWS FIXME README)
-
-all:
-.PHONY: all
-
-install install-strip:
-	$(INSTALL_SCRIPT) octave-tags $(DESTDIR)$(bindir)/octave-tags
-.PHONY: install install-strip
-
-uninstall:
-	rm -f $(DESTDIR)$(bindir)/octave-tags
-.PHONY: uninstall
-
-tags:
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-clean mostlyclean:
-.PHONY: clean mostlyclean
-
-distclean:
-	rm -f Makefile
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../`cat ../.fname`/emacs
-.PHONY: dist
new file mode 100644
--- /dev/null
+++ b/emacs/module.mk
@@ -0,0 +1,10 @@
+EXTRA_DIST += \
+  emacs/NEWS \
+  emacs/README \
+  emacs/TODO \
+  emacs/module.mk \
+  emacs/octave-hlp.el \
+  emacs/octave-inf.el \
+  emacs/octave-mod.el \
+  emacs/octave-tags \
+  emacs/octave-tags.1
deleted file mode 100644
--- a/examples/@FIRfilter/Makefile.in
+++ /dev/null
@@ -1,95 +0,0 @@
-# Makefile for octave's scripts/geometry directory
-#
-# Copyright (C) 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = @FIRfilter
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-define do-mkpkgadd
-$(top_srcdir)/scripts/mkpkgadd $(srcdir) > PKG_ADD.t
-if [ -n "`cat PKG_ADD.t`" ]; then \
-  mv PKG_ADD.t PKG_ADD ; \
-else \
-  rm -f PKG_ADD.t ; \
-fi
-endef
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = \
-  display.m \
-  FIRfilter_aggregation.m \
-  FIRfilter.m \
-  subsasgn.m \
-  subsref.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-.PHONY: install install-strip
-
-uninstall:
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/examples/$(script_sub_dir)
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/examples/@FIRfilter/module.mk
@@ -0,0 +1,12 @@
+FCN_FILE_DIRS += @FIRfilter
+
+EXTRA_DIST += @FIRfilter/module.mk
+
+at_FIRfilter_FCN_FILES = \
+  @FIRfilter/display.m \
+  @FIRfilter/FIRfilter_aggregation.m \
+  @FIRfilter/FIRfilter.m \
+  @FIRfilter/subsasgn.m \
+  @FIRfilter/subsref.m
+
+FCN_FILES += $(at_FIRfilter_FCN_FILES)
deleted file mode 100644
--- a/examples/@polynomial/Makefile.in
+++ /dev/null
@@ -1,104 +0,0 @@
-# Makefile for octave's scripts/geometry directory
-#
-# Copyright (C) 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = @polynomial
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-define do-mkpkgadd
-$(top_srcdir)/scripts/mkpkgadd $(srcdir) > PKG_ADD.t
-if [ -n "`cat PKG_ADD.t`" ]; then \
-  mv PKG_ADD.t PKG_ADD ; \
-else \
-  rm -f PKG_ADD.t ; \
-fi
-endef
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = \
-  display.m \
-  double.m \
-  end.m \
-  get.m \
-  mtimes.m \
-  numel.m \
-  plot.m \
-  polynomial.m \
-  polynomial_superiorto.m \
-  polyval.m \
-  roots.m \
-  set.m \
-  subsasgn.m \
-  subsref.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-.PHONY: install install-strip
-
-uninstall:
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/examples/$(script_sub_dir)
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/examples/@polynomial/module.mk
@@ -0,0 +1,21 @@
+FCN_FILE_DIRS += @polynomial
+
+EXTRA_DIST += @polynomial/module.mk
+
+at_polynomial_FCN_FILES = \
+  @polynomial/display.m \
+  @polynomial/double.m \
+  @polynomial/end.m \
+  @polynomial/get.m \
+  @polynomial/mtimes.m \
+  @polynomial/numel.m \
+  @polynomial/plot.m \
+  @polynomial/polynomial.m \
+  @polynomial/polynomial_superiorto.m \
+  @polynomial/polyval.m \
+  @polynomial/roots.m \
+  @polynomial/set.m \
+  @polynomial/subsasgn.m \
+  @polynomial/subsref.m
+
+FCN_FILES += $(at_polynomial_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,111 @@
+# Makefile for octave's examples directory
+#
+# Copyright (C) 1996, 1997, 2003, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ..
+
+include ../common.mk
+
+dist_archlib_SCRIPTS = info-emacs-info info-emacs-octave-help
+
+IMAGE_FILES = octave-sombrero.png
+
+EXTRA_DIST = \
+  $(IMAGE_FILES) \
+  addtwomatrices.cc \
+  celldemo.cc \
+  embedded.cc \
+  firstmexdemo.c \
+  fortdemo.cc \
+  fortsub.f \
+  funcdemo.cc \
+  globaldemo.cc \
+  hello.cc \
+  helloworld.cc \
+  make_int.cc \
+  mycell.c \
+  myfeval.c \
+  myfevalf.f \
+  myfunc.c \
+  myhello.c \
+  mypow2.c \
+  myprop.c \
+  myset.c \
+  mysparse.c \
+  mystring.c \
+  mystruct.c \
+  octave.desktop.in \
+  oregonator.cc \
+  oregonator.m \
+  paramdemo.cc \
+  standalone.cc \
+  stringdemo.cc \
+  structdemo.cc \
+  unwinddemo.cc
+
+FCN_FILE_DIRS =
+
+FCN_FILES =
+
+include @polynomial/module.mk
+include @FIRfilter/module.mk
+
+EXTRA_DIST += $(FCN_FILES)
+
+all-local: octave.desktop
+
+octave.desktop: octave.desktop.in Makefile
+	echo "making $@ from $<"
+	$(SED) < $< > $@-t \
+	  -e "s|%OCTAVE_IMAGEDIR%|${imagedir}|" \
+	  -e "s|%OCTAVE_PREFIX%|${prefix}|"
+	mv $@-t $@
+
+install-data-local: install-images install-desktop
+.PHONY: install-data-local
+
+uninstall-local: uninstall-images uninstall-desktop
+.PHONY: uninstall-local
+
+install-images:
+	$(MKDIR_P) $(DESTDIR)$(imagedir)
+	for f in $(IMAGE_FILES); do \
+	  rm -f $(DESTDIR)$(imagedir)/$$f; \
+	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(imagedir)/$$f; \
+	done
+.PHONY: install-images
+
+install-desktop:
+	-if test -n "$(DESKTOP_FILE_INSTALL)"; then \
+	  $(DESKTOP_FILE_INSTALL) --dir=$(DESTDIR)$(datadir)/applications \
+	    --vendor www.octave.org octave.desktop; \
+	fi
+.PHONY: install-desktop
+
+uninstall-images:
+	for f in $(IMAGE_FILES); do \
+	  rm -f $(DESTDIR)$(imagedir)/$$f; \
+	done
+.PHONY: uninstall-images
+
+uninstall-desktop:
+	if test -n "$(DESKTOP_FILE_INSTALL)"; then \
+	  rm -f $(DESTDIR)$(datadir)/applications/www.octave.org-octave.desktop; \
+	fi
+.PHONY: uninstall-desktop
\ No newline at end of file
deleted file mode 100644
--- a/examples/Makefile.in
+++ /dev/null
@@ -1,142 +0,0 @@
-# Makefile for octave's examples directory
-#
-# Copyright (C) 1996, 1997, 2003, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_DATA = @INSTALL_DATA@
-
-SUBDIRS = @polynomial @FIRfilter
-
-DISTSUBDIRS = $(SUBDIRS)
-
-SCRIPTS = info-emacs-info info-emacs-octave-help
-
-SOURCES = \
-  addtwomatrices.cc \
-  celldemo.cc \
-  embedded.cc \
-  firstmexdemo.c \
-  fortdemo.cc \
-  fortsub.f \
-  funcdemo.cc \
-  globaldemo.cc \
-  hello.cc \
-  helloworld.cc \
-  make_int.cc \
-  mycell.c \
-  myfeval.c \
-  myfevalf.f \
-  myfunc.c \
-  myhello.c \
-  mypow2.c \
-  myprop.c \
-  myset.c \
-  mysparse.c \
-  mystring.c \
-  mystruct.c \
-  octave.desktop.in \
-  oregonator.cc \
-  oregonator.m \
-  paramdemo.cc \
-  standalone.cc \
-  stringdemo.cc \
-  structdemo.cc \
-  unwinddemo.cc
-
-IMAGE_FILES = $(srcdir)/octave-sombrero.png
-IMAGE_FILES_NO_DIR = $(notdir $(IMAGE_FILES))
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES) $(SCRIPTS)) \
-	 $(IMAGE_FILES)
-
-all: $(SUBDIRS) octave.desktop
-.PHONY: all
-
-$(SUBDIRS):
-	$(MAKE) -C $@ all
-.PHONY: $(SUBDIRS)
-
-octave.desktop: octave.desktop.in Makefile ../Makeconf
-	echo "making $@ from $<"
-	$(SED) < $< > $@-t \
-	  -e "s|%OCTAVE_IMAGEDIR%|${imagedir}|" \
-	  -e "s|%OCTAVE_PREFIX%|${prefix}|"
-	mv $@-t $@
-
-install install-strip:
-	for f in $(SCRIPTS); do \
-	  $(INSTALL_SCRIPT) $(srcdir)/$$f $(DESTDIR)$(archlibdir)/$$f; \
-	done
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(imagedir)
-	for f in $(IMAGE_FILES_NO_DIR); do \
-	  rm -f $(DESTDIR)$(imagedir)/$$f; \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(imagedir)/$$f; \
-	done
-	-if test -n "$(DESKTOP_FILE_INSTALL)"; then \
-	  $(DESKTOP_FILE_INSTALL) --dir=$(DESTDIR)$(datadir)/applications \
-	    --vendor www.octave.org octave.desktop; \
-	fi
-.PHONY: install install-strip
-
-uninstall:
-	for f in $(SCRIPTS); do \
-	  rm -f $(DESTDIR)$(archlibdir)/$$f; \
-	done
-	for f in $(IMAGE_FILES_NO_DIR); do \
-	  rm -f $(DESTDIR)$(imagedir)/$$f; \
-	done
-	if test -n "$(DESKTOP_FILE_INSTALL)"; then \
-	  rm -f $(DESTDIR)$(datadir)/applications/www.octave.org-octave.desktop; \
-	fi
-.PHONY: uninstall
-
-tags:
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-clean mostlyclean:
-.PHONY: clean mostlyclean
-
-distclean::
-	rm -f Makefile octave.desktop
-.PHONY: distclean
-
-maintainer-clean:: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-distclean maintainer-clean::
-	@$(subdir-for-command)
-
-dist:
-	ln $(DISTFILES) ../`cat ../.fname`/examples
-	for dir in $(DISTSUBDIRS); do mkdir ../`cat ../.fname`/examples/$$dir; $(MAKE) -C $$dir $@; done
-.PHONY: dist
deleted file mode 100755
--- a/install-sh
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/sh
-
-#
-# install - install a program, script, or datafile
-# This comes from X11R5; it is not part of GNU.
-#
-# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-
-instcmd="$mvprog"
-chmodcmd=""
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-	-c) instcmd="$cpprog"
-	    shift
-	    continue;;
-
-	-m) chmodcmd="$chmodprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-o) chowncmd="$chownprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-g) chgrpcmd="$chgrpprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-s) stripcmd="$stripprog"
-	    shift
-	    continue;;
-
-	*)  if [ x"$src" = x ]
-	    then
-		src=$1
-	    else
-		dst=$1
-	    fi
-	    shift
-	    continue;;
-    esac
-done
-
-if [ x"$src" = x ]
-then
-	echo "install:  no input file specified"
-	exit 1
-fi
-
-if [ x"$dst" = x ]
-then
-	echo "install:  no destination specified"
-	exit 1
-fi
-
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-if [ -d $dst ]
-then
-	dst="$dst"/`basename $src`
-fi
-
-# Make a temp file name in the proper directory.
-
-dstdir=`dirname $dst`
-dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
-$doit $instcmd $src $dsttmp
-
-# and set any options; do chmod last to preserve setuid bits
-
-if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
-if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
-if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
-if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
-
-# Now rename the file to the real destination.
-
-$doit $rmcmd $dst
-$doit $mvcmd $dsttmp $dst
-
-
-exit 0
--- a/libcruft/ChangeLog
+++ b/libcruft/ChangeLog
@@ -1,3 +1,20 @@
+2009-11-10  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am, amos/module.mk, blas-xtra/module.mk,
+	blas/module.mk, daspk/module.mk, dasrt/module.mk, dassl/module.mk,
+	fftpack/module.mk, lapack-xtra/module.mk, lapack/module.mk,
+	misc/module.mk, odepack/module.mk, ordered-qz/module.mk,
+	quadpack/module.mk, ranlib/module.mk, slatec-err/module.mk,
+	slatec-fn/module.mk, villad/module.mk: New files.
+
+	* Makefile.in, Makerules.in, amos/Makefile.in,
+	blas-xtra/Makefile.in, blas/Makefile.in, daspk/Makefile.in,
+	dasrt/Makefile.in, dassl/Makefile.in, fftpack/Makefile.in,
+	lapack-xtra/Makefile.in, lapack/Makefile.in, misc/Makefile.in,
+	odepack/Makefile.in, ordered-qz/Makefile.in, quadpack/Makefile.in,
+	ranlib/Makefile.in, slatec-err/Makefile.in, slatec-fn/Makefile.in,
+	villad/Makefile.in: Delete.
+
 2009-09-17  John W. Eaton  <jwe@octave.org>
 
 	* misc/oct-dlldefs.h: Delete.
new file mode 100644
--- /dev/null
+++ b/libcruft/Makefile.am
@@ -0,0 +1,56 @@
+# Makefile for octave's libcruft directory
+#
+# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ..
+
+include ../common.mk
+
+octlib_LTLIBRARIES = libcruft.la
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+libcruft_la_SOURCES =
+
+libcruft_la_LDFLAGS = -release $(version) $(NO_UNDEFINED_LDFLAG)
+
+libcruft_la_LIBADD = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
+
+octinclude_HEADERS =
+
+EXTRA_DIST = ChangeLog STOP.patch mkf77def.in
+
+include amos/module.mk
+include blas/module.mk
+include blas-xtra/module.mk
+include daspk/module.mk
+include dasrt/module.mk
+include dassl/module.mk
+include fftpack/module.mk
+include lapack/module.mk
+include lapack-xtra/module.mk
+include misc/module.mk
+include odepack/module.mk
+include ordered-qz/module.mk
+include quadpack/module.mk
+include ranlib/module.mk
+include slatec-err/module.mk
+include slatec-fn/module.mk
+include villad/module.mk
deleted file mode 100644
--- a/libcruft/Makefile.in
+++ /dev/null
@@ -1,205 +0,0 @@
-# Makefile for octave's libcruft directory
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-# List of the directories that contain Fortran source.  Simply copying
-# a new .f file into one of these directories is sufficient to have it
-# added to $(LIBPRE)cruft.a.  If you add a new directory here, you also need
-# generate a new configure script in the top-level directory (edit
-# configure.in and run autoconf).
-
-# Some of the directories in libcruft may be only optionally built,
-# e.g. if they are already present on the system.  For these, their
-# dirname is substituted by configure and may be the empty string.
-
-CRUFT_DIRS = amos @BLAS_DIR@ blas-xtra daspk dasrt dassl \
-	@FFT_DIR@ @LAPACK_DIR@ lapack-xtra \
-	misc odepack ordered-qz quadpack ranlib \
-	slatec-err slatec-fn villad
-
-SUBDIRS = $(CRUFT_DIRS)
-
-DISTSUBDIRS = $(sort $(CRUFT_DIRS) blas fftpack lapack)
-
-CLEAN_SUBDIRS = $(DISTSUBDIRS)
-
-DISTFILES = Makefile.in ChangeLog Makerules.in $(SOURCES) \
-	STOP.patch mkf77def.in
-
-XTRA_CRUFT_SH_LDFLAGS = @XTRA_CRUFT_SH_LDFLAGS@
-SH_LDFLAGS += $(XTRA_CRUFT_SH_LDFLAGS)
-
-LINK_DEPS = $(BLAS_LIBS) $(FLIBS)
-
-all: libraries
-.PHONY: all
-
-mkf77def: mkf77def.in $(TOPDIR)/Makeconf
-	@$(do-subst-f77-mangling)
-	chmod a+rx $@
-
-$(SUBDIRS): mkf77def
-	$(MAKE) -C $@ all
-.PHONY: $(SUBDIRS)
-
-# FIXME -- this should build the shared library directly from
-# a normal archive file (created from PIC code, though).
-
-MISC_OBJ := misc/f77-extern.o misc/f77-fcn.o misc/lo-error.o \
-  misc/quit.o misc/cquit.o
-
-CRUFT_FSRC := $(foreach dir, $(SUBDIRS), $(wildcard $(srcdir)/$(dir)/*.f))
-CRUFT_OBJ2 := $(patsubst $(srcdir)/%, %, $(CRUFT_FSRC))
-CRUFT_OBJ1 := $(patsubst %.f, %.o, $(CRUFT_OBJ2))
-CRUFT_OBJ := $(CRUFT_OBJ1) $(MISC_OBJ)
-CRUFT_DEFS := $(patsubst %.f, %.def, $(CRUFT_OBJ2))
-
-ifeq ($(SHARED_LIBS), true)
-  ifdef FPICFLAG
-    CRUFT_OBJ_DIR := $(dir $(CRUFT_OBJ))
-    CRUFT_OBJ_PICDIR := $(addsuffix pic/, $(CRUFT_OBJ_DIR))
-    CRUFT_OBJ_NOTDIR := $(notdir $(CRUFT_OBJ))
-    CRUFT_PICOBJ := $(join $(CRUFT_OBJ_PICDIR), $(CRUFT_OBJ_NOTDIR))
-  else
-    CRUFT_PICOBJ := $(CRUFT_OBJ)
-  endif
-endif
-
-ifeq ($(SHARED_LIBS), true)
-  ifeq ($(STATIC_LIBS), true)
-    LIBRARIES = $(LIBPRE)cruft.$(LIBEXT) $(SHLPRE)cruft.$(SHLEXT_VER)
-  else
-    LIBRARIES = $(SHLPRE)cruft.$(SHLEXT_VER)
-  endif
-else
-  ifeq ($(STATIC_LIBS), true)
-    LIBRARIES = $(LIBPRE)cruft.$(LIBEXT)
-  else
-    LIBRARIES =
-  endif
-endif
-
-$(CRUFT_DEFS): $(SUBDIRS)
-
-cruft.def: $(CRUFT_DEFS)
-	echo "EXPORTS" > $@
-	cat $(CRUFT_DEFS) >> $@
-
-libraries: cruft.def
-	$(MAKE) $(LIBRARIES)
-.PHONY: libraries
-
-$(LIBPRE)cruft.$(LIBEXT): $(CRUFT_OBJ)
-	rm -f $@
-	$(AR) $(ARFLAGS) $@ $^
-	$(RANLIB) $@
-
-$(SHLPRE)cruft.$(SHLEXT_VER): $(SHLPRE)cruft.$(SHLEXT)
-	rm -f $@
-	$(LN_S) $< $@
-
-$(SHLPRE)cruft.$(SHLEXT): $(CRUFT_PICOBJ)
-	rm -f $@
-	$(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ $^ $(LINK_DEPS)
-
-$(CRUFT_OBJ):
-
-check: all
-.PHONY: check
-
-install install-strip uninstall::
-	@$(subdir-for-command)
-
-clean mostlyclean distclean maintainer-clean::
-	@$(foreach d, $(CLEAN_SUBDIRS), $(do-subdir-for-command))
-
-install::
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octlibdir)
-	if $(STATIC_LIBS); then \
-	  rm -f $(DESTDIR)$(octlibdir)/$(LIBPRE)cruft.$(LIBEXT) ; \
-	  $(INSTALL_DATA) $(LIBPRE)cruft.$(LIBEXT) \
-	    $(DESTDIR)$(octlibdir)/$(LIBPRE)cruft.$(LIBEXT) ; \
-	  $(RANLIB) $(DESTDIR)$(octlibdir)/$(LIBPRE)cruft.$(LIBEXT) ; \
-	fi
-	if $(SHARED_LIBS); then \
-	  rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)cruft.$(SHLLIB_VER); \
-	  $(INSTALL) \
-	    $(SHLLIBPRE)cruft.$(SHLLIB) $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)cruft.$(SHLLIB_VER); \
-	  rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)cruft.$(SHLLIB); \
-	  (cd $(DESTDIR)$(octlibdir); \
-	  $(LN_S) $(SHLLIBPRE)cruft.$(SHLLIB_VER) $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)cruft.$(SHLLIB)); \
-	  if  test x$(SHLBIN) != x ; then \
-	    rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)cruft.$(SHLBIN); \
-	    $(INSTALL_PROGRAM) \
-	      $(SHLBINPRE)cruft.$(SHLBIN) $(DESTDIR)$(bindir)/$(SHLBINPRE)cruft.$(SHLBIN); \
-	  fi; \
-	fi
-
-install-strip::
-	$(MAKE) INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s" install
-
-uninstall::
-	rm -f $(DESTDIR)$(octlibdir)/$(LIBPRE)cruft.$(LIBEXT)
-	rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)cruft.$(SHLLIB)
-	rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)cruft.$(SHLLIB_VER)
-	if test x$(SHLBIN) != x; then \
-	  rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)cruft.$(SHLBIN); \
-	  rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)cruft.$(SHLBIN_VER); \
-	fi
-
-tags TAGS:: $(SOURCES)
-	$(SUBDIR_FOR_COMMAND)
-
-tags::
-	ctags $(SOURCES)
-
-TAGS:: $(SOURCES)
-	etags $(SOURCES)
-
-clean mostlyclean distclean maintainer-clean::
-	rm -f $(LIBPRE)cruft.$(LIBEXT)
-	rm -f $(SHLPRE)cruft.$(SHLEXT_VER) $(SHLPRE)cruft.$(SHLEXT)
-	rm -f $(SHLBINPRE)cruft.$(SHLBIN_VER) $(SHLBINPRE)cruft.$(SHLBIN)
-	rm -f $(CRUFT_DEFS) cruft.def mkf77def
-
-distclean maintainer-clean::
-	rm -f Makefile Makerules so_locations
-
-maintainer-clean::
-	rm -f tags TAGS
-
-dist:
-	for dir in $(DISTSUBDIRS); do mkdir ../`cat ../.fname`/libcruft/$$dir; $(MAKE) -C $$dir $@; done
-	ln $(addprefix $(srcdir)/, $(DISTFILES)) ../`cat ../.fname`/libcruft
-.PHONY: dist
-
-.NOTPARALLEL:
deleted file mode 100644
--- a/libcruft/Makerules.in
+++ /dev/null
@@ -1,145 +0,0 @@
-# @configure_input@
-#
-# Common rules for octave's libcruft directories.
-#
-# FIXME -- assumes that the libcruft directory tree is only
-# one level deep.
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2003, 2005,
-#               2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-
-DLL_CDEFS = @CRUFT_DLL_DEFS@
-DLL_CXXDEFS = @CRUFT_DLL_DEFS@
-
-CRUFT_FSRC = $(addprefix $(srcdir)/, $(FSRC))
-CRUFT_CSRC = $(addprefix $(srcdir)/, $(CSRC) $(CEXTRA))
-CRUFT_CXXSRC = $(addprefix $(srcdir)/, $(CXXSRC))
-
-CRUFT_SRC = $(CRUFT_FSRC) $(CRUFT_CSRC) $(CRUFT_CXXSRC)
-
-CRUFT_FBASE = $(basename $(notdir $(CRUFT_FSRC)))
-CRUFT_CBASE = $(basename $(notdir $(CRUFT_CSRC)))
-CRUFT_CXXBASE = $(basename $(notdir $(CRUFT_CXXSRC)))
-
-CRUFT_BASE = $(CRUFT_FBASE) $(CRUFT_CBASE) $(CRUFT_CXXBASE)
-
-CRUFT_FOBJ = $(addsuffix .o, $(CRUFT_FBASE))
-CRUFT_COBJ = $(addsuffix .o, $(CRUFT_CBASE))
-CRUFT_CXXOBJ = $(addsuffix .o, $(CRUFT_CXXBASE))
-
-CRUFT_OBJ = $(CRUFT_FOBJ) $(CRUFT_COBJ) $(CRUFT_CXXOBJ)
-
-CRUFT_FDEFS = $(patsubst %.f, %.def, $(notdir $(CRUFT_FSRC)))
-CRUFT_CDEFS = $(patsubst %.c, %.def, $(notdir $(CRUFT_CSRC)))
-CRUFT_CXXDEFS = $(patsubst %.cc, %.def, $(notdir $(CRUFT_CXXSRC)))
-
-CRUFT_DEFS = $(CRUFT_FDEFS) $(CRUFT_CDEFS) $(CRUFT_CXXDEFS)
-
-DISTFILES = $(CRUFT_SRC) $(addprefix $(srcdir)/, Makefile.in $(SPECIAL))
-
-ifeq ($(SHARED_LIBS), true)
-  ifdef FPICFLAG
-    CRUFT_FPICOBJ := $(addprefix pic/, $(CRUFT_FOBJ))
-  else
-    CRUFT_FPICOBJ := $(CRUFT_FOBJ)
-  endif
-  ifdef CPICFLAG
-    CRUFT_CPICOBJ := $(addprefix pic/, $(CRUFT_COBJ) $(CEXTRA))
-  else
-    CRUFT_CPICOBJ := $(CRUFT_COBJ) $(CEXTRA)
-  endif
-  ifdef CXXPICFLAG
-    CRUFT_CXXPICOBJ := $(addprefix pic/, $(CRUFT_CXXOBJ))
-  else
-    CRUFT_CXXPICOBJ := $(CRUFT_CXXOBJ)
-  endif
-  CRUFT_PICOBJ := $(CRUFT_FPICOBJ) $(CRUFT_CPICOBJ) $(CRUFT_CXXPICOBJ)
-endif
-
-CWD = $(shell pwd)
-THISDIR = $(notdir $(CWD))
-
-ifeq ($(STATIC_LIBS), true)
-  LIBCRUFT_DEPEND := $(CRUFT_OBJ)
-.PRECIOUS: $(CRUFT_OBJ)
-endif
-
-ifeq ($(SHARED_LIBS), true)
-  LIBCRUFT_PICDEPEND := $(CRUFT_PICOBJ)
-.PRECIOUS: $(CRUFT_PICOBJ)
-endif
-
-all: pic $(CRUFT_DEFS) $(LIBCRUFT_DEPEND) $(LIBCRUFT_PICDEPEND)
-	@echo "warning: run make in parent directory to update libraries"
-.PHONY: all
-
-stmp-pic: pic
-	@if [ -f stmp-pic ]; then \
-	  true; \
-	else \
-	  echo "touch stmp-pic"; \
-	  touch stmp-pic; \
-	fi
-
-pic:
-	@if [ -d pic ]; then \
-	  true; \
-	else \
-	  echo "mkdir pic"; \
-	  mkdir pic; \
-	fi
-
-$(CRUFT_PICOBJ): stmp-pic
-
-$(CRUFT_DEFS): $(TOPDIR)/libcruft/mkf77def
-
-%.def : %.f
-	@echo "making $@ from $<"
-	@$(TOPDIR)/libcruft/mkf77def < $< > $@-t
-	@mv $@-t $@
-
-install:: all
-.PHONY: install
-
-install-strip:: all
-.PHONY: install-strip
-
-uninstall::
-.PHONY: uninstall
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-clean mostlyclean distclean maintainer-clean::
-	rm -f $(MAKEDEPS) $(CRUFT_OBJ) $(CRUFT_PICOBJ) $(CRUFT_DEFS)
-	-rmdir pic
-	rm -f stmp-pic
-.PHONY: clean mostlyclean
-
-distclean maintainer-clean::
-	rm -f tags TAGS Makefile
-.PHONY: distclean maintainer-clean
-
-dist:
-	ln $(EXTERNAL_DISTFILES) ../../`cat ../../.fname`/libcruft/$(THISDIR)
-.PHONY: dist
deleted file mode 100644
--- a/libcruft/amos/Makefile.in
+++ /dev/null
@@ -1,41 +0,0 @@
-# Makefile for octave's libcruft/amos directory
-#
-# Copyright (C) 1998, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = cacai.f cacon.f cbesh.f cbesi.f cbesj.f cbesk.f cbesy.f cbinu.f \
-  cbuni.f cbunk.f cunk1.f cunk2.f crati.f cshch.f cuni1.f \
-  cuoik.f cairy.f cbiry.f ckscl.f cs1s2.f cuchk.f cuni2.f cwrsk.f \
-  casyi.f cbknu.f cmlri.f cseri.f cunhj.f cunik.f dgamln.f gamln.f \
-  xzabs.f xzexp.f xzlog.f xzsqrt.f zacai.f zacon.f \
-  zairy.f zasyi.f zbesh.f zbesi.f zbesj.f zbesk.f zbesy.f zbinu.f \
-  zbiry.f zbknu.f zbuni.f zbunk.f zdiv.f zkscl.f zmlri.f zmlt.f \
-  zrati.f zs1s2.f zseri.f zshch.f zuchk.f zunhj.f zuni1.f zuni2.f \
-  zunik.f zunk1.f zunk2.f zuoik.f zwrsk.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/amos/module.mk
@@ -0,0 +1,69 @@
+EXTRA_DIST += amos/module.mk
+
+libcruft_la_SOURCES += \
+  amos/cacai.f \
+  amos/cacon.f \
+  amos/cbesh.f \
+  amos/cbesi.f \
+  amos/cbesj.f \
+  amos/cbesk.f \
+  amos/cbesy.f \
+  amos/cbinu.f \
+  amos/cbuni.f \
+  amos/cbunk.f \
+  amos/cunk1.f \
+  amos/cunk2.f \
+  amos/crati.f \
+  amos/cshch.f \
+  amos/cuni1.f \
+  amos/cuoik.f \
+  amos/cairy.f \
+  amos/cbiry.f \
+  amos/ckscl.f \
+  amos/cs1s2.f \
+  amos/cuchk.f \
+  amos/cuni2.f \
+  amos/cwrsk.f \
+  amos/casyi.f \
+  amos/cbknu.f \
+  amos/cmlri.f \
+  amos/cseri.f \
+  amos/cunhj.f \
+  amos/cunik.f \
+  amos/dgamln.f \
+  amos/gamln.f \
+  amos/xzabs.f \
+  amos/xzexp.f \
+  amos/xzlog.f \
+  amos/xzsqrt.f \
+  amos/zacai.f \
+  amos/zacon.f \
+  amos/zairy.f \
+  amos/zasyi.f \
+  amos/zbesh.f \
+  amos/zbesi.f \
+  amos/zbesj.f \
+  amos/zbesk.f \
+  amos/zbesy.f \
+  amos/zbinu.f \
+  amos/zbiry.f \
+  amos/zbknu.f \
+  amos/zbuni.f \
+  amos/zbunk.f \
+  amos/zdiv.f \
+  amos/zkscl.f \
+  amos/zmlri.f \
+  amos/zmlt.f \
+  amos/zrati.f \
+  amos/zs1s2.f \
+  amos/zseri.f \
+  amos/zshch.f \
+  amos/zuchk.f \
+  amos/zunhj.f \
+  amos/zuni1.f \
+  amos/zuni2.f \
+  amos/zunik.f \
+  amos/zunk1.f \
+  amos/zunk2.f \
+  amos/zuoik.f \
+  amos/zwrsk.f
deleted file mode 100644
--- a/libcruft/blas-xtra/Makefile.in
+++ /dev/null
@@ -1,35 +0,0 @@
-# Makefile for octave's libcruft/blas-xtra directory
-#
-# Copyright (C) 2000, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = xddot.f xdnrm2.f xdznrm2.f xzdotc.f xzdotu.f \
-	xsdot.f xsnrm2.f xscnrm2.f xcdotc.f xcdotu.f \
-	xerbla.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/blas-xtra/module.mk
@@ -0,0 +1,14 @@
+EXTRA_DIST += blas-xtra/module.mk
+
+libcruft_la_SOURCES += \
+  blas-xtra/xddot.f \
+  blas-xtra/xdnrm2.f \
+  blas-xtra/xdznrm2.f \
+  blas-xtra/xzdotc.f \
+  blas-xtra/xzdotu.f \
+  blas-xtra/xsdot.f \
+  blas-xtra/xsnrm2.f \
+  blas-xtra/xscnrm2.f \
+  blas-xtra/xcdotc.f \
+  blas-xtra/xcdotu.f \
+  blas-xtra/xerbla.f
deleted file mode 100644
--- a/libcruft/blas/Makefile.in
+++ /dev/null
@@ -1,46 +0,0 @@
-# Makefile for octave's libcruft/blas directory
-#
-# Copyright (C) 1993, 1994, 1995, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = dasum.f daxpy.f dcabs1.f dcopy.f ddot.f dgemm.f dgemv.f \
-  dger.f dmach.f dnrm2.f drot.f dscal.f dswap.f dsymv.f dsyr.f dsymm.f \
-  dsyr2.f dsyr2k.f dsyrk.f dtbsv.f dtrmm.f dtrmv.f dtrsm.f dtrsv.f \
-  dzasum.f dznrm2.f icamax.f idamax.f isamax.f izamax.f lsame.f sdot.f \
-  sgemm.f sgemv.f sscal.f ssyrk.f strsm.f zaxpy.f zcopy.f zdotc.f \
-  zdotu.f zdrot.f zdscal.f zgemm.f zgemv.f zgerc.f zgeru.f zhemv.f zhemm.f \
-  zher.f zher2.f zher2k.f zherk.f zscal.f zswap.f zsyrk.f ztbsv.f ztrmm.f \
-  ztrmv.f ztrsm.f ztrsv.f sasum.f saxpy.f scabs1.f scopy.f \
-  sger.f smach.f snrm2.f srot.f sswap.f ssymv.f ssyr.f ssymm.f \
-  ssyr2.f ssyr2k.f stbsv.f strmm.f strmv.f strsv.f \
-  scasum.f scnrm2.f caxpy.f ccopy.f cdotc.f cdotu.f chemm.f \
-  csrot.f csscal.f cgemm.f cgemv.f cgerc.f cgeru.f chemv.f cher.f \
-  cher2.f cher2k.f cherk.f cscal.f cswap.f csyrk.f ctbsv.f ctrmm.f ctrmv.f \
-  ctrsm.f ctrsv.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/blas/module.mk
@@ -0,0 +1,114 @@
+EXTRA_DIST += blas/module.mk
+
+BLAS_SRC = \
+  blas/dasum.f \
+  blas/daxpy.f \
+  blas/dcabs1.f \
+  blas/dcopy.f \
+  blas/ddot.f \
+  blas/dgemm.f \
+  blas/dgemv.f \
+  blas/dger.f \
+  blas/dmach.f \
+  blas/dnrm2.f \
+  blas/drot.f \
+  blas/dscal.f \
+  blas/dswap.f \
+  blas/dsymv.f \
+  blas/dsyr.f \
+  blas/dsymm.f \
+  blas/dsyr2.f \
+  blas/dsyr2k.f \
+  blas/dsyrk.f \
+  blas/dtbsv.f \
+  blas/dtrmm.f \
+  blas/dtrmv.f \
+  blas/dtrsm.f \
+  blas/dtrsv.f \
+  blas/dzasum.f \
+  blas/dznrm2.f \
+  blas/icamax.f \
+  blas/idamax.f \
+  blas/isamax.f \
+  blas/izamax.f \
+  blas/lsame.f \
+  blas/sdot.f \
+  blas/sgemm.f \
+  blas/sgemv.f \
+  blas/sscal.f \
+  blas/ssyrk.f \
+  blas/strsm.f \
+  blas/zaxpy.f \
+  blas/zcopy.f \
+  blas/zdotc.f \
+  blas/zdotu.f \
+  blas/zdrot.f \
+  blas/zdscal.f \
+  blas/zgemm.f \
+  blas/zgemv.f \
+  blas/zgerc.f \
+  blas/zgeru.f \
+  blas/zhemv.f \
+  blas/zhemm.f \
+  blas/zher.f \
+  blas/zher2.f \
+  blas/zher2k.f \
+  blas/zherk.f \
+  blas/zscal.f \
+  blas/zswap.f \
+  blas/zsyrk.f \
+  blas/ztbsv.f \
+  blas/ztrmm.f \
+  blas/ztrmv.f \
+  blas/ztrsm.f \
+  blas/ztrsv.f \
+  blas/sasum.f \
+  blas/saxpy.f \
+  blas/scabs1.f \
+  blas/scopy.f \
+  blas/sger.f \
+  blas/smach.f \
+  blas/snrm2.f \
+  blas/srot.f \
+  blas/sswap.f \
+  blas/ssymv.f \
+  blas/ssyr.f \
+  blas/ssymm.f \
+  blas/ssyr2.f \
+  blas/ssyr2k.f \
+  blas/stbsv.f \
+  blas/strmm.f \
+  blas/strmv.f \
+  blas/strsv.f \
+  blas/scasum.f \
+  blas/scnrm2.f \
+  blas/caxpy.f \
+  blas/ccopy.f \
+  blas/cdotc.f \
+  blas/cdotu.f \
+  blas/chemm.f \
+  blas/csrot.f \
+  blas/csscal.f \
+  blas/cgemm.f \
+  blas/cgemv.f \
+  blas/cgerc.f \
+  blas/cgeru.f \
+  blas/chemv.f \
+  blas/cher.f \
+  blas/cher2.f \
+  blas/cher2k.f \
+  blas/cherk.f \
+  blas/cscal.f \
+  blas/cswap.f \
+  blas/csyrk.f \
+  blas/ctbsv.f \
+  blas/ctrmm.f \
+  blas/ctrmv.f \
+  blas/ctrsm.f \
+  blas/ctrsv.f
+
+if AMCOND_HAVE_BLAS
+  EXTRA_DIST += $(BLAS_SRC)
+else
+  libcruft_la_SOURCES += $(BLAS_SRC)
+endif
deleted file mode 100644
--- a/libcruft/daspk/Makefile.in
+++ /dev/null
@@ -1,36 +0,0 @@
-# Makefile for octave's libcruft/daspk directory
-#
-# Copyright (C) 2002, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = datv.f dcnst0.f dcnstr.f ddasic.f ddasid.f ddasik.f ddaspk.f \
-  ddstp.f ddwnrm.f dfnrmd.f dfnrmk.f dhels.f dheqr.f dinvwt.f \
-  dlinsd.f dlinsk.f dmatd.f dnedd.f dnedk.f dnsd.f dnsid.f dnsik.f \
-  dnsk.f dorth.f dslvd.f dslvk.f dspigm.f dyypnw.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/daspk/module.mk
@@ -0,0 +1,31 @@
+EXTRA_DIST += daspk/module.mk
+
+libcruft_la_SOURCES += \
+  daspk/datv.f \
+  daspk/dcnst0.f \
+  daspk/dcnstr.f \
+  daspk/ddasic.f \
+  daspk/ddasid.f \
+  daspk/ddasik.f \
+  daspk/ddaspk.f \
+  daspk/ddstp.f \
+  daspk/ddwnrm.f \
+  daspk/dfnrmd.f \
+  daspk/dfnrmk.f \
+  daspk/dhels.f \
+  daspk/dheqr.f \
+  daspk/dinvwt.f \
+  daspk/dlinsd.f \
+  daspk/dlinsk.f \
+  daspk/dmatd.f \
+  daspk/dnedd.f \
+  daspk/dnedk.f \
+  daspk/dnsd.f \
+  daspk/dnsid.f \
+  daspk/dnsik.f \
+  daspk/dnsk.f \
+  daspk/dorth.f \
+  daspk/dslvd.f \
+  daspk/dslvk.f \
+  daspk/dspigm.f \
+  daspk/dyypnw.f
deleted file mode 100644
--- a/libcruft/dasrt/Makefile.in
+++ /dev/null
@@ -1,33 +0,0 @@
-# Makefile for octave's libcruft/dasrt directory
-#
-# Copyright (C) 2002, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = ddasrt.f drchek.f droots.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/dasrt/module.mk
@@ -0,0 +1,6 @@
+EXTRA_DIST += dasrt/module.mk
+
+libcruft_la_SOURCES += \
+  dasrt/ddasrt.f \
+  dasrt/drchek.f \
+  dasrt/droots.f
deleted file mode 100644
--- a/libcruft/dassl/Makefile.in
+++ /dev/null
@@ -1,33 +0,0 @@
-# Makefile for octave's libcruft/dassl directory
-#
-# Copyright (C) 1993, 1994, 1995, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = ddaini.f ddajac.f ddanrm.f ddaslv.f ddassl.f ddastp.f ddatrp.f ddawts.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/dassl/module.mk
@@ -0,0 +1,11 @@
+EXTRA_DIST += dassl/module.mk
+
+libcruft_la_SOURCES += \
+  dassl/ddaini.f \
+  dassl/ddajac.f \
+  dassl/ddanrm.f \
+  dassl/ddaslv.f \
+  dassl/ddassl.f \
+  dassl/ddastp.f \
+  dassl/ddatrp.f \
+  dassl/ddawts.f
deleted file mode 100644
--- a/libcruft/fftpack/Makefile.in
+++ /dev/null
@@ -1,37 +0,0 @@
-# Makefile for octave's libcruft/fftpack directory
-#
-# Copyright (C) 1993, 1994, 1995, 1997, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES) $(srcdir)/fftpack.doc
-
-FSRC = cfftb.f cfftb1.f cfftf.f cfftf1.f cffti.f cffti1.f passb.f \
-  passb2.f passb3.f passb4.f passb5.f passf.f passf2.f passf3.f \
-  passf4.f passf5.f zfftb.f zfftb1.f zfftf.f zfftf1.f zffti.f zffti1.f \
-  zpassb.f zpassb2.f zpassb3.f zpassb4.f zpassb5.f zpassf.f zpassf2.f \
-  zpassf3.f zpassf4.f zpassf5.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/fftpack/module.mk
@@ -0,0 +1,43 @@
+EXTRA_DIST += \
+  fftpack/module.mk \
+  fftpack/fftpack.doc
+
+FFTPACK_SRC = \
+  fftpack/cfftb.f \
+  fftpack/cfftb1.f \
+  fftpack/cfftf.f \
+  fftpack/cfftf1.f \
+  fftpack/cffti.f \
+  fftpack/cffti1.f \
+  fftpack/passb.f \
+  fftpack/passb2.f \
+  fftpack/passb3.f \
+  fftpack/passb4.f \
+  fftpack/passb5.f \
+  fftpack/passf.f \
+  fftpack/passf2.f \
+  fftpack/passf3.f \
+  fftpack/passf4.f \
+  fftpack/passf5.f \
+  fftpack/zfftb.f \
+  fftpack/zfftb1.f \
+  fftpack/zfftf.f \
+  fftpack/zfftf1.f \
+  fftpack/zffti.f \
+  fftpack/zffti1.f \
+  fftpack/zpassb.f \
+  fftpack/zpassb2.f \
+  fftpack/zpassb3.f \
+  fftpack/zpassb4.f \
+  fftpack/zpassb5.f \
+  fftpack/zpassf.f \
+  fftpack/zpassf2.f \
+  fftpack/zpassf3.f \
+  fftpack/zpassf4.f \
+  fftpack/zpassf5.f
+
+if AMCOND_HAVE_FFTW
+  EXTRA_DIST += $(FFTPACK_SRC)
+else
+  libcruft_la_SOURCES += $(FFTPACK_SRC)
+endif
deleted file mode 100644
--- a/libcruft/lapack-xtra/Makefile.in
+++ /dev/null
@@ -1,33 +0,0 @@
-# Makefile for octave's libcruft/lapack-xtra directory
-#
-# Copyright (C) 2000, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = xclange.f xdlamch.f xdlange.f xilaenv.f xslamch.f xslange.f xzlange.f 
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/lapack-xtra/module.mk
@@ -0,0 +1,10 @@
+EXTRA_DIST += lapack-xtra/module.mk
+
+libcruft_la_SOURCES += \
+  lapack-xtra/xclange.f \
+  lapack-xtra/xdlamch.f \
+  lapack-xtra/xdlange.f \
+  lapack-xtra/xilaenv.f \
+  lapack-xtra/xslamch.f \
+  lapack-xtra/xslange.f \
+  lapack-xtra/xzlange.f
deleted file mode 100644
--- a/libcruft/lapack/Makefile.in
+++ /dev/null
@@ -1,160 +0,0 @@
-# Makefile for octave's libcruft/lapack directory
-#
-# Copyright (C) 1993, 1994, 1995, 2005, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = 	cbdsqr.f cgbcon.f cgbtf2.f cgbtrf.f cgbtrs.f cgbtrs.f \
-	cgebak.f cgebal.f cgebd2.f cgebrd.f cgecon.f cgecon.f \
-	cgeesx.f cgeev.f cgehd2.f cgehrd.f cgelq2.f cgelq2.f \
-	cgelqf.f cgelsd.f cgelss.f cgelsy.f cgeqp3.f cgeqp3.f \
-	cgeqpf.f cgeqr2.f cgeqrf.f cgesvd.f cgesv.f cgesv.f \
-	cgetf2.f cgetrf.f cgetri.f cgetrs.f cggbak.f cggbak.f \
-	cggbal.f cggev.f cgghrd.f cgtsv.f cgttrf.f cgttrf.f \
-	cgttrs.f cgtts2.f cheev.f chetd2.f chetrd.f chetrd.f \
-	chgeqz.f chseqr.f clabrd.f clacgv.f clacn2.f clacn2.f \
-	clacon.f clacpy.f cladiv.f clahqr.f clahr2.f clahr2.f \
-	clahrd.f claic1.f clals0.f clalsa.f clalsd.f clalsd.f \
-	clange.f clanhe.f clanhs.f clantr.f claqp2.f claqp2.f \
-	claqps.f claqr0.f claqr1.f claqr2.f claqr3.f claqr3.f \
-	claqr4.f claqr5.f clarfb.f clarf.f clarfg.f clarfg.f \
-	clarft.f clarfx.f clartg.f clarzb.f clarz.f clarz.f \
-	clarzt.f clascl.f claset.f clasr.f classq.f classq.f \
-	claswp.f clatbs.f clatrd.f clatrs.f clatrz.f clatrz.f \
-	clauu2.f clauum.f cpbcon.f cpbtf2.f cpbtrf.f cpbtrf.f \
-	cpbtrs.f cpocon.f cpotf2.f cpotrf.f cpotri.f cpotri.f \
-	cpotrs.f cptsv.f cpttrf.f cpttrs.f cptts2.f cptts2.f \
-	crot.f csrscl.f csteqr.f ctgevc.f ctrcon.f ctrcon.f \
-	ctrevc.f ctrexc.f ctrsen.f ctrsyl.f ctrti2.f ctrti2.f \
-	ctrtri.f ctrtrs.f ctzrzf.f cung2l.f cung2r.f cung2r.f \
-	cungbr.f cunghr.f cungl2.f cunglq.f cungql.f cungql.f \
-	cungqr.f cungtr.f cunm2r.f cunmbr.f cunml2.f cunml2.f \
-	cunmlq.f cunmqr.f cunmr3.f cunmrz.f dbdsqr.f dbdsqr.f \
-	dgbcon.f dgbtf2.f dgbtrf.f dgbtrs.f dgebak.f dgebak.f \
-	dgebal.f dgebd2.f dgebrd.f dgecon.f dgeesx.f dgeesx.f \
-	dgeev.f dgehd2.f dgehrd.f dgelq2.f dgelqf.f dgelqf.f \
-	dgelsd.f dgelss.f dgelsy.f dgeqp3.f dgeqpf.f dgeqpf.f \
-	dgeqr2.f dgeqrf.f dgesvd.f dgesv.f dgetf2.f dgetf2.f \
-	dgetrf.f dgetri.f dgetrs.f dggbak.f dggbal.f dggbal.f \
-	dggev.f dgghrd.f dgtsv.f dgttrf.f dgttrs.f dgttrs.f \
-	dgtts2.f dhgeqz.f dhseqr.f dlabad.f dlabrd.f dlabrd.f \
-	dlacn2.f dlacon.f dlacpy.f dladiv.f dlae2.f dlae2.f \
-	dlaed6.f dlaev2.f dlaexc.f dlag2.f dlahqr.f dlahqr.f \
-	dlahr2.f dlahrd.f dlaic1.f dlaln2.f dlals0.f dlals0.f \
-	dlalsa.f dlalsd.f dlamc1.f dlamc2.f dlamc3.f dlamc3.f \
-	dlamc4.f dlamc5.f dlamch.f dlamrg.f dlange.f dlange.f \
-	dlanhs.f dlanst.f dlansy.f dlantr.f dlanv2.f dlanv2.f \
-	dlapy2.f dlapy3.f dlaqp2.f dlaqps.f dlaqr0.f dlaqr0.f \
-	dlaqr1.f dlaqr2.f dlaqr3.f dlaqr4.f dlaqr5.f dlaqr5.f \
-	dlarfb.f dlarf.f dlarfg.f dlarft.f dlarfx.f dlarfx.f \
-	dlartg.f dlarzb.f dlarz.f dlarzt.f dlas2.f dlas2.f \
-	dlascl.f dlasd0.f dlasd1.f dlasd2.f dlasd3.f dlasd3.f \
-	dlasd4.f dlasd5.f dlasd6.f dlasd7.f dlasd8.f dlasd8.f \
-	dlasda.f dlasdq.f dlasdt.f dlaset.f dlasq1.f dlasq1.f \
-	dlasq2.f dlasq3.f dlasq4.f dlasq5.f dlasq6.f dlasq6.f \
-	dlasr.f dlasrt.f dlassq.f dlasv2.f dlaswp.f dlaswp.f \
-	dlasy2.f dlatbs.f dlatrd.f dlatrs.f dlatrz.f dlatrz.f \
-	dlauu2.f dlauum.f dlazq3.f dlazq4.f dorg2l.f dorg2l.f \
-	dorg2r.f dorgbr.f dorghr.f dorgl2.f dorglq.f dorglq.f \
-	dorgql.f dorgqr.f dorgtr.f dorm2r.f dormbr.f dormbr.f \
-	dorml2.f dormlq.f dormqr.f dormr3.f dormrz.f dormrz.f \
-	dpbcon.f dpbtf2.f dpbtrf.f dpbtrs.f dpocon.f dpocon.f \
-	dpotf2.f dpotrf.f dpotri.f dpotrs.f dptsv.f dptsv.f \
-	dpttrf.f dpttrs.f dptts2.f drscl.f dsteqr.f dsteqr.f \
-	dsterf.f dsyev.f dsytd2.f dsytrd.f dtgevc.f dtgevc.f \
-	dtrcon.f dtrevc.f dtrexc.f dtrsen.f dtrsyl.f dtrsyl.f \
-	dtrti2.f dtrtri.f dtrtrs.f dtzrzf.f dzsum1.f dzsum1.f \
-	icmax1.f ieeeck.f ilaenv.f iparmq.f izmax1.f izmax1.f \
-	sbdsqr.f scsum1.f sgbcon.f sgbtf2.f sgbtrf.f sgbtrf.f \
-	sgbtrs.f sgebak.f sgebal.f sgebd2.f sgebrd.f sgebrd.f \
-	sgecon.f sgeesx.f sgeev.f sgehd2.f sgehrd.f sgehrd.f \
-	sgelq2.f sgelqf.f sgelsd.f sgelss.f sgelsy.f sgelsy.f \
-	sgeqp3.f sgeqpf.f sgeqr2.f sgeqrf.f sgesvd.f sgesvd.f \
-	sgesv.f sgetf2.f sgetrf.f sgetri.f sgetrs.f sgetrs.f \
-	sggbak.f sggbal.f sggev.f sgghrd.f sgtsv.f sgtsv.f \
-	sgttrf.f sgttrs.f sgtts2.f shgeqz.f shseqr.f shseqr.f \
-	slabad.f slabrd.f slacn2.f slacon.f slacpy.f slacpy.f \
-	sladiv.f slae2.f slaed6.f slaev2.f slaexc.f slaexc.f \
-	slag2.f slahqr.f slahr2.f slahrd.f slaic1.f slaic1.f \
-	slaln2.f slals0.f slalsa.f slalsd.f slamc1.f slamc1.f \
-	slamc2.f slamc3.f slamc4.f slamc5.f slamch.f slamch.f \
-	slamrg.f slange.f slanhs.f slanst.f slansy.f slansy.f \
-	slantr.f slanv2.f slapy2.f slapy3.f slaqp2.f slaqp2.f \
-	slaqps.f slaqr0.f slaqr1.f slaqr2.f slaqr3.f slaqr3.f \
-	slaqr4.f slaqr5.f slarfb.f slarf.f slarfg.f slarfg.f \
-	slarft.f slarfx.f slartg.f slarzb.f slarz.f slarz.f \
-	slarzt.f slas2.f slascl.f slasd0.f slasd1.f slasd1.f \
-	slasd2.f slasd3.f slasd4.f slasd5.f slasd6.f slasd6.f \
-	slasd7.f slasd8.f slasda.f slasdq.f slasdt.f slasdt.f \
-	slaset.f slasq1.f slasq2.f slasq3.f slasq4.f slasq4.f \
-	slasq5.f slasq6.f slasr.f slasrt.f slassq.f slassq.f \
-	slasv2.f slaswp.f slasy2.f slatbs.f slatrd.f slatrd.f \
-	slatrs.f slatrz.f slauu2.f slauum.f slazq3.f slazq3.f \
-	slazq4.f sorg2l.f sorg2r.f sorgbr.f sorghr.f sorghr.f \
-	sorgl2.f sorglq.f sorgql.f sorgqr.f sorgtr.f sorgtr.f \
-	sorm2r.f sormbr.f sorml2.f sormlq.f sormqr.f sormqr.f \
-	sormr3.f sormrz.f spbcon.f spbtf2.f spbtrf.f spbtrf.f \
-	spbtrs.f spocon.f spotf2.f spotrf.f spotri.f spotri.f \
-	spotrs.f sptsv.f spttrf.f spttrs.f sptts2.f sptts2.f \
-	srscl.f ssteqr.f ssterf.f ssyev.f ssytd2.f ssytd2.f \
-	ssytrd.f stgevc.f strcon.f strevc.f strexc.f strexc.f \
-	strsen.f strsyl.f strti2.f strtri.f strtrs.f strtrs.f \
-	stzrzf.f zbdsqr.f zdrscl.f zgbcon.f zgbtf2.f zgbtf2.f \
-	zgbtrf.f zgbtrs.f zgebak.f zgebal.f zgebd2.f zgebd2.f \
-	zgebrd.f zgecon.f zgeesx.f zgeev.f zgehd2.f zgehd2.f \
-	zgehrd.f zgelq2.f zgelqf.f zgelsd.f zgelss.f zgelss.f \
-	zgelsy.f zgeqp3.f zgeqpf.f zgeqr2.f zgeqrf.f zgeqrf.f \
-	zgesvd.f zgesv.f zgetf2.f zgetrf.f zgetri.f zgetri.f \
-	zgetrs.f zggbak.f zggbal.f zggev.f zgghrd.f zgghrd.f \
-	zgtsv.f zgttrf.f zgttrs.f zgtts2.f zheev.f zheev.f \
-	zhetd2.f zhetrd.f zhgeqz.f zhseqr.f zlabrd.f zlabrd.f \
-	zlacgv.f zlacn2.f zlacon.f zlacpy.f zladiv.f zladiv.f \
-	zlahqr.f zlahr2.f zlahrd.f zlaic1.f zlals0.f zlals0.f \
-	zlalsa.f zlalsd.f zlange.f zlanhe.f zlanhs.f zlanhs.f \
-	zlantr.f zlaqp2.f zlaqps.f zlaqr0.f zlaqr1.f zlaqr1.f \
-	zlaqr2.f zlaqr3.f zlaqr4.f zlaqr5.f zlarfb.f zlarfb.f \
-	zlarf.f zlarfg.f zlarft.f zlarfx.f zlartg.f zlartg.f \
-	zlarzb.f zlarz.f zlarzt.f zlascl.f zlaset.f zlaset.f \
-	zlasr.f zlassq.f zlaswp.f zlatbs.f zlatrd.f zlatrd.f \
-	zlatrs.f zlatrz.f zlauu2.f zlauum.f zpbcon.f zpbcon.f \
-	zpbtf2.f zpbtrf.f zpbtrs.f zpocon.f zpotf2.f zpotf2.f \
-	zpotrf.f zpotri.f zpotrs.f zptsv.f zpttrf.f zpttrf.f \
-	zpttrs.f zptts2.f zrot.f zsteqr.f ztgevc.f ztgevc.f \
-	ztrcon.f ztrevc.f ztrexc.f ztrsen.f ztrsyl.f ztrsyl.f \
-	ztrti2.f ztrtri.f ztrtrs.f ztzrzf.f zung2l.f zung2l.f \
-	zung2r.f zungbr.f zunghr.f zungl2.f zunglq.f zunglq.f \
-	zungql.f zungqr.f zungtr.f zunm2r.f zunmbr.f zunmbr.f \
-	zunml2.f zunmlq.f zunmqr.f zunmr3.f zunmrz.f zunmrz.f \
-	chegs2.f chegst.f chegv.f dsygs2.f dsygst.f dsygv.f \
-	ssygs2.f ssygst.f ssygv.f zhegs2.f zhegst.f zhegv.f
-
-
-include $(TOPDIR)/Makeconf
-
-dlamc1.o pic/dlamc1.o: FFLAGS += $(F77_FLOAT_STORE_FLAG)
-slamc1.o pic/slamc1.o: FFLAGS += $(F77_FLOAT_STORE_FLAG)
-
-include ../Makerules
-
new file mode 100644
--- /dev/null
+++ b/libcruft/lapack/module.mk
@@ -0,0 +1,750 @@
+EXTRA_DIST += lapack/module.mk
+
+lapack/dlamc1.lo: FFLAGS += $(F77_FLOAT_STORE_FLAG)
+lapack/slamc1.lo: FFLAGS += $(F77_FLOAT_STORE_FLAG)
+
+LAPACK_SRC = \
+  lapack/cbdsqr.f \
+  lapack/cgbcon.f \
+  lapack/cgbtf2.f \
+  lapack/cgbtrf.f \
+  lapack/cgbtrs.f \
+  lapack/cgbtrs.f \
+  lapack/cgebak.f \
+  lapack/cgebal.f \
+  lapack/cgebd2.f \
+  lapack/cgebrd.f \
+  lapack/cgecon.f \
+  lapack/cgecon.f \
+  lapack/cgeesx.f \
+  lapack/cgeev.f \
+  lapack/cgehd2.f \
+  lapack/cgehrd.f \
+  lapack/cgelq2.f \
+  lapack/cgelq2.f \
+  lapack/cgelqf.f \
+  lapack/cgelsd.f \
+  lapack/cgelss.f \
+  lapack/cgelsy.f \
+  lapack/cgeqp3.f \
+  lapack/cgeqp3.f \
+  lapack/cgeqpf.f \
+  lapack/cgeqr2.f \
+  lapack/cgeqrf.f \
+  lapack/cgesvd.f \
+  lapack/cgesv.f \
+  lapack/cgesv.f \
+  lapack/cgetf2.f \
+  lapack/cgetrf.f \
+  lapack/cgetri.f \
+  lapack/cgetrs.f \
+  lapack/cggbak.f \
+  lapack/cggbak.f \
+  lapack/cggbal.f \
+  lapack/cggev.f \
+  lapack/cgghrd.f \
+  lapack/cgtsv.f \
+  lapack/cgttrf.f \
+  lapack/cgttrf.f \
+  lapack/cgttrs.f \
+  lapack/cgtts2.f \
+  lapack/cheev.f \
+  lapack/chetd2.f \
+  lapack/chetrd.f \
+  lapack/chetrd.f \
+  lapack/chgeqz.f \
+  lapack/chseqr.f \
+  lapack/clabrd.f \
+  lapack/clacgv.f \
+  lapack/clacn2.f \
+  lapack/clacn2.f \
+  lapack/clacon.f \
+  lapack/clacpy.f \
+  lapack/cladiv.f \
+  lapack/clahqr.f \
+  lapack/clahr2.f \
+  lapack/clahr2.f \
+  lapack/clahrd.f \
+  lapack/claic1.f \
+  lapack/clals0.f \
+  lapack/clalsa.f \
+  lapack/clalsd.f \
+  lapack/clalsd.f \
+  lapack/clange.f \
+  lapack/clanhe.f \
+  lapack/clanhs.f \
+  lapack/clantr.f \
+  lapack/claqp2.f \
+  lapack/claqp2.f \
+  lapack/claqps.f \
+  lapack/claqr0.f \
+  lapack/claqr1.f \
+  lapack/claqr2.f \
+  lapack/claqr3.f \
+  lapack/claqr3.f \
+  lapack/claqr4.f \
+  lapack/claqr5.f \
+  lapack/clarfb.f \
+  lapack/clarf.f \
+  lapack/clarfg.f \
+  lapack/clarfg.f \
+  lapack/clarft.f \
+  lapack/clarfx.f \
+  lapack/clartg.f \
+  lapack/clarzb.f \
+  lapack/clarz.f \
+  lapack/clarz.f \
+  lapack/clarzt.f \
+  lapack/clascl.f \
+  lapack/claset.f \
+  lapack/clasr.f \
+  lapack/classq.f \
+  lapack/classq.f \
+  lapack/claswp.f \
+  lapack/clatbs.f \
+  lapack/clatrd.f \
+  lapack/clatrs.f \
+  lapack/clatrz.f \
+  lapack/clatrz.f \
+  lapack/clauu2.f \
+  lapack/clauum.f \
+  lapack/cpbcon.f \
+  lapack/cpbtf2.f \
+  lapack/cpbtrf.f \
+  lapack/cpbtrf.f \
+  lapack/cpbtrs.f \
+  lapack/cpocon.f \
+  lapack/cpotf2.f \
+  lapack/cpotrf.f \
+  lapack/cpotri.f \
+  lapack/cpotri.f \
+  lapack/cpotrs.f \
+  lapack/cptsv.f \
+  lapack/cpttrf.f \
+  lapack/cpttrs.f \
+  lapack/cptts2.f \
+  lapack/cptts2.f \
+  lapack/crot.f \
+  lapack/csrscl.f \
+  lapack/csteqr.f \
+  lapack/ctgevc.f \
+  lapack/ctrcon.f \
+  lapack/ctrcon.f \
+  lapack/ctrevc.f \
+  lapack/ctrexc.f \
+  lapack/ctrsen.f \
+  lapack/ctrsyl.f \
+  lapack/ctrti2.f \
+  lapack/ctrti2.f \
+  lapack/ctrtri.f \
+  lapack/ctrtrs.f \
+  lapack/ctzrzf.f \
+  lapack/cung2l.f \
+  lapack/cung2r.f \
+  lapack/cung2r.f \
+  lapack/cungbr.f \
+  lapack/cunghr.f \
+  lapack/cungl2.f \
+  lapack/cunglq.f \
+  lapack/cungql.f \
+  lapack/cungql.f \
+  lapack/cungqr.f \
+  lapack/cungtr.f \
+  lapack/cunm2r.f \
+  lapack/cunmbr.f \
+  lapack/cunml2.f \
+  lapack/cunml2.f \
+  lapack/cunmlq.f \
+  lapack/cunmqr.f \
+  lapack/cunmr3.f \
+  lapack/cunmrz.f \
+  lapack/dbdsqr.f \
+  lapack/dbdsqr.f \
+  lapack/dgbcon.f \
+  lapack/dgbtf2.f \
+  lapack/dgbtrf.f \
+  lapack/dgbtrs.f \
+  lapack/dgebak.f \
+  lapack/dgebak.f \
+  lapack/dgebal.f \
+  lapack/dgebd2.f \
+  lapack/dgebrd.f \
+  lapack/dgecon.f \
+  lapack/dgeesx.f \
+  lapack/dgeesx.f \
+  lapack/dgeev.f \
+  lapack/dgehd2.f \
+  lapack/dgehrd.f \
+  lapack/dgelq2.f \
+  lapack/dgelqf.f \
+  lapack/dgelqf.f \
+  lapack/dgelsd.f \
+  lapack/dgelss.f \
+  lapack/dgelsy.f \
+  lapack/dgeqp3.f \
+  lapack/dgeqpf.f \
+  lapack/dgeqpf.f \
+  lapack/dgeqr2.f \
+  lapack/dgeqrf.f \
+  lapack/dgesvd.f \
+  lapack/dgesv.f \
+  lapack/dgetf2.f \
+  lapack/dgetf2.f \
+  lapack/dgetrf.f \
+  lapack/dgetri.f \
+  lapack/dgetrs.f \
+  lapack/dggbak.f \
+  lapack/dggbal.f \
+  lapack/dggbal.f \
+  lapack/dggev.f \
+  lapack/dgghrd.f \
+  lapack/dgtsv.f \
+  lapack/dgttrf.f \
+  lapack/dgttrs.f \
+  lapack/dgttrs.f \
+  lapack/dgtts2.f \
+  lapack/dhgeqz.f \
+  lapack/dhseqr.f \
+  lapack/dlabad.f \
+  lapack/dlabrd.f \
+  lapack/dlabrd.f \
+  lapack/dlacn2.f \
+  lapack/dlacon.f \
+  lapack/dlacpy.f \
+  lapack/dladiv.f \
+  lapack/dlae2.f \
+  lapack/dlae2.f \
+  lapack/dlaed6.f \
+  lapack/dlaev2.f \
+  lapack/dlaexc.f \
+  lapack/dlag2.f \
+  lapack/dlahqr.f \
+  lapack/dlahqr.f \
+  lapack/dlahr2.f \
+  lapack/dlahrd.f \
+  lapack/dlaic1.f \
+  lapack/dlaln2.f \
+  lapack/dlals0.f \
+  lapack/dlals0.f \
+  lapack/dlalsa.f \
+  lapack/dlalsd.f \
+  lapack/dlamc1.f \
+  lapack/dlamc2.f \
+  lapack/dlamc3.f \
+  lapack/dlamc3.f \
+  lapack/dlamc4.f \
+  lapack/dlamc5.f \
+  lapack/dlamch.f \
+  lapack/dlamrg.f \
+  lapack/dlange.f \
+  lapack/dlange.f \
+  lapack/dlanhs.f \
+  lapack/dlanst.f \
+  lapack/dlansy.f \
+  lapack/dlantr.f \
+  lapack/dlanv2.f \
+  lapack/dlanv2.f \
+  lapack/dlapy2.f \
+  lapack/dlapy3.f \
+  lapack/dlaqp2.f \
+  lapack/dlaqps.f \
+  lapack/dlaqr0.f \
+  lapack/dlaqr0.f \
+  lapack/dlaqr1.f \
+  lapack/dlaqr2.f \
+  lapack/dlaqr3.f \
+  lapack/dlaqr4.f \
+  lapack/dlaqr5.f \
+  lapack/dlaqr5.f \
+  lapack/dlarfb.f \
+  lapack/dlarf.f \
+  lapack/dlarfg.f \
+  lapack/dlarft.f \
+  lapack/dlarfx.f \
+  lapack/dlarfx.f \
+  lapack/dlartg.f \
+  lapack/dlarzb.f \
+  lapack/dlarz.f \
+  lapack/dlarzt.f \
+  lapack/dlas2.f \
+  lapack/dlas2.f \
+  lapack/dlascl.f \
+  lapack/dlasd0.f \
+  lapack/dlasd1.f \
+  lapack/dlasd2.f \
+  lapack/dlasd3.f \
+  lapack/dlasd3.f \
+  lapack/dlasd4.f \
+  lapack/dlasd5.f \
+  lapack/dlasd6.f \
+  lapack/dlasd7.f \
+  lapack/dlasd8.f \
+  lapack/dlasd8.f \
+  lapack/dlasda.f \
+  lapack/dlasdq.f \
+  lapack/dlasdt.f \
+  lapack/dlaset.f \
+  lapack/dlasq1.f \
+  lapack/dlasq1.f \
+  lapack/dlasq2.f \
+  lapack/dlasq3.f \
+  lapack/dlasq4.f \
+  lapack/dlasq5.f \
+  lapack/dlasq6.f \
+  lapack/dlasq6.f \
+  lapack/dlasr.f \
+  lapack/dlasrt.f \
+  lapack/dlassq.f \
+  lapack/dlasv2.f \
+  lapack/dlaswp.f \
+  lapack/dlaswp.f \
+  lapack/dlasy2.f \
+  lapack/dlatbs.f \
+  lapack/dlatrd.f \
+  lapack/dlatrs.f \
+  lapack/dlatrz.f \
+  lapack/dlatrz.f \
+  lapack/dlauu2.f \
+  lapack/dlauum.f \
+  lapack/dlazq3.f \
+  lapack/dlazq4.f \
+  lapack/dorg2l.f \
+  lapack/dorg2l.f \
+  lapack/dorg2r.f \
+  lapack/dorgbr.f \
+  lapack/dorghr.f \
+  lapack/dorgl2.f \
+  lapack/dorglq.f \
+  lapack/dorglq.f \
+  lapack/dorgql.f \
+  lapack/dorgqr.f \
+  lapack/dorgtr.f \
+  lapack/dorm2r.f \
+  lapack/dormbr.f \
+  lapack/dormbr.f \
+  lapack/dorml2.f \
+  lapack/dormlq.f \
+  lapack/dormqr.f \
+  lapack/dormr3.f \
+  lapack/dormrz.f \
+  lapack/dormrz.f \
+  lapack/dpbcon.f \
+  lapack/dpbtf2.f \
+  lapack/dpbtrf.f \
+  lapack/dpbtrs.f \
+  lapack/dpocon.f \
+  lapack/dpocon.f \
+  lapack/dpotf2.f \
+  lapack/dpotrf.f \
+  lapack/dpotri.f \
+  lapack/dpotrs.f \
+  lapack/dptsv.f \
+  lapack/dptsv.f \
+  lapack/dpttrf.f \
+  lapack/dpttrs.f \
+  lapack/dptts2.f \
+  lapack/drscl.f \
+  lapack/dsteqr.f \
+  lapack/dsteqr.f \
+  lapack/dsterf.f \
+  lapack/dsyev.f \
+  lapack/dsytd2.f \
+  lapack/dsytrd.f \
+  lapack/dtgevc.f \
+  lapack/dtgevc.f \
+  lapack/dtrcon.f \
+  lapack/dtrevc.f \
+  lapack/dtrexc.f \
+  lapack/dtrsen.f \
+  lapack/dtrsyl.f \
+  lapack/dtrsyl.f \
+  lapack/dtrti2.f \
+  lapack/dtrtri.f \
+  lapack/dtrtrs.f \
+  lapack/dtzrzf.f \
+  lapack/dzsum1.f \
+  lapack/dzsum1.f \
+  lapack/icmax1.f \
+  lapack/ieeeck.f \
+  lapack/ilaenv.f \
+  lapack/iparmq.f \
+  lapack/izmax1.f \
+  lapack/izmax1.f \
+  lapack/sbdsqr.f \
+  lapack/scsum1.f \
+  lapack/sgbcon.f \
+  lapack/sgbtf2.f \
+  lapack/sgbtrf.f \
+  lapack/sgbtrf.f \
+  lapack/sgbtrs.f \
+  lapack/sgebak.f \
+  lapack/sgebal.f \
+  lapack/sgebd2.f \
+  lapack/sgebrd.f \
+  lapack/sgebrd.f \
+  lapack/sgecon.f \
+  lapack/sgeesx.f \
+  lapack/sgeev.f \
+  lapack/sgehd2.f \
+  lapack/sgehrd.f \
+  lapack/sgehrd.f \
+  lapack/sgelq2.f \
+  lapack/sgelqf.f \
+  lapack/sgelsd.f \
+  lapack/sgelss.f \
+  lapack/sgelsy.f \
+  lapack/sgelsy.f \
+  lapack/sgeqp3.f \
+  lapack/sgeqpf.f \
+  lapack/sgeqr2.f \
+  lapack/sgeqrf.f \
+  lapack/sgesvd.f \
+  lapack/sgesvd.f \
+  lapack/sgesv.f \
+  lapack/sgetf2.f \
+  lapack/sgetrf.f \
+  lapack/sgetri.f \
+  lapack/sgetrs.f \
+  lapack/sgetrs.f \
+  lapack/sggbak.f \
+  lapack/sggbal.f \
+  lapack/sggev.f \
+  lapack/sgghrd.f \
+  lapack/sgtsv.f \
+  lapack/sgtsv.f \
+  lapack/sgttrf.f \
+  lapack/sgttrs.f \
+  lapack/sgtts2.f \
+  lapack/shgeqz.f \
+  lapack/shseqr.f \
+  lapack/shseqr.f \
+  lapack/slabad.f \
+  lapack/slabrd.f \
+  lapack/slacn2.f \
+  lapack/slacon.f \
+  lapack/slacpy.f \
+  lapack/slacpy.f \
+  lapack/sladiv.f \
+  lapack/slae2.f \
+  lapack/slaed6.f \
+  lapack/slaev2.f \
+  lapack/slaexc.f \
+  lapack/slaexc.f \
+  lapack/slag2.f \
+  lapack/slahqr.f \
+  lapack/slahr2.f \
+  lapack/slahrd.f \
+  lapack/slaic1.f \
+  lapack/slaic1.f \
+  lapack/slaln2.f \
+  lapack/slals0.f \
+  lapack/slalsa.f \
+  lapack/slalsd.f \
+  lapack/slamc1.f \
+  lapack/slamc1.f \
+  lapack/slamc2.f \
+  lapack/slamc3.f \
+  lapack/slamc4.f \
+  lapack/slamc5.f \
+  lapack/slamch.f \
+  lapack/slamch.f \
+  lapack/slamrg.f \
+  lapack/slange.f \
+  lapack/slanhs.f \
+  lapack/slanst.f \
+  lapack/slansy.f \
+  lapack/slansy.f \
+  lapack/slantr.f \
+  lapack/slanv2.f \
+  lapack/slapy2.f \
+  lapack/slapy3.f \
+  lapack/slaqp2.f \
+  lapack/slaqp2.f \
+  lapack/slaqps.f \
+  lapack/slaqr0.f \
+  lapack/slaqr1.f \
+  lapack/slaqr2.f \
+  lapack/slaqr3.f \
+  lapack/slaqr3.f \
+  lapack/slaqr4.f \
+  lapack/slaqr5.f \
+  lapack/slarfb.f \
+  lapack/slarf.f \
+  lapack/slarfg.f \
+  lapack/slarfg.f \
+  lapack/slarft.f \
+  lapack/slarfx.f \
+  lapack/slartg.f \
+  lapack/slarzb.f \
+  lapack/slarz.f \
+  lapack/slarz.f \
+  lapack/slarzt.f \
+  lapack/slas2.f \
+  lapack/slascl.f \
+  lapack/slasd0.f \
+  lapack/slasd1.f \
+  lapack/slasd1.f \
+  lapack/slasd2.f \
+  lapack/slasd3.f \
+  lapack/slasd4.f \
+  lapack/slasd5.f \
+  lapack/slasd6.f \
+  lapack/slasd6.f \
+  lapack/slasd7.f \
+  lapack/slasd8.f \
+  lapack/slasda.f \
+  lapack/slasdq.f \
+  lapack/slasdt.f \
+  lapack/slasdt.f \
+  lapack/slaset.f \
+  lapack/slasq1.f \
+  lapack/slasq2.f \
+  lapack/slasq3.f \
+  lapack/slasq4.f \
+  lapack/slasq4.f \
+  lapack/slasq5.f \
+  lapack/slasq6.f \
+  lapack/slasr.f \
+  lapack/slasrt.f \
+  lapack/slassq.f \
+  lapack/slassq.f \
+  lapack/slasv2.f \
+  lapack/slaswp.f \
+  lapack/slasy2.f \
+  lapack/slatbs.f \
+  lapack/slatrd.f \
+  lapack/slatrd.f \
+  lapack/slatrs.f \
+  lapack/slatrz.f \
+  lapack/slauu2.f \
+  lapack/slauum.f \
+  lapack/slazq3.f \
+  lapack/slazq3.f \
+  lapack/slazq4.f \
+  lapack/sorg2l.f \
+  lapack/sorg2r.f \
+  lapack/sorgbr.f \
+  lapack/sorghr.f \
+  lapack/sorghr.f \
+  lapack/sorgl2.f \
+  lapack/sorglq.f \
+  lapack/sorgql.f \
+  lapack/sorgqr.f \
+  lapack/sorgtr.f \
+  lapack/sorgtr.f \
+  lapack/sorm2r.f \
+  lapack/sormbr.f \
+  lapack/sorml2.f \
+  lapack/sormlq.f \
+  lapack/sormqr.f \
+  lapack/sormqr.f \
+  lapack/sormr3.f \
+  lapack/sormrz.f \
+  lapack/spbcon.f \
+  lapack/spbtf2.f \
+  lapack/spbtrf.f \
+  lapack/spbtrf.f \
+  lapack/spbtrs.f \
+  lapack/spocon.f \
+  lapack/spotf2.f \
+  lapack/spotrf.f \
+  lapack/spotri.f \
+  lapack/spotri.f \
+  lapack/spotrs.f \
+  lapack/sptsv.f \
+  lapack/spttrf.f \
+  lapack/spttrs.f \
+  lapack/sptts2.f \
+  lapack/sptts2.f \
+  lapack/srscl.f \
+  lapack/ssteqr.f \
+  lapack/ssterf.f \
+  lapack/ssyev.f \
+  lapack/ssytd2.f \
+  lapack/ssytd2.f \
+  lapack/ssytrd.f \
+  lapack/stgevc.f \
+  lapack/strcon.f \
+  lapack/strevc.f \
+  lapack/strexc.f \
+  lapack/strexc.f \
+  lapack/strsen.f \
+  lapack/strsyl.f \
+  lapack/strti2.f \
+  lapack/strtri.f \
+  lapack/strtrs.f \
+  lapack/strtrs.f \
+  lapack/stzrzf.f \
+  lapack/zbdsqr.f \
+  lapack/zdrscl.f \
+  lapack/zgbcon.f \
+  lapack/zgbtf2.f \
+  lapack/zgbtf2.f \
+  lapack/zgbtrf.f \
+  lapack/zgbtrs.f \
+  lapack/zgebak.f \
+  lapack/zgebal.f \
+  lapack/zgebd2.f \
+  lapack/zgebd2.f \
+  lapack/zgebrd.f \
+  lapack/zgecon.f \
+  lapack/zgeesx.f \
+  lapack/zgeev.f \
+  lapack/zgehd2.f \
+  lapack/zgehd2.f \
+  lapack/zgehrd.f \
+  lapack/zgelq2.f \
+  lapack/zgelqf.f \
+  lapack/zgelsd.f \
+  lapack/zgelss.f \
+  lapack/zgelss.f \
+  lapack/zgelsy.f \
+  lapack/zgeqp3.f \
+  lapack/zgeqpf.f \
+  lapack/zgeqr2.f \
+  lapack/zgeqrf.f \
+  lapack/zgeqrf.f \
+  lapack/zgesvd.f \
+  lapack/zgesv.f \
+  lapack/zgetf2.f \
+  lapack/zgetrf.f \
+  lapack/zgetri.f \
+  lapack/zgetri.f \
+  lapack/zgetrs.f \
+  lapack/zggbak.f \
+  lapack/zggbal.f \
+  lapack/zggev.f \
+  lapack/zgghrd.f \
+  lapack/zgghrd.f \
+  lapack/zgtsv.f \
+  lapack/zgttrf.f \
+  lapack/zgttrs.f \
+  lapack/zgtts2.f \
+  lapack/zheev.f \
+  lapack/zheev.f \
+  lapack/zhetd2.f \
+  lapack/zhetrd.f \
+  lapack/zhgeqz.f \
+  lapack/zhseqr.f \
+  lapack/zlabrd.f \
+  lapack/zlabrd.f \
+  lapack/zlacgv.f \
+  lapack/zlacn2.f \
+  lapack/zlacon.f \
+  lapack/zlacpy.f \
+  lapack/zladiv.f \
+  lapack/zladiv.f \
+  lapack/zlahqr.f \
+  lapack/zlahr2.f \
+  lapack/zlahrd.f \
+  lapack/zlaic1.f \
+  lapack/zlals0.f \
+  lapack/zlals0.f \
+  lapack/zlalsa.f \
+  lapack/zlalsd.f \
+  lapack/zlange.f \
+  lapack/zlanhe.f \
+  lapack/zlanhs.f \
+  lapack/zlanhs.f \
+  lapack/zlantr.f \
+  lapack/zlaqp2.f \
+  lapack/zlaqps.f \
+  lapack/zlaqr0.f \
+  lapack/zlaqr1.f \
+  lapack/zlaqr1.f \
+  lapack/zlaqr2.f \
+  lapack/zlaqr3.f \
+  lapack/zlaqr4.f \
+  lapack/zlaqr5.f \
+  lapack/zlarfb.f \
+  lapack/zlarfb.f \
+  lapack/zlarf.f \
+  lapack/zlarfg.f \
+  lapack/zlarft.f \
+  lapack/zlarfx.f \
+  lapack/zlartg.f \
+  lapack/zlartg.f \
+  lapack/zlarzb.f \
+  lapack/zlarz.f \
+  lapack/zlarzt.f \
+  lapack/zlascl.f \
+  lapack/zlaset.f \
+  lapack/zlaset.f \
+  lapack/zlasr.f \
+  lapack/zlassq.f \
+  lapack/zlaswp.f \
+  lapack/zlatbs.f \
+  lapack/zlatrd.f \
+  lapack/zlatrd.f \
+  lapack/zlatrs.f \
+  lapack/zlatrz.f \
+  lapack/zlauu2.f \
+  lapack/zlauum.f \
+  lapack/zpbcon.f \
+  lapack/zpbcon.f \
+  lapack/zpbtf2.f \
+  lapack/zpbtrf.f \
+  lapack/zpbtrs.f \
+  lapack/zpocon.f \
+  lapack/zpotf2.f \
+  lapack/zpotf2.f \
+  lapack/zpotrf.f \
+  lapack/zpotri.f \
+  lapack/zpotrs.f \
+  lapack/zptsv.f \
+  lapack/zpttrf.f \
+  lapack/zpttrf.f \
+  lapack/zpttrs.f \
+  lapack/zptts2.f \
+  lapack/zrot.f \
+  lapack/zsteqr.f \
+  lapack/ztgevc.f \
+  lapack/ztgevc.f \
+  lapack/ztrcon.f \
+  lapack/ztrevc.f \
+  lapack/ztrexc.f \
+  lapack/ztrsen.f \
+  lapack/ztrsyl.f \
+  lapack/ztrsyl.f \
+  lapack/ztrti2.f \
+  lapack/ztrtri.f \
+  lapack/ztrtrs.f \
+  lapack/ztzrzf.f \
+  lapack/zung2l.f \
+  lapack/zung2l.f \
+  lapack/zung2r.f \
+  lapack/zungbr.f \
+  lapack/zunghr.f \
+  lapack/zungl2.f \
+  lapack/zunglq.f \
+  lapack/zunglq.f \
+  lapack/zungql.f \
+  lapack/zungqr.f \
+  lapack/zungtr.f \
+  lapack/zunm2r.f \
+  lapack/zunmbr.f \
+  lapack/zunmbr.f \
+  lapack/zunml2.f \
+  lapack/zunmlq.f \
+  lapack/zunmqr.f \
+  lapack/zunmr3.f \
+  lapack/zunmrz.f \
+  lapack/zunmrz.f \
+  lapack/chegs2.f \
+  lapack/chegst.f \
+  lapack/chegv.f \
+  lapack/dsygs2.f \
+  lapack/dsygst.f \
+  lapack/dsygv.f \
+  lapack/ssygs2.f \
+  lapack/ssygst.f \
+  lapack/ssygv.f \
+  lapack/zhegs2.f \
+  lapack/zhegst.f \
+  lapack/zhegv.f
+
+if AMCOND_HAVE_LAPACK
+  EXTRA_DIST += $(LAPACK_SRC)
+else
+  libcruft_la_SOURCES += $(LAPACK_SRC)
+endif
deleted file mode 100644
--- a/libcruft/misc/Makefile.in
+++ /dev/null
@@ -1,65 +0,0 @@
-# Makefile for octave's libcruft/misc directory
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003,
-#               2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = d1mach.f r1mach.f i1mach.f
-
-CSRC = f77-fcn.c lo-error.c cquit.c
-
-CXXSRC = f77-extern.cc quit.cc
-
-MAKEDEPS := $(patsubst %.c, %.d, $(CSRC)) $(patsubst %.cc, %.d, $(CXXSRC))
-
-INCLUDES := f77-fcn.h lo-error.h quit.h
-
-SPECIAL:= d1mach-tst.for $(INCLUDES)
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-include ../Makerules
-
-install install-strip::
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octincludedir)/octave
-	for f in $(INCLUDES); do \
-	  rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	done
-	$(mk-includedir-link)
-
-uninstall::
-	for f in $(INCLUDES); do rm -f $(DESTDIR)$(octincludedir)/octave/$$f; done
-
-ifdef omit_deps
-.PHONY: $(MAKEDEPS)
-endif
-
--include $(MAKEDEPS)
new file mode 100644
--- /dev/null
+++ b/libcruft/misc/module.mk
@@ -0,0 +1,18 @@
+EXTRA_DIST += \
+  misc/module.mk \
+  misc/d1mach-tst.for 
+
+libcruft_la_SOURCES += \
+  misc/cquit.c \
+  misc/d1mach.f \
+  misc/f77-extern.cc \
+  misc/f77-fcn.c \
+  misc/i1mach.f \
+  misc/lo-error.c \
+  misc/quit.cc \
+  misc/r1mach.f
+
+octinclude_HEADERS += \
+  misc/f77-fcn.h \
+  misc/lo-error.h \
+  misc/quit.h
deleted file mode 100644
--- a/libcruft/odepack/Makefile.in
+++ /dev/null
@@ -1,34 +0,0 @@
-# Makefile for octave's libcruft/odepack directory
-#
-# Copyright (C) 1993, 1994, 1995, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = cfode.f dlsode.f ewset.f intdy.f prepj.f solsy.f stode.f vnorm.f \
-  scfode.f sewset.f sintdy.f slsode.f sprepj.f ssolsy.f sstode.f svnorm.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/odepack/module.mk
@@ -0,0 +1,19 @@
+EXTRA_DIST += odepack/module.mk
+
+libcruft_la_SOURCES += \
+  odepack/cfode.f \
+  odepack/dlsode.f \
+  odepack/ewset.f \
+  odepack/intdy.f \
+  odepack/prepj.f \
+  odepack/solsy.f \
+  odepack/stode.f \
+  odepack/vnorm.f \
+  odepack/scfode.f \
+  odepack/sewset.f \
+  odepack/sintdy.f \
+  odepack/slsode.f \
+  odepack/sprepj.f \
+  odepack/ssolsy.f \
+  odepack/sstode.f \
+  odepack/svnorm.f
deleted file mode 100644
--- a/libcruft/ordered-qz/Makefile.in
+++ /dev/null
@@ -1,33 +0,0 @@
-# Makefile for octave's libcruft/ordered-qz directory
-#
-# Copyright (C) 1998, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = dsubsp.f exchqz.f ssubsp.f sexchqz.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/ordered-qz/module.mk
@@ -0,0 +1,7 @@
+EXTRA_DIST += ordered-qz/module.mk
+
+libcruft_la_SOURCES += \
+  ordered-qz/dsubsp.f \
+  ordered-qz/exchqz.f \
+  ordered-qz/ssubsp.f \
+  ordered-qz/sexchqz.f
deleted file mode 100644
--- a/libcruft/quadpack/Makefile.in
+++ /dev/null
@@ -1,35 +0,0 @@
-# Makefile for octave's libcruft/quadpack directory
-#
-# Copyright (C) 1993, 1994, 1995, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC = dqagi.f dqagie.f dqagp.f dqagpe.f dqelg.f dqk15i.f \
-  dqk21.f dqpsrt.f qagie.f qagi.f qagpe.f qagp.f qelg.f \
-  qk15i.f qk21.f qpsrt.f xerror.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/quadpack/module.mk
@@ -0,0 +1,20 @@
+EXTRA_DIST += quadpack/module.mk
+
+libcruft_la_SOURCES += \
+  quadpack/dqagi.f \
+  quadpack/dqagie.f \
+  quadpack/dqagp.f \
+  quadpack/dqagpe.f \
+  quadpack/dqelg.f \
+  quadpack/dqk15i.f \
+  quadpack/dqk21.f \
+  quadpack/dqpsrt.f \
+  quadpack/qagie.f \
+  quadpack/qagi.f \
+  quadpack/qagpe.f \
+  quadpack/qagp.f \
+  quadpack/qelg.f \
+  quadpack/qk15i.f \
+  quadpack/qk21.f \
+  quadpack/qpsrt.f \
+  quadpack/xerror.f
deleted file mode 100644
--- a/libcruft/ranlib/Makefile.in
+++ /dev/null
@@ -1,40 +0,0 @@
-# Makefile for octave's libcruft/ranlib directory
-#
-# Copyright (C) 1993, 1994, 1995, 1997, 1998, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-SPECIAL = HOWTOGET README randlib.chs randlib.fdoc \
-	tstbot.for tstgmn.for tstmid.for
-
-EXTERNAL_DISTFILES = $(DISTFILES) $(srcdir)/Basegen.doc
-
-FSRC = advnst.f genbet.f genchi.f genexp.f genf.f gengam.f \
-  genmn.f genmul.f gennch.f gennf.f gennor.f genprm.f genunf.f \
-  getcgn.f getsd.f ignbin.f ignlgi.f ignnbn.f ignpoi.f ignuin.f \
-  initgn.f inrgcm.f lennob.f mltmod.f phrtsd.f qrgnin.f ranf.f \
-  setall.f setant.f setgmn.f setsd.f sexpo.f sgamma.f snorm.f wrap.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/ranlib/module.mk
@@ -0,0 +1,47 @@
+EXTRA_DIST += \
+  ranlib/module.mk \
+  ranlib/Basegen.doc \
+  ranlib/HOWTOGET \
+  ranlib/README \
+  ranlib/randlib.chs \
+  ranlib/randlib.fdoc \
+  ranlib/tstbot.for \
+  ranlib/tstgmn.for \
+  ranlib/tstmid.for
+
+libcruft_la_SOURCES += \
+  ranlib/advnst.f \
+  ranlib/genbet.f \
+  ranlib/genchi.f \
+  ranlib/genexp.f \
+  ranlib/genf.f \
+  ranlib/gengam.f \
+  ranlib/genmn.f \
+  ranlib/genmul.f \
+  ranlib/gennch.f \
+  ranlib/gennf.f \
+  ranlib/gennor.f \
+  ranlib/genprm.f \
+  ranlib/genunf.f \
+  ranlib/getcgn.f \
+  ranlib/getsd.f \
+  ranlib/ignbin.f \
+  ranlib/ignlgi.f \
+  ranlib/ignnbn.f \
+  ranlib/ignpoi.f \
+  ranlib/ignuin.f \
+  ranlib/initgn.f \
+  ranlib/inrgcm.f \
+  ranlib/lennob.f \
+  ranlib/mltmod.f \
+  ranlib/phrtsd.f \
+  ranlib/qrgnin.f \
+  ranlib/ranf.f \
+  ranlib/setall.f \
+  ranlib/setant.f \
+  ranlib/setgmn.f \
+  ranlib/setsd.f \
+  ranlib/sexpo.f \
+  ranlib/sgamma.f \
+  ranlib/snorm.f \
+  ranlib/wrap.f
deleted file mode 100644
--- a/libcruft/slatec-err/Makefile.in
+++ /dev/null
@@ -1,34 +0,0 @@
-# Makefile for octave's libcruft/slatec-err directory
-#
-# Copyright (C) 1999, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-include $(TOPDIR)/Makeconf
-
-FSRC = fdump.f ixsav.f j4save.f xerclr.f xercnt.f xerhlt.f xermsg.f \
-  xerprn.f xerrwd.f xersve.f xgetf.f xgetua.f xsetf.f xsetua.f
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/slatec-err/module.mk
@@ -0,0 +1,17 @@
+EXTRA_DIST += slatec-err/module.mk
+
+libcruft_la_SOURCES += \
+  slatec-err/fdump.f \
+  slatec-err/ixsav.f \
+  slatec-err/j4save.f \
+  slatec-err/xerclr.f \
+  slatec-err/xercnt.f \
+  slatec-err/xerhlt.f \
+  slatec-err/xermsg.f \
+  slatec-err/xerprn.f \
+  slatec-err/xerrwd.f \
+  slatec-err/xersve.f \
+  slatec-err/xgetf.f \
+  slatec-err/xgetua.f \
+  slatec-err/xsetf.f \
+  slatec-err/xsetua.f
deleted file mode 100644
--- a/libcruft/slatec-fn/Makefile.in
+++ /dev/null
@@ -1,40 +0,0 @@
-# Makefile for octave's libcruft/slatec-fn directory
-#
-# Copyright (C) 1995, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-include $(TOPDIR)/Makeconf
-
-FSRC = albeta.f alngam.f alnrel.f algams.f acosh.f asinh.f atanh.f betai.f \
-  csevl.f d9gmit.f d9lgic.f d9lgit.f d9lgmc.f dacosh.f dasinh.f datanh.f \
-  dbetai.f dcsevl.f derf.f derfc.f dgami.f dgamit.f dgamlm.f dgamma.f \
-  dgamr.f dlbeta.f dlgams.f dlngam.f dlnrel.f dpchim.f dpchst.f erf.f erfc.f \
-  gami.f gamit.f gamlim.f gamma.f gamr.f initds.f inits.f pchim.f pchst.f \
-  r9lgmc.f r9lgit.f r9gmit.f r9lgic.f xdacosh.f xdasinh.f xdatanh.f \
-  xdbetai.f xderf.f xderfc.f xdgami.f xdgamit.f xdgamma.f xgmainc.f xacosh.f \
-  xasinh.f xatanh.f xerf.f xerfc.f xsgmainc.f xgamma.f xbetai.f
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/slatec-fn/module.mk
@@ -0,0 +1,67 @@
+EXTRA_DIST += slatec-fn/module.mk
+
+libcruft_la_SOURCES += \
+  slatec-fn/albeta.f \
+  slatec-fn/alngam.f \
+  slatec-fn/alnrel.f \
+  slatec-fn/algams.f \
+  slatec-fn/acosh.f \
+  slatec-fn/asinh.f \
+  slatec-fn/atanh.f \
+  slatec-fn/betai.f \
+  slatec-fn/csevl.f \
+  slatec-fn/d9gmit.f \
+  slatec-fn/d9lgic.f \
+  slatec-fn/d9lgit.f \
+  slatec-fn/d9lgmc.f \
+  slatec-fn/dacosh.f \
+  slatec-fn/dasinh.f \
+  slatec-fn/datanh.f \
+  slatec-fn/dbetai.f \
+  slatec-fn/dcsevl.f \
+  slatec-fn/derf.f \
+  slatec-fn/derfc.f \
+  slatec-fn/dgami.f \
+  slatec-fn/dgamit.f \
+  slatec-fn/dgamlm.f \
+  slatec-fn/dgamma.f \
+  slatec-fn/dgamr.f \
+  slatec-fn/dlbeta.f \
+  slatec-fn/dlgams.f \
+  slatec-fn/dlngam.f \
+  slatec-fn/dlnrel.f \
+  slatec-fn/dpchim.f \
+  slatec-fn/dpchst.f \
+  slatec-fn/erf.f \
+  slatec-fn/erfc.f \
+  slatec-fn/gami.f \
+  slatec-fn/gamit.f \
+  slatec-fn/gamlim.f \
+  slatec-fn/gamma.f \
+  slatec-fn/gamr.f \
+  slatec-fn/initds.f \
+  slatec-fn/inits.f \
+  slatec-fn/pchim.f \
+  slatec-fn/pchst.f \
+  slatec-fn/r9lgmc.f \
+  slatec-fn/r9lgit.f \
+  slatec-fn/r9gmit.f \
+  slatec-fn/r9lgic.f \
+  slatec-fn/xdacosh.f \
+  slatec-fn/xdasinh.f \
+  slatec-fn/xdatanh.f \
+  slatec-fn/xdbetai.f \
+  slatec-fn/xderf.f \
+  slatec-fn/xderfc.f \
+  slatec-fn/xdgami.f \
+  slatec-fn/xdgamit.f \
+  slatec-fn/xdgamma.f \
+  slatec-fn/xgmainc.f \
+  slatec-fn/xacosh.f \
+  slatec-fn/xasinh.f \
+  slatec-fn/xatanh.f \
+  slatec-fn/xerf.f \
+  slatec-fn/xerfc.f \
+  slatec-fn/xsgmainc.f \
+  slatec-fn/xgamma.f \
+  slatec-fn/xbetai.f
deleted file mode 100644
--- a/libcruft/villad/Makefile.in
+++ /dev/null
@@ -1,33 +0,0 @@
-# Makefile for octave's libcruft/villad directory
-#
-# Copyright (C) 1993, 1994, 1995, 2007 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-EXTERNAL_DISTFILES = $(DISTFILES)
-
-FSRC := dfopr.f dif.f intrp.f jcobi.f radau.f vilerr.f
-
-include $(TOPDIR)/Makeconf
-
-include ../Makerules
new file mode 100644
--- /dev/null
+++ b/libcruft/villad/module.mk
@@ -0,0 +1,9 @@
+EXTRA_DIST += villad/module.mk
+
+libcruft_la_SOURCES += \
+  villad/dfopr.f \
+  villad/dif.f \
+  villad/intrp.f \
+  villad/jcobi.f \
+  villad/radau.f \
+  villad/vilerr.f
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-10  John W. Eaton  <jwe@octave.org>
+
+	* mx-ops, sparse-mx-ops, vx-ops b/liboctave/vx-ops:
+	Add comment about updating.
+	* Makefile.am, config-ops.sh: New files.
+	* Makefile.in: Delete.
+
 2009-11-09  Jaroslav Hajek  <highegg@gmail.com>
 
 	* dSparse.h (Sparse::max): Use Array<octave_idx_type>.
new file mode 100644
--- /dev/null
+++ b/liboctave/Makefile.am
@@ -0,0 +1,554 @@
+# Makefile for octave's liboctave directory
+#
+# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ..
+ 
+include ../common.mk
+
+octlib_LTLIBRARIES = liboctave.la
+
+AM_CPPFLAGS = -I$(top_srcdir)/libcruft/misc
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+EXTRA_DIST = \
+  ChangeLog \
+  config-ops.sh \
+  mk-ops.awk \
+  mx-op-inc.mk \
+  mx-op-src.mk \
+  mx-ops \
+  smx-op-inc.mk \
+  smx-op-src.mk \
+  sparse-mk-ops.awk \
+  sparse-mx-ops \
+  vx-op-inc.mk \
+  vx-op-src.mk \
+  vx-ops \
+  $(OPT_IN)
+
+MATRIX_INC = \
+  Array-util.h \
+  Array.h \
+  Array2.h \
+  Array3.h \
+  ArrayN.h \
+  CColVector.h \
+  CDiagMatrix.h \
+  CMatrix.h \
+  CNDArray.h \
+  CRowVector.h \
+  CSparse.h \
+  CmplxAEPBAL.h \
+  CmplxCHOL.h \
+  CmplxGEPBAL.h \
+  CmplxHESS.h \
+  CmplxLU.h \
+  CmplxQR.h \
+  CmplxQRP.h \
+  CmplxSCHUR.h \
+  CmplxSVD.h \
+  DET.h \
+  DiagArray2.h \
+  EIG.h \
+  MArray-decl.h \
+  MArray-defs.h \
+  MArray.h \
+  MArray2.h \
+  MArrayN.h \
+  MDiagArray2.h \
+  MSparse-defs.h \
+  MSparse.h \
+  Matrix.h \
+  MatrixType.h \
+  PermMatrix.h \
+  Sparse-diag-op-defs.h \
+  Sparse-op-defs.h \
+  Sparse-perm-op-defs.h \
+  Sparse.h \
+  SparseCmplxCHOL.h \
+  SparseCmplxLU.h \
+  SparseCmplxQR.h \
+  SparseQR.h \
+  SparsedbleCHOL.h \
+  SparsedbleLU.h \
+  base-aepbal.h \
+  base-lu.h \
+  base-qr.h \
+  boolMatrix.h \
+  boolNDArray.h \
+  boolSparse.h \
+  bsxfun-decl.h \
+  chMatrix.h \
+  chNDArray.h \
+  dColVector.h \
+  dDiagMatrix.h \
+  dMatrix.h \
+  dNDArray.h \
+  dRowVector.h \
+  dSparse.h \
+  dbleAEPBAL.h \
+  dbleCHOL.h \
+  dbleGEPBAL.h \
+  dbleHESS.h \
+  dbleLU.h \
+  dbleQR.h \
+  dbleQRP.h \
+  dbleSCHUR.h \
+  dbleSVD.h \
+  dim-vector.h \
+  fCColVector.h \
+  fCDiagMatrix.h \
+  fCMatrix.h \
+  fCNDArray.h \
+  fCRowVector.h \
+  fCmplxAEPBAL.h \
+  fCmplxCHOL.h \
+  fCmplxGEPBAL.h \
+  fCmplxHESS.h \
+  fCmplxLU.h \
+  fCmplxQR.h \
+  fCmplxQRP.h \
+  fCmplxSCHUR.h \
+  fCmplxSVD.h \
+  fColVector.h \
+  fDiagMatrix.h \
+  fEIG.h \
+  fMatrix.h \
+  fNDArray.h \
+  fRowVector.h \
+  floatAEPBAL.h \
+  floatCHOL.h \
+  floatGEPBAL.h \
+  floatHESS.h \
+  floatLU.h \
+  floatQR.h \
+  floatQRP.h \
+  floatSCHUR.h \
+  floatSVD.h \
+  int16NDArray.h \
+  int32NDArray.h \
+  int64NDArray.h \
+  int8NDArray.h \
+  intNDArray.h \
+  mx-base.h \
+  mx-defs.h \
+  mx-ext.h \
+  mx-op-decl.h \
+  mx-op-defs.h \
+  sparse-base-chol.h \
+  sparse-base-lu.h \
+  uint16NDArray.h \
+  uint32NDArray.h \
+  uint64NDArray.h \
+  uint8NDArray.h
+
+OPT_IN = \
+  DASPK-opts.in \
+  DASRT-opts.in \
+  DASSL-opts.in \
+  LSODE-opts.in \
+  Quad-opts.in
+
+OPT_INC = \
+  DASPK-opts.h \
+  DASRT-opts.h \
+  DASSL-opts.h \
+  LSODE-opts.h \
+  Quad-opts.h
+
+INCS = \
+  CollocWt.h \
+  DAE.h \
+  DAEFunc.h \
+  DAERT.h \
+  DAERTFunc.h \
+  DASPK.h \
+  DASRT.h \
+  DASSL.h \
+  LSODE.h \
+  ODE.h \
+  ODEFunc.h \
+  ODES.h \
+  ODESFunc.h \
+  Quad.h \
+  Range.h \
+  base-dae.h \
+  base-de.h \
+  base-min.h \
+  byte-swap.h \
+  cmd-edit.h \
+  cmd-hist.h \
+  data-conv.h \
+  dir-ops.h \
+  file-ops.h \
+  file-stat.h \
+  functor.h \
+  getopt.h \
+  glob-match.h \
+  idx-vector.h \
+  kpse-xfns.h \
+  lo-ieee.h \
+  lo-mappers.h \
+  lo-math.h \
+  lo-specfun.h \
+  lo-sysdep.h \
+  lo-traits.h \
+  lo-utils.h \
+  mach-info.h \
+  md5.h \
+  oct-alloc.h \
+  oct-cmplx.h \
+  oct-env.h \
+  oct-fftw.h \
+  oct-getopt.h \
+  oct-group.h \
+  oct-inttypes.h \
+  oct-locbuf.h \
+  oct-md5.h \
+  oct-mem.h \
+  oct-mutex.h \
+  oct-norm.h \
+  oct-passwd.h \
+  oct-rand.h \
+  oct-rl-edit.h \
+  oct-rl-hist.h \
+  oct-shlib.h \
+  oct-sort.h \
+  oct-sparse.h \
+  oct-spparms.h \
+  oct-syscalls.h \
+  oct-time.h \
+  oct-uname.h \
+  pathlen.h \
+  pathsearch.h \
+  prog-args.h \
+  randgamma.h \
+  randmtzig.h \
+  randpoisson.h \
+  regex-match.h \
+  sparse-sort.h \
+  sparse-util.h \
+  statdefs.h \
+  str-vec.h \
+  sun-utils.h \
+  sysdir.h \
+  systime.h \
+  syswait.h \
+  $(MATRIX_INC)
+
+OTHER_INC = \
+  intNDArray.cc \
+  kpse.cc \
+  mx-inlines.cc
+
+include vx-op-inc.mk
+include mx-op-inc.mk
+include smx-op-inc.mk
+
+BUILT_INCS = \
+  mx-ops.h \
+  $(OPT_INC) \
+  $(MX_OP_INC) \
+  $(VX_OP_INC) \
+  $(SMX_OP_INC)
+
+BUILT_SOURCES = $(BUILT_INCS)
+
+TEMPLATE_SRC = \
+  Array.cc \
+  DiagArray2.cc \
+  MArray.cc \
+  MArray2.cc \
+  MArrayN.cc \
+  MDiagArray2.cc \
+  base-lu.cc \
+  base-qr.cc \
+  bsxfun-defs.cc \
+  eigs-base.cc \
+  oct-sort.cc \
+  sparse-base-chol.cc \
+  sparse-base-lu.cc \
+  sparse-dmsolve.cc
+
+TI_SRC = \
+  Array-C.cc \
+  Array-b.cc \
+  Array-ch.cc \
+  Array-d.cc \
+  Array-f.cc \
+  Array-fC.cc \
+  Array-i.cc \
+  Array-idx-vec.cc \
+  Array-s.cc \
+  Array-str.cc \
+  Array-voidp.cc \
+  MArray-C.cc \
+  MArray-ch.cc \
+  MArray-d.cc \
+  MArray-f.cc \
+  MArray-fC.cc \
+  MArray-i.cc \
+  MArray-s.cc \
+  MSparse-C.cc \
+  MSparse-d.cc \
+  Sparse-C.cc \
+  Sparse-b.cc \
+  Sparse-d.cc \
+  oct-inttypes.cc
+
+MATRIX_SRC = \
+  Array-util.cc \
+  CColVector.cc \
+  CDiagMatrix.cc \
+  CMatrix.cc \
+  CNDArray.cc \
+  CRowVector.cc \
+  CSparse.cc \
+  CmplxAEPBAL.cc \
+  CmplxCHOL.cc \
+  CmplxGEPBAL.cc \
+  CmplxHESS.cc \
+  CmplxLU.cc \
+  CmplxQR.cc \
+  CmplxQRP.cc \
+  CmplxSCHUR.cc \
+  CmplxSVD.cc \
+  EIG.cc \
+  MSparse.cc \
+  MatrixType.cc \
+  PermMatrix.cc \
+  Sparse.cc \
+  SparseCmplxCHOL.cc \
+  SparseCmplxLU.cc \
+  SparseCmplxQR.cc \
+  SparseQR.cc \
+  SparsedbleCHOL.cc \
+  SparsedbleLU.cc \
+  boolMatrix.cc \
+  boolNDArray.cc \
+  boolSparse.cc \
+  chMatrix.cc \
+  chNDArray.cc \
+  dColVector.cc \
+  dDiagMatrix.cc \
+  dMatrix.cc \
+  dNDArray.cc \
+  dRowVector.cc \
+  dSparse.cc \
+  dbleAEPBAL.cc \
+  dbleCHOL.cc \
+  dbleGEPBAL.cc \
+  dbleHESS.cc \
+  dbleLU.cc \
+  dbleQR.cc \
+  dbleQRP.cc \
+  dbleSCHUR.cc \
+  dbleSVD.cc \
+  fCColVector.cc \
+  fCDiagMatrix.cc \
+  fCMatrix.cc \
+  fCNDArray.cc \
+  fCRowVector.cc \
+  fCmplxAEPBAL.cc \
+  fCmplxCHOL.cc \
+  fCmplxGEPBAL.cc \
+  fCmplxHESS.cc \
+  fCmplxLU.cc \
+  fCmplxQR.cc \
+  fCmplxQRP.cc \
+  fCmplxSCHUR.cc \
+  fCmplxSVD.cc \
+  fColVector.cc \
+  fDiagMatrix.cc \
+  fEIG.cc \
+  fMatrix.cc \
+  fNDArray.cc \
+  fRowVector.cc \
+  floatAEPBAL.cc \
+  floatCHOL.cc \
+  floatGEPBAL.cc \
+  floatHESS.cc \
+  floatLU.cc \
+  floatQR.cc \
+  floatQRP.cc \
+  floatSCHUR.cc \
+  floatSVD.cc \
+  int16NDArray.cc \
+  int32NDArray.cc \
+  int64NDArray.cc \
+  int8NDArray.cc \
+  uint16NDArray.cc \
+  uint32NDArray.cc \
+  uint64NDArray.cc \
+  uint8NDArray.cc
+
+LIBOCTAVE_CXX_SOURCES = \
+  CollocWt.cc \
+  DASPK.cc \
+  DASRT.cc \
+  DASSL.cc \
+  LSODE.cc \
+  ODES.cc \
+  Quad.cc \
+  Range.cc \
+  data-conv.cc \
+  dir-ops.cc \
+  file-ops.cc \
+  file-stat.cc \
+  glob-match.cc \
+  idx-vector.cc \
+  lo-ieee.cc \
+  lo-mappers.cc \
+  lo-specfun.cc \
+  lo-sysdep.cc \
+  lo-utils.cc \
+  mach-info.cc \
+  oct-alloc.cc \
+  oct-env.cc \
+  oct-fftw.cc \
+  oct-group.cc \
+  oct-locbuf.cc \
+  oct-md5.cc \
+  oct-mutex.cc \
+  oct-norm.cc \
+  oct-passwd.cc \
+  oct-rand.cc \
+  oct-shlib.cc \
+  oct-spparms.cc \
+  oct-syscalls.cc \
+  oct-time.cc \
+  oct-uname.cc \
+  prog-args.cc \
+  regex-match.cc \
+  sparse-sort.cc \
+  sparse-util.cc \
+  str-vec.cc \
+  $(TI_SRC) \
+  $(MATRIX_SRC)
+
+include vx-op-src.mk
+include mx-op-src.mk
+include smx-op-src.mk
+
+BUILT_LIBOCTAVE_CXX_SOURCES = \
+  $(MX_OP_SRC) \
+  $(VX_OP_SRC) \
+  $(SMX_OP_SRC)
+
+LIBOCTAVE_C_SOURCES = \
+  f2c-main.c \
+  filemode.c \
+  getopt.c \
+  getopt1.c \
+  lo-cieee.c \
+  lo-cutils.c \
+  md5.c \
+  mkdir.c \
+  oct-getopt.c \
+  randgamma.c \
+  randmtzig.c \
+  randpoisson.c \
+  rename.c \
+  rmdir.c \
+  strcasecmp.c \
+  strftime.c \
+  strncase.c \
+  strptime.c \
+  tempnam.c \
+  tempname.c
+
+LIBOCTAVE_SOURCES = $(LIBOCTAVE_CXX_SOURCES) $(BUILT_LIBOCTAVE_CXX_SOURCES) \
+	$(LIBOCTAVE_C_SOURCES)
+
+LIBOCT_READLINE_CXX_SOURCES = cmd-edit.cc cmd-hist.cc
+
+LIBOCT_READLINE_C_SOURCES = oct-rl-edit.c oct-rl-hist.c
+
+LIBOCT_READLINE_SOURCES = $(LIBOCT_READLINE_CXX_SOURCES) $(LIBOCT_READLINE_C_SOURCES)
+
+LIBOCT_PATHSEARCH_CXX_SOURCES = pathsearch.cc
+
+LIBOCT_PATHSEARCH_C_SOURCES = kpse-xfns.c
+
+LIBOCT_PATHSEARCH_SOURCES = \
+	$(LIBOCT_PATHSEARCH_C_SOURCES) $(LIBOCT_PATHSEARCH_CXX_SOURCES)
+
+LINK_DEPS = \
+  $(RLD_FLAG) \
+  ../libcruft/libcruft.la \
+  $(SPARSE_XLIBS) \
+  $(ARPACK_LIBS) \
+  $(QRUPDATE_LIBS) \
+  $(FFTW_XLIBS) \
+  $(LAPACK_LIBS) $(BLAS_LIBS) \
+  $(READLINE_LIBS) $(TERM_LIBS) \
+  $(LIBGLOB) $(REGEX_LIBS) $(DL_LIBS) \
+  $(FLIBS) \
+  $(PTHREAD_LIBS) $(LIBS)
+
+liboctave_la_SOURCES = \
+  $(LIBOCTAVE_SOURCES) \
+  $(LIBOCT_READLINE_SOURCES) \
+  $(LIBOCT_PATHSEARCH_SOURCES)
+
+liboctave_la_LIBADD = $(LINK_DEPS)
+
+liboctave_la_LDFLAGS = -release $(version) $(NO_UNDEFINED_LDFLAG) \
+  $(SPARSE_XLDFLAGS) \
+  $(ARPACK_LDFLAGS) \
+  $(QRUPDATE_LDFLAGS) \
+  $(FFTW_XLDFLAGS)
+
+liboctave_la_CPPFLAGS = \
+  $(SPARSE_XCPPFLAGS) \
+  $(FFTW_XCPPFLAGS) \
+  $(ARPACK_CPPFLAGS) \
+  $(AM_CPPFLAGS)
+
+octinclude_HEADERS = \
+  $(INCS) \
+  $(BUILT_INCS) \
+  $(OTHER_INC) \
+  $(TEMPLATE_SRC) \
+  $(EXTRA_HEADERS)
+
+$(OPT_INC) : %.h : %.in $(top_srcdir)/mk-opts.pl
+	@echo making $@ from $<
+	@perl $(top_srcdir)/mk-opts.pl --opt-class-header $< > $@-t
+	@mv $@-t $@
+
+$(VX_OP_INC) $(VX_OP_SRC) : $(srcdir)/mk-ops.awk vx-ops
+	$(AWK) -f $(srcdir)/mk-ops.awk prefix=vx $(srcdir)/vx-ops
+
+$(MX_OP_INC) $(MX_OP_SRC) : $(srcdir)/mk-ops.awk mx-ops
+	$(AWK) -f $(srcdir)/mk-ops.awk prefix=mx $(srcdir)/mx-ops
+
+$(SMX_OP_INC) $(SMX_OP_SRC) : $(srcdir)/sparse-mk-ops.awk sparse-mx-ops
+	$(AWK) -f $(srcdir)/sparse-mk-ops.awk prefix=smx $(srcdir)/sparse-mx-ops
+
+mx-ops.h : $(srcdir)/mk-ops.awk mx-ops
+	$(AWK) -f $(srcdir)/mk-ops.awk prefix=mx make_inclusive_header=mx-ops.h $(srcdir)/mx-ops > $@-t
+	$(simple_move_if_change_rule)
+
+distclean-local maintainer-clean-local:
+	rm -f $(BUILT_INCS) $(BUILT_LIBOCTAVE_CXX_SOURCES)
+.PHONY: distclean-local maintainer-clean-local
deleted file mode 100644
--- a/liboctave/Makefile.in
+++ /dev/null
@@ -1,438 +0,0 @@
-# Makefile for octave's liboctave directory
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-DLL_CDEFS = @OCTAVE_DLL_DEFS@
-DLL_CXXDEFS = @OCTAVE_DLL_DEFS@
-
-LINK_DEPS = \
-  $(RLD_FLAG) \
-  -L../libcruft $(LIBCRUFT) \
-  $(SPARSE_LDFLAGS) $(SPARSE_LIBS) \
-  $(ARPACK_LIBS) \
-  $(QRUPDATE_LIBS) \
-  $(FFTW_LDFLAGS) $(FFTW_LIBS) \
-  $(BLAS_LIBS) \
-  $(READLINE_LIBS) $(TERM_LIBS) \
-  $(LIBGLOB) $(REGEX_LIBS) $(DL_LIBS) \
-  $(FLIBS) \
-  $(PTHREAD_LIBS) $(LIBS)
-
-MATRIX_INC := Array.h Array2.h Array3.h ArrayN.h DiagArray2.h \
-	Array-util.h MArray-decl.h MArray-defs.h \
-	MArray.h MArray2.h MDiagArray2.h Matrix.h MArrayN.h \
-	base-lu.h base-qr.h base-aepbal.h bsxfun-decl.h dim-vector.h \
-	mx-base.h mx-op-decl.h \
-	mx-op-defs.h mx-defs.h mx-ext.h CColVector.h CDiagMatrix.h \
-	CMatrix.h CNDArray.h CRowVector.h CmplxAEPBAL.h CmplxCHOL.h \
-	CmplxGEPBAL.h CmplxHESS.h CmplxLU.h CmplxQR.h CmplxQRP.h \
-	CmplxSCHUR.h CmplxSVD.h EIG.h fEIG.h boolMatrix.h boolNDArray.h \
-	chMatrix.h chNDArray.h dColVector.h dDiagMatrix.h dMatrix.h \
-	dNDArray.h dRowVector.h dbleAEPBAL.h dbleCHOL.h DET.h \
-	dbleGEPBAL.h dbleHESS.h dbleLU.h dbleQR.h dbleQRP.h dbleSCHUR.h \
-	dbleSVD.h boolSparse.h CSparse.h dSparse.h MSparse-defs.h MSparse.h \
-	Sparse.h sparse-base-lu.h SparseCmplxLU.h SparsedbleLU.h \
-	sparse-base-chol.h SparseCmplxCHOL.h SparsedbleCHOL.h \
-	SparseCmplxQR.h SparseQR.h Sparse-op-defs.h Sparse-diag-op-defs.h \
-	Sparse-perm-op-defs.h MatrixType.h PermMatrix.h \
-	int8NDArray.h uint8NDArray.h int16NDArray.h uint16NDArray.h \
-	int32NDArray.h uint32NDArray.h int64NDArray.h uint64NDArray.h \
-	intNDArray.h \
-	fCColVector.h fCRowVector.h fCDiagMatrix.h fCMatrix.h fCNDArray.h \
-	fColVector.h fRowVector.h fDiagMatrix.h fMatrix.h fNDArray.h \
-	fCmplxAEPBAL.h fCmplxGEPBAL.h fCmplxHESS.h fCmplxCHOL.h \
-	fCmplxLU.h fCmplxSCHUR.h fCmplxSVD.h fCmplxQR.h \
-	fCmplxQRP.h floatAEPBAL.h \
-	floatCHOL.h floatGEPBAL.h floatHESS.h floatLU.h \
-	floatSCHUR.h floatSVD.h floatQR.h floatQRP.h
-
-MX_OP_INC := $(shell $(AWK) -f $(srcdir)/mk-ops.awk prefix=mx list_h_files=1 $(srcdir)/mx-ops)
-
-VX_OP_INC := $(shell $(AWK) -f $(srcdir)/mk-ops.awk prefix=vx list_h_files=1 $(srcdir)/vx-ops)
-
-SPARSE_MX_OP_INC := $(shell $(AWK) -f $(srcdir)/sparse-mk-ops.awk prefix=smx list_h_files=1 $(srcdir)/sparse-mx-ops)
-
-OPT_BASE := $(addsuffix -opts, DASPK DASRT DASSL LSODE Quad)
-OPT_IN := $(addsuffix .in, $(OPT_BASE))
-OPT_INC := $(addsuffix .h, $(OPT_BASE))
-
-INCLUDES := CollocWt.h DAE.h DAEFunc.h DAERT.h \
-	DAERTFunc.h DASPK.h DASRT.h DASSL.h \
-	LSODE.h \
-	ODE.h ODEFunc.h ODES.h ODESFunc.h \
-	Quad.h Range.h base-dae.h \
-	base-de.h base-min.h byte-swap.h cmd-edit.h cmd-hist.h \
-	data-conv.h dir-ops.h file-ops.h file-stat.h functor.h getopt.h \
-	glob-match.h idx-vector.h kpse-xfns.h \
-	lo-ieee.h lo-mappers.h lo-math.h lo-specfun.h lo-sysdep.h \
-	lo-traits.h lo-utils.h mach-info.h md5.h oct-alloc.h oct-cmplx.h \
-	oct-env.h oct-fftw.h oct-getopt.h oct-group.h oct-inttypes.h \
-	oct-locbuf.h oct-md5.h oct-mem.h oct-mutex.h oct-norm.h \
-        oct-passwd.h oct-rand.h oct-rl-edit.h oct-rl-hist.h oct-shlib.h \
-        oct-sort.h oct-spparms.h oct-syscalls.h oct-sparse.h oct-time.h \
-        oct-uname.h pathlen.h pathsearch.h prog-args.h \
-	randgamma.h randmtzig.h randpoisson.h regex-match.h \
-	sparse-sort.h statdefs.h str-vec.h \
-	sparse-util.h sun-utils.h sysdir.h systime.h syswait.h \
-	$(MATRIX_INC)
-
-BUILT_INCLUDES := mx-ops.h \
-	$(OPT_INC) \
-	$(MX_OP_INC) \
-	$(VX_OP_INC) \
-	$(SPARSE_MX_OP_INC)
-
-TEMPLATE_SRC := Array.cc bsxfun-defs.cc eigs-base.cc DiagArray2.cc \
-	MArray.cc MArray2.cc MArrayN.cc MDiagArray2.cc \
-	base-lu.cc base-qr.cc oct-sort.cc sparse-base-lu.cc \
-	sparse-base-chol.cc sparse-dmsolve.cc
-
-TI_SRC := Array-C.cc Array-b.cc Array-ch.cc Array-i.cc Array-d.cc \
-	Array-f.cc Array-fC.cc Array-s.cc Array-str.cc Array-voidp.cc \
-	Array-idx-vec.cc MArray-C.cc MArray-ch.cc MArray-i.cc MArray-d.cc \
-	MArray-f.cc MArray-fC.cc MArray-s.cc MSparse-C.cc MSparse-d.cc \
-	Sparse-C.cc Sparse-b.cc Sparse-d.cc oct-inttypes.cc
-
-MATRIX_SRC := Array-util.cc CColVector.cc \
-	CDiagMatrix.cc CMatrix.cc CNDArray.cc CRowVector.cc \
-	CmplxAEPBAL.cc CmplxCHOL.cc CmplxGEPBAL.cc CmplxHESS.cc \
-	CmplxLU.cc CmplxQR.cc CmplxQRP.cc CmplxSCHUR.cc CmplxSVD.cc \
-	EIG.cc fEIG.cc boolMatrix.cc boolNDArray.cc chMatrix.cc \
-	chNDArray.cc dColVector.cc dDiagMatrix.cc dMatrix.cc \
-	dNDArray.cc dRowVector.cc dbleAEPBAL.cc dbleCHOL.cc \
-	dbleGEPBAL.cc dbleHESS.cc dbleLU.cc dbleQR.cc dbleQRP.cc \
-	dbleSCHUR.cc dbleSVD.cc boolSparse.cc CSparse.cc dSparse.cc \
-	MSparse.cc Sparse.cc SparseCmplxLU.cc SparsedbleLU.cc \
-	SparseCmplxCHOL.cc SparsedbleCHOL.cc \
-	SparseCmplxQR.cc SparseQR.cc MatrixType.cc PermMatrix.cc \
-	int8NDArray.cc uint8NDArray.cc int16NDArray.cc uint16NDArray.cc \
-	int32NDArray.cc uint32NDArray.cc int64NDArray.cc uint64NDArray.cc \
-	fCColVector.cc fCRowVector.cc fCDiagMatrix.cc fCMatrix.cc fCNDArray.cc \
-	fColVector.cc fRowVector.cc fDiagMatrix.cc fMatrix.cc fNDArray.cc \
-	fCmplxAEPBAL.cc fCmplxCHOL.cc fCmplxGEPBAL.cc \
-	fCmplxHESS.cc fCmplxLU.cc fCmplxSCHUR.cc fCmplxSVD.cc fCmplxQR.cc \
-	fCmplxQRP.cc floatAEPBAL.cc floatCHOL.cc \
-	floatGEPBAL.cc floatHESS.cc floatLU.cc \
-	floatSCHUR.cc floatSVD.cc floatQR.cc floatQRP.cc
-
-MX_OP_SRC := $(shell $(AWK) -f $(srcdir)/mk-ops.awk prefix=mx list_cc_files=1 $(srcdir)/mx-ops)
-
-VX_OP_SRC := $(shell $(AWK) -f $(srcdir)/mk-ops.awk prefix=vx list_cc_files=1 $(srcdir)/vx-ops)
-
-SPARSE_MX_OP_SRC := $(shell $(AWK) -f $(srcdir)/sparse-mk-ops.awk prefix=smx list_cc_files=1 $(srcdir)/sparse-mx-ops)
-
-LIBOCTAVE_CXX_SOURCES := oct-locbuf.cc CollocWt.cc DASPK.cc DASRT.cc \
-	DASSL.cc LSODE.cc ODES.cc \
-	Quad.cc Range.cc data-conv.cc dir-ops.cc \
-	file-ops.cc file-stat.cc glob-match.cc idx-vector.cc \
-	lo-ieee.cc lo-mappers.cc lo-specfun.cc lo-sysdep.cc \
-	lo-utils.cc mach-info.cc oct-alloc.cc oct-env.cc \
-	oct-fftw.cc oct-group.cc oct-mutex.cc oct-md5.cc \
-	oct-norm.cc oct-passwd.cc oct-rand.cc \
-	oct-shlib.cc oct-spparms.cc oct-syscalls.cc oct-time.cc oct-uname.cc \
-	prog-args.cc regex-match.cc \
-	sparse-sort.cc sparse-util.cc str-vec.cc \
-	$(TI_SRC) \
-	$(MATRIX_SRC)
-
-BUILT_LIBOCTAVE_CXX_SOURCES := \
-	$(MX_OP_SRC) \
-	$(VX_OP_SRC) \
-	$(SPARSE_MX_OP_SRC)
-
-LIBOCTAVE_C_SOURCES := f2c-main.c filemode.c getopt.c getopt1.c \
-	lo-cieee.c lo-cutils.c md5.c mkdir.c oct-getopt.c \
-	randgamma.c randmtzig.c randpoisson.c rename.c \
-	rmdir.c strftime.c strptime.c strcasecmp.c strncase.c \
-	tempname.c tempnam.c
-
-LIBOCTAVE_SOURCES := $(LIBOCTAVE_CXX_SOURCES) $(BUILT_LIBOCTAVE_CXX_SOURCES) \
-	$(LIBOCTAVE_C_SOURCES)
-
-LIBOCT_READLINE_CXX_SOURCES := cmd-edit.cc cmd-hist.cc
-
-LIBOCT_READLINE_C_SOURCES := oct-rl-edit.c oct-rl-hist.c
-
-LIBOCT_READLINE_SOURCES := $(LIBOCT_READLINE_CXX_SOURCES) $(LIBOCT_READLINE_C_SOURCES)
-
-LIBOCT_PATHSEARCH_CXX_SOURCES := pathsearch.cc
-
-LIBOCT_PATHSEARCH_C_SOURCES := kpse-xfns.c
-
-LIBOCT_PATHSEARCH_SOURCES := \
-	$(LIBOCT_PATHSEARCH_C_SOURCES) $(LIBOCT_PATHSEARCH_CXX_SOURCES)
-
-SOURCES := \
-	$(LIBOCTAVE_SOURCES) \
-	$(LIBOCT_READLINE_SOURCES) \
-	$(LIBOCT_PATHSEARCH_SOURCES)
-
-EXTRAS := mx-inlines.cc kpse.cc intNDArray.cc
-
-INCLUDES_FOR_INSTALL := $(INCLUDES) $(BUILT_INCLUDES) $(TEMPLATE_SRC) $(EXTRAS)
-
-DISTFILES := $(addprefix $(srcdir)/, Makefile.in ChangeLog mk-ops.awk \
-	mx-ops vx-ops sparse-mk-ops.awk sparse-mx-ops \
-	$(TEMPLATE_SRC) \
-	$(LIBOCTAVE_CXX_SOURCES) \
-	$(LIBOCT_READLINE_SOURCES) \
-	$(LIBOCT_PATHSEARCH_SOURCES) \
-	$(LIBOCTAVE_C_SOURCES) \
-	$(INCLUDES) $(EXTRAS) $(OPT_IN)) \
-	$(BUILT_LIBOCTAVE_CXX_SOURCES) $(BUILT_INCLUDES)
-
-MAKEDEPS_1 := $(patsubst %.cc, %.d, $(SOURCES))
-MAKEDEPS := $(patsubst %.c, %.d, $(MAKEDEPS_1))
-
-LIBOCTAVE_OBJECTS := \
-	$(LIBOCTAVE_CXX_SOURCES:.cc=.o) \
-	$(BUILT_LIBOCTAVE_CXX_SOURCES:.cc=.o) \
-	$(LIBOCTAVE_C_SOURCES:.c=.o) \
-	$(LIBOCT_READLINE_CXX_SOURCES:.cc=.o) \
-	$(LIBOCT_READLINE_C_SOURCES:.c=.o) \
-	$(LIBOCT_PATHSEARCH_CXX_SOURCES:.cc=.o) \
-	$(LIBOCT_PATHSEARCH_C_SOURCES:.c=.o)
-
-ifeq ($(SHARED_LIBS), true)
-  ifdef CXXPICFLAG
-    LIBOCTAVE_PICOBJ := $(addprefix pic/, $(LIBOCTAVE_OBJECTS))
-  else
-    LIBOCTAVE_PICOBJ := $(LIBOCTAVE_OBJECTS)
-  endif
-endif
-
-all: libraries
-.PHONY: all
-
-objects: $(LIBOCTAVE_OBJECTS)
-
-stmp-pic: pic
-	@if [ -f stmp-pic ]; then \
-	  true; \
-	else \
-	  echo "touch stmp-pic"; \
-	  touch stmp-pic; \
-	fi
-
-pic:
-	@if [ -d pic ]; then \
-	  true; \
-	else \
-	  echo "mkdir pic"; \
-	  mkdir pic; \
-	fi
-
-PREREQ := $(OPT_INC) $(VX_OP_INC) $(VX_OP_SRC) \
-	$(MX_OP_INC) $(MX_OP_SRC) mx-ops.h \
-	$(SPARSE_MX_OP_INC) $(SPARSE_MX_OP_SRC)
-
-ifeq ($(SHARED_LIBS), true)
-  ifeq ($(STATIC_LIBS), true)
-    LIBRARIES = $(LIBPRE)octave.$(LIBEXT) $(SHLPRE)octave.$(SHLEXT_VER)
-  else
-    LIBRARIES = $(SHLPRE)octave.$(SHLEXT_VER)
-  endif
-else
-  ifeq ($(STATIC_LIBS), true)
-    LIBRARIES = $(LIBPRE)octave.$(LIBEXT)
-  else
-    LIBRARIES =
-  endif
-endif
-
-libraries: $(LIBRARIES)
-.PHONY: libraries
-
-$(LIBPRE)octave.$(LIBEXT): $(LIBOCTAVE_OBJECTS)
-	rm -f $@
-	$(TEMPLATE_AR) $(TEMPLATE_ARFLAGS) $@ $(LIBOCTAVE_OBJECTS)
-	$(RANLIB) $@
-
-$(SHLPRE)octave.$(SHLEXT_VER): $(SHLPRE)octave.$(SHLEXT)
-	rm -f $@
-	$(LN_S) $< $@
-
-$(SHLPRE)octave.$(SHLEXT): $(LIBOCTAVE_PICOBJ)
-	rm -f $@
-	$(SH_LD) $(SH_LDFLAGS) $(LDFLAGS) $(SONAME_FLAGS) -o $@ \
-	$(LIBOCTAVE_PICOBJ) $(LINK_DEPS)
-
-$(LIBOCTAVE_PICOBJ): stmp-pic
-
-ifndef omit_deps
-$(MAKEDEPS): $(PREREQ)
-endif
-
-check: all
-.PHONY: check
-
-install: install-lib install-inc
-.PHONY: install
-
-install-strip:
-	$(MAKE) INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s" install
-.PHONY: install-strip
-
-install-lib:
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octlibdir)
-	if $(STATIC_LIBS); then \
-	  rm -f $(DESTDIR)$(octlibdir)/$(LIBPRE)octave.$(LIBEXT); \
-	  $(INSTALL_DATA) $(LIBPRE)octave.$(LIBEXT) \
-	    $(DESTDIR)$(octlibdir)/$(LIBPRE)octave.$(LIBEXT); \
-	  $(RANLIB) $(DESTDIR)$(octlibdir)/$(LIBPRE)octave.$(LIBEXT); \
-	fi
-	if $(SHARED_LIBS); then \
-	  rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octave.$(SHLLIB_VER); \
-	  $(INSTALL) \
-	    $(SHLLIBPRE)octave.$(SHLLIB) $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octave.$(SHLLIB_VER); \
-	  rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octave.$(SHLLIB); \
-	  (cd $(DESTDIR)$(octlibdir) ; $(LN_S) $(SHLLIBPRE)octave.$(SHLLIB_VER) $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octave.$(SHLLIB)); \
-	  if  test x$(SHLBIN) != x ; then \
-	    rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)octave.$(SHLBIN); \
-	    $(INSTALL_PROGRAM) \
-	      $(SHLBINPRE)octave.$(SHLBIN) $(DESTDIR)$(bindir)/$(SHLBINPRE)octave.$(SHLBIN); \
-	  fi; \
-	fi
-.PHONY: install-lib
-
-install-inc:
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octincludedir)/octave
-	for f in $(INCLUDES_FOR_INSTALL); do \
-	  rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  if [ -f $$f ]; then \
-	    $(INSTALL_DATA) $$f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  else \
-	    $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  fi ; \
-	done
-.PHONY: install-inc
-
-uninstall:
-	rm -f $(DESTDIR)$(octlibdir)/$(LIBPRE)octave.$(LIBEXT)
-	rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octave.$(SHLLIB)
-	rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octave.$(SHLLIB_VER)
-	if test x$(SHLBIN) != x; then \
-	  rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)octave.$(SHLBIN); \
-	  rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)octave.$(SHLBIN_VER); \
-	fi
-	for f in $(INCLUDES_FOR_INSTALL); do rm -f $(DESTDIR)$(octincludedir)/octave/$$f; done
-.PHONY: uninstall
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-clean:
-	rm -f $(LIBPRE)octave.$(LIBEXT)
-	rm -f $(SHLPRE)octave.$(SHLEXT_VER) $(SHLPRE)octave.$(SHLEXT)
-	rm -f $(SHLBINPRE)octave.$(SHLBIN_VER) $(SHLBINPRE)octave.$(SHLBIN)
-	rm -f $(LIBOCTAVE_OBJECTS) $(MAKEDEPS) $(LIBOCTAVE_PICOBJ) stmp-pic
-	-rmdir pic
-.PHONY: clean
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean maintainer-clean: clean
-	rm -f tags TAGS
-	rm -f Makefile so_locations $(PREREQ)
-.PHONY: distclean maintainer-clean
-
-dist: $(PREREQ)
-	ln $(DISTFILES) ../`cat ../.fname`/liboctave
-.PHONY: dist
-
-$(OPT_INC) : %.h : %.in $(top_srcdir)/mk-opts.pl
-	@echo making $@ from $<
-	@perl $(top_srcdir)/mk-opts.pl --opt-class-header $< > $@-t
-	@mv $@-t $@
-
-$(VX_OP_INC) $(VX_OP_SRC) : $(srcdir)/mk-ops.awk vx-ops
-	$(AWK) -f $(srcdir)/mk-ops.awk prefix=vx $(srcdir)/vx-ops
-
-$(MX_OP_INC) $(MX_OP_SRC) : $(srcdir)/mk-ops.awk mx-ops
-	$(AWK) -f $(srcdir)/mk-ops.awk prefix=mx $(srcdir)/mx-ops
-
-$(SPARSE_MX_OP_INC) $(SPARSE_MX_OP_SRC) : $(srcdir)/sparse-mk-ops.awk sparse-mx-ops
-	$(AWK) -f $(srcdir)/sparse-mk-ops.awk prefix=smx $(srcdir)/sparse-mx-ops
-
-mx-ops.h : $(srcdir)/mk-ops.awk mx-ops
-	$(AWK) -f $(srcdir)/mk-ops.awk prefix=mx make_inclusive_header=mx-ops.h $(srcdir)/mx-ops > $@-t
-	$(simple-move-if-change-rule)
-
-CSparse.d CSparse.df pic/CSparse.o CSparse.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-dSparse.d dSparse.df pic/dSparse.o dSparse.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-SparseCmplxLU.d SparseCmplxLU.df pic/SparseCmplxLU.o SparseCmplxLU.o: \
-  CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-SparsedbleLU.d SparsedbleLU.df pic/SparsedbleLU.o SparsedbleLU.o: \
-  CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-SparseCmplxQR.d SparseCmplxQR.df pic/SparseCmplxQR.o SparseCmplxQR.o: \
-  CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-SparsedbleQR.d SparsedbleQR.df pic/SparsedbleQR.o SparsedbleQR.o: \
-  CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-SparseCmplxCHOL.d SparseCmplxCHOL.df pic/SparseCmplxCHOL.o SparseCmplxCHOL.o: \
-  CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-SparsedbleCHOL.d SparsedbleCHOL.df pic/SparsedbleCHOL.o SparsedbleCHOL.o: \
-  CPPFLAGS += $(SPARSE_CPPFLAGS)
-
-CMatrix.d CMatrix.df pic/CMatrix.o CMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-CNDArray.d CNDArray.df pic/CNDArray.o CNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-dMatrix.d dMatrix.df pic/dMatrix.o dMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-dNDArray.d dNDArray.df pic/dNDArray.o dNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-fCMatrix.d fCMatrix.df pic/fCMatrix.o fCMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-fCNDArray.d fCNDArray.df pic/fCNDArray.o fCNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-fMatrix.d fMatrix.df pic/fMatrix.o fMatrix.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-fNDArray.d fNDArray.df pic/fNDArray.o fNDArray.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-oct-fftw.d oct-fftw.df pic/oct-fftw.o oct-fftw.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-
-ifdef omit_deps
-.PHONY: $(MAKEDEPS)
-endif
-
--include $(MAKEDEPS)
new file mode 100755
--- /dev/null
+++ b/liboctave/config-ops.sh
@@ -0,0 +1,35 @@
+#! /bin/sh
+
+set -e
+
+: ${AWK=awk}
+
+VX_INC=$($AWK -f mk-ops.awk prefix=vx list_h_files=1 vx-ops)
+
+MX_INC=$($AWK -f mk-ops.awk prefix=mx list_h_files=1 mx-ops)
+
+SMX_INC=$($AWK -f sparse-mk-ops.awk prefix=smx list_h_files=1 sparse-mx-ops)
+
+VX_SRC=$($AWK -f mk-ops.awk prefix=vx list_cc_files=1 vx-ops)
+
+MX_SRC=$($AWK -f mk-ops.awk prefix=mx list_cc_files=1 mx-ops)
+
+SMX_SRC=$($AWK -f sparse-mk-ops.awk prefix=smx list_cc_files=1 sparse-mx-ops)
+
+echo "VX_OP_INC = $(echo $VX_INC)" > vx-op-inc.mk-t
+../move-if-change vx-op-inc.mk-t vx-op-inc.mk
+
+echo "MX_OP_INC = $(echo $MX_INC)" > mx-op-inc.mk-t
+../move-if-change mx-op-inc.mk-t mx-op-inc.mk
+
+echo "SMX_OP_INC = $(echo $SMX_INC)" > smx-op-inc.mk-t
+../move-if-change smx-op-inc.mk-t smx-op-inc.mk
+
+echo "VX_OP_SRC = $(echo $VX_SRC)" > vx-op-src.mk-t
+../move-if-change vx-op-src.mk-t vx-op-src.mk
+
+echo "MX_OP_SRC = $(echo $MX_SRC)" > mx-op-src.mk-t
+../move-if-change mx-op-src.mk-t mx-op-src.mk
+
+echo "SMX_OP_SRC = $(echo $SMX_SRC)" > smx-op-src.mk-t
+../move-if-change smx-op-src.mk-t smx-op-src.mk
--- a/liboctave/mx-ops
+++ b/liboctave/mx-ops
@@ -16,6 +16,9 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
+# NOTE: if this file changes, you must run autogen.sh and configure to
+# rebuild the source file lists for Make.
+
 # types
 #
 # key typename object-type header fwd-decl-ok scalar-zero core-type
--- a/liboctave/sparse-mx-ops
+++ b/liboctave/sparse-mx-ops
@@ -16,6 +16,9 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
+# NOTE: if this file changes, you must run autogen.sh and configure to
+# rebuild the source file lists for Make.
+
 # types
 #
 # key typename object-type header fwd-decl-ok scalar-zero
--- a/liboctave/vx-ops
+++ b/liboctave/vx-ops
@@ -16,6 +16,9 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
+# NOTE: if this file changes, you must run autogen.sh and configure to
+# rebuild the source file lists for Make.
+
 # types
 ccv ComplexColumnVector V CColVector.h YES 0.0
 crv ComplexRowVector V CRowVector.h YES 0.0
deleted file mode 100644
--- a/m4/Makefile.in
+++ /dev/null
@@ -1,62 +0,0 @@
-# Makefile for octave's m4 directory
-#
-# Copyright (C) 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_DATA = @INSTALL_DATA@
-
-M4_FILES = acx_blas.m4 acx_blas_f77_func.m4 acx_lapack.m4 acx_pthread.m4
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(M4_FILES))
-
-all:
-.PHONY: all
-
-install install-strip:
-.PHONY: install install-strip
-
-uninstall:
-.PHONY: uninstall
-
-tags TAGS:
-.PHONY: tags TAGS
-
-clean mostlyclean:
-.PHONY: clean mostlyclean
-
-distclean:
-	rm -f Makefile
-.PHONY: distclean
-
-maintainer-clean: distclean
-.PHONY: maintainer-clean
-
-conf-dist dist:
-	ln $(DISTFILES) ../`cat ../.fname`/m4
-.PHONY: conf-dist dist
new file mode 100644
--- /dev/null
+++ b/m4/module.mk
@@ -0,0 +1,11 @@
+EXTRA_DIST += \
+  m4/module.mk \
+  m4/acx_blas.m4 \
+  m4/acx_blas_f77_func.m4 \
+  m4/acx_lapack.m4	\
+  m4/acx_pthread.m4 \
+  m4/libtool.m4 \
+  m4/ltoptions.m4 \
+  m4/ltsugar.m4 \
+  m4/ltversion.m4 \
+  m4/lt~obsolete.m4
--- a/mkoctfile.cc.in
+++ b/mkoctfile.cc.in
@@ -184,11 +184,13 @@
   vars["OCTLIBDIR"] = get_variable ("OCTLIBDIR", DEFAULT_OCTLIBDIR);
 
 #if defined (__WIN32__) && ! defined (_POSIX_VERSION)
-  std::string DEFAULT_INCFLAGS = "-I" + quote_path (vars["OCTINCLUDEDIR"])
-    + " -I" + quote_path (vars["OCTINCLUDEDIR"] + "\\octave");
+  std::string DEFAULT_INCFLAGS
+    = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "\\..")
+    + " -I" + quote_path (vars["OCTINCLUDEDIR"]);
 #else
-  std::string DEFAULT_INCFLAGS = "-I" + quote_path (vars["OCTINCLUDEDIR"])
- + " -I" + quote_path (vars["OCTINCLUDEDIR"] + "/octave");
+  std::string DEFAULT_INCFLAGS
+    = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "/..")
+    + " -I" + quote_path (vars["OCTINCLUDEDIR"]);
 #endif
   if (vars["INCLUDEDIR"] != "/usr/include")
     DEFAULT_INCFLAGS += " -I" + quote_path (vars["INCLUDEDIR"]);
--- a/mkoctfile.in
+++ b/mkoctfile.in
@@ -51,7 +51,7 @@
 : ${OCTINCLUDEDIR=$DEFAULT_OCTINCLUDEDIR}
 : ${OCTLIBDIR=$DEFAULT_OCTLIBDIR}
 
-DEFAULT_INCFLAGS="-I$OCTINCLUDEDIR -I$OCTINCLUDEDIR/octave"
+DEFAULT_INCFLAGS="-I$OCTINCLUDEDIR/.. -I$OCTINCLUDEDIR"
 if [ "$INCLUDEDIR" != /usr/include ]; then
   DEFAULT_INCFLAGS="$DEFAULT_INCFLAGS -I$INCLUDEDIR"
 fi
deleted file mode 100644
--- a/octMakefile.in
+++ /dev/null
@@ -1,309 +0,0 @@
-# Makefile for octave
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = .
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-abs_top_srcdir = @abs_top_srcdir@
-VPATH = @srcdir@
-
-SCRIPTS_EXE_SUFFIX = @SCRIPTS_EXE_SUFFIX@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_DATA = @INSTALL_DATA@
-
-CONF_DISTFILES = Makefile octMakefile.in Makeconf.in \
-	configure configure.ac config.guess config.sub aclocal.m4 \
-	config.h.in install-sh autogen.sh
-
-BUILT_DISTFILES = BUGS INSTALL.OCTAVE
-
-DISTFILES = $(CONF_DISTFILES) \
-	COPYING INSTALL NEWS \
-	NEWS.[0-9] PROJECTS README README.Linux README.Windows \
-	README.Cygwin README.MSVC README.kpathsea ROADMAP SENDING-PATCHES \
-	move-if-change octave-sh octave-bug.in octave-bug.cc.in \
-	octave-config.in octave-config.cc.in missing mk-opts.pl mkinstalldirs \
-	mkoctfile.in mkoctfile.cc.in run-octave.in ChangeLog ChangeLog.[0-9]
-
-# Subdirectories in which to run `make all'.
-SUBDIRS = libcruft liboctave src scripts doc examples
-
-# Subdirectories in which to run `make all'.
-INSTALL_SUBDIRS = libcruft liboctave src scripts doc examples
-
-# Subdirectories in which to run `make conf-dist'.
-CONF_DISTSUBDIRS = src m4
-
-# Subdirectories in which to run `make dist'.
-DISTSUBDIRS = $(sort $(SUBDIRS) test emacs m4)
-
-# Subdirectories in which to run clean targets.
-CLEANSUBDIRS = $(DISTSUBDIRS)
-
-DIRS_TO_MAKE = $(bindir) $(datadir) $(libdir) $(octincludedir)/octave \
-  $(fcnfiledir) $(localfcnfiledir) $(localapifcnfiledir) \
-  $(localverfcnfiledir) $(octetcdir) $(octfiledir) $(localoctfiledir) \
-  $(localapioctfiledir) $(localveroctfiledir) $(imagedir) $(archlibdir) \
-  $(localarchlibdir) $(localapiarchlibdir) $(localverarchlibdir)
-
-SHELL_SCRIPTS = octave-bug$(SCRIPTS_EXE_SUFFIX) octave-config$(SCRIPTS_EXE_SUFFIX) \
-		mkoctfile$(SCRIPTS_EXE_SUFFIX)  run-octave
-
-CONFIG_FILES = @ac_config_headers@ @ac_config_files@
-
-all: $(SHELL_SCRIPTS) $(filter-out libcruft liboctave, $(SUBDIRS)) dist-info-files
-	@echo ""
-	@echo "Octave successfully built.  Now choose from the following:"
-	@echo ""
-	@echo "   ./run-octave    - to run in place to test before installing"
-	@echo "   make check      - to run the tests"
-	@echo "   make install    - to install (PREFIX=$(prefix))"
-	@echo ""
-.PHONY: all
-
-configfiles: $(CONFIG_FILES)
-	for dir in $(CONFIG_SUBDIRS); do \
-	  $(MAKE) -C $$dir configfiles; \
-	done
-.PHONY: configfiles
-
-$(CONFIG_FILES): %: %.in config.status
-	./config.status $@
-
-config.status: configure
-	./config.status --recheck
-
-M4_FILES = $(wildcard m4/*.m4)
-
-configure: configure.ac $(M4_FILES)
-	(cd $(top_srcdir); autoconf --force)
-	(cd $(top_srcdir); autoheader --force)
-
-src: liboctave
-
-liboctave: libcruft
-
-$(SUBDIRS):
-	$(MAKE) -C $@ all
-.PHONY: $(SUBDIRS)
-
-octave-bug: octave-bug.in Makeconf octMakefile $(top_srcdir)/src/version.h
-	@$(do-subst-config-vals)
-	chmod a+rx $@
-
-octave-bug.cc: octave-bug.cc.in Makeconf octMakefile
-	@$(do-subst-config-vals)
-
-ifneq ($(EXEEXT),)
-octave-bug$(EXEEXT): octave-bug.o
-	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
-	    $(ALL_LDFLAGS) -o $@ octave-bug.o
-endif
-
-octave-config: octave-config.in Makeconf octMakefile $(top_srcdir)/src/version.h
-	@$(do-subst-default-vals)
-	chmod a+rx $@
-
-octave-config.cc: octave-config.cc.in Makeconf octMakefile
-	@$(do-subst-default-vals)
-
-ifneq ($(EXEEXT),)
-octave-config$(EXEEXT): octave-config.o
-	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
-	    $(ALL_LDFLAGS) -o $@ octave-config.o
-endif
-
-mkoctfile: mkoctfile.in Makeconf octMakefile $(top_srcdir)/src/version.h
-	@$(do-subst-config-vals)
-	chmod a+rx $@
-
-mkoctfile.cc: mkoctfile.cc.in Makeconf octMakefile
-	@$(do-subst-config-vals)
-
-ifneq ($(EXEEXT),)
-mkoctfile$(EXEEXT): mkoctfile.o
-	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
-	    $(ALL_LDFLAGS) -o $@ mkoctfile.o
-endif
-
-run-octave: run-octave.in Makeconf octMakefile
-	@$(do-subst-script-vals)
-	chmod a+rx "$@"
-
-check:
-	$(MAKE) -C test $@
-.PHONY: check
-
-octave.info:
-	$(MAKE) -C doc/interpreter octave.info
-.PHONY: octave.info
-
-BUGS INSTALL.OCTAVE:
-	$(MAKE) -C doc ../$@
-.PHONY: BUGS INSTALL.OCTAVE
-
-install install-strip ::
-	$(top_srcdir)/mkinstalldirs $(addprefix $(DESTDIR), $(DIRS_TO_MAKE))
-	rm -f $(DESTDIR)$(bindir)/octave-bug$(SCRIPTS_EXE_SUFFIX)
-	$(INSTALL_SCRIPT) octave-bug$(SCRIPTS_EXE_SUFFIX) \
-	    $(DESTDIR)$(bindir)/octave-bug-$(version)$(SCRIPTS_EXE_SUFFIX)
-	(cd $(DESTDIR)$(bindir); $(LN_S) octave-bug-$(version)$(SCRIPTS_EXE_SUFFIX) \
-	    $(DESTDIR)$(bindir)/octave-bug$(SCRIPTS_EXE_SUFFIX))
-	rm -f $(DESTDIR)$(bindir)/octave-config$(SCRIPTS_EXE_SUFFIX)
-	$(INSTALL_SCRIPT) \
-	  octave-config$(SCRIPTS_EXE_SUFFIX) $(DESTDIR)$(bindir)/octave-config-$(version)$(SCRIPTS_EXE_SUFFIX)
-	(cd $(DESTDIR)$(bindir); $(LN_S) octave-config-$(version)$(SCRIPTS_EXE_SUFFIX) \
-	    $(DESTDIR)$(bindir)/octave-config$(SCRIPTS_EXE_SUFFIX))
-	rm -f $(DESTDIR)$(bindir)/mkoctfile$(SCRIPTS_EXE_SUFFIX)
-	$(INSTALL_SCRIPT) mkoctfile$(SCRIPTS_EXE_SUFFIX) \
-	    $(DESTDIR)$(bindir)/mkoctfile-$(version)$(SCRIPTS_EXE_SUFFIX)
-	(cd $(DESTDIR)$(bindir); $(LN_S) mkoctfile-$(version)$(SCRIPTS_EXE_SUFFIX) \
-	    $(DESTDIR)$(bindir)/mkoctfile$(SCRIPTS_EXE_SUFFIX))
-	$(INSTALL_DATA) config.h $(DESTDIR)$(octincludedir)/octave/config.h
-	$(INSTALL_DATA) $(srcdir)/NEWS $(DESTDIR)$(octetcdir)/NEWS
-
-uninstall::
-	rm -f $(DESTDIR)$(bindir)/octave-bug$(SCRIPTS_EXE_SUFFIX)
-	rm -f $(DESTDIR)$(bindir)/octave-bug-$(version)$(SCRIPTS_EXE_SUFFIX)
-	rm -f $(DESTDIR)$(bindir)/octave-config$(SCRIPTS_EXE_SUFFIX)
-	rm -f $(DESTDIR)$(bindir)/octave-config-$(version)$(SCRIPTS_EXE_SUFFIX)
-	rm -f $(DESTDIR)$(bindir)/mkoctfile$(SCRIPTS_EXE_SUFFIX)
-	rm -f $(DESTDIR)$(bindir)/mkoctfile-$(version)$(SCRIPTS_EXE_SUFFIX)
-	rm -f $(DESTDIR)$(octincludedir)/octave/config.h
-	rm -f $(DESTDIR)$(octetcdir)/NEWS
-
-maintainer-clean::
-	@echo ""
-	@echo "************************************************************"
-	@echo "*                                                          *"
-	@echo "* This command is intended for maintainers to use; it      *"
-	@echo "* deletes files that may require special tools to rebuild. *"
-	@echo "*                                                          *"
-	@echo "************************************************************"
-	@echo ""
-
-install install-strip uninstall tags TAGS::
-	$(foreach d, $(INSTALL_SUBDIRS), $(do-subdir-for-command))
-.PHONY: install install-strip uninstall tags
-
-clean mostlyclean distclean maintainer-clean::
-	$(foreach d, $(CLEANSUBDIRS), $(do-subdir-for-command))
-.PHONY: clean mostlyclean distclean maintainer-clean
-
-maintainer-clean distclean::
-	rm -f octMakefile Makeconf
-	rm -f config.cache config.h config.log config.status
-	rm -rf autom4te.cache
-	rm -f $(SHELL_SCRIPTS)
-	rm -f mkoctfile.cc octave-config.cc octave-bug.cc
-	rm -f unistd.h
-
-maintainer-clean::
-	rm -f configure config.h.in BUGS INSTALL.OCTAVE
-
-maintainer-clean distclean clean::
-	rm -f mkoctfile$(EXEEXT) octave-config$(EXEEXT) octave-bug$(EXEEXT)
-	rm -f mkoctfile.o octave-config.o octave-bug.o
-
-# Rules for making a source distribution.
-
-dist-info-files: INSTALL.OCTAVE BUGS
-.PHONY: dist-info-files
-
-# The dist target depends on all because we use Octave to build some
-# figures for the manual.  It's best to create those figures with the
-# version of Octave that we are distributing (it may even be required).
-
-dist: all
-	echo octave-$(version) > .fname
-	rm -rf `cat .fname`
-	mkdir `cat .fname`
-	ln $(addprefix $(srcdir)/, $(DISTFILES)) `cat .fname`
-	ln $(BUILT_DISTFILES) `cat .fname`
-	for dir in $(DISTSUBDIRS); do \
-	  mkdir `cat .fname`/$$dir; \
-	  $(MAKE) -C $$dir dist; \
-	done
-	tar chf `cat .fname`.tar `cat .fname`
-	rm -rf `cat .fname`
-	tar xf `cat .fname`.tar
-	find `cat .fname` \( \( -name RCS -a -type d \) \
-	  -o \( -name CVS -a -type d \) -o \( -name OLD -a -type d \) \
-	  -o \( -name autom4te.cache -a -type d \) \
-	  -o -name "=*" -o -name '*~' -o -name '#*#' -o -name config.log \
-	  -o -name config.status -o -name config.cache -o -name stamp-h \
-	  -o -name klibtool.config -o -name stamp-auto \
-	  -o -name c-auto.h \) -print | xargs rm -rf
-	rm -f `cat .fname`/test/octave.test/*.m
-	chmod -R a+rwX `cat .fname`
-	tar cf `cat .fname`.tar `cat .fname`
-	rm -rf `cat .fname`
-	gzip -9 --stdout `cat .fname`.tar > `cat .fname`.tar.gz
-	bzip2 -9 --stdout `cat .fname`.tar > `cat .fname`.tar.bz2
-	date -u > md5sum
-	md5sum `cat .fname`.tar.gz `cat .fname`.tar.bz2 >> md5sum
-	touch `cat .fname`.tar.gz `cat .fname`.tar.bz2 md5sum
-	rm -f .fname
-	@echo "*******************"
-	@echo "Tag the CVS archive"
-	@echo "*******************"
-.PHONY: dist
-
-# Rules for making a snapshot.
-
-snapshot-version:
-	@echo "creating src/version.h"
-	@gawk '/#define OCTAVE_VERSION[ \t]*/ { \
-	  datestring = strftime("%y%m%d", systime()); \
-	  printf("#define OCTAVE_VERSION \"ss-%s\"\n", datestring); \
-	  next; \
-	} { print $$0 }' src/version.h > src/version.h.new
-	@$(top_srcdir)/move-if-change src/version.h.new src/version.h
-.PHONY: snapshot-version
-
-snapshot: snapshot-version
-	$(MAKE) dist
-.PHONY: snapshot
-
-# Rules for making a dist of just the stuff needed to run configure.
-
-conf-dist:
-	echo config-dist-$(version) > .fname
-	rm -rf `cat .fname`
-	mkdir `cat .fname`
-	ln $(CONF_DISTFILES) `cat .fname`
-	for dir in $(CONF_DISTSUBDIRS); do \
-	  mkdir `cat .fname`/$$dir; \
-	  $(MAKE) -C $$dir conf-dist; \
-	done
-	tar chf `cat .fname`.tar `cat .fname`
-	rm -rf `cat .fname`
-	gzip --best `cat .fname`.tar
-	rm -f .fname
-.PHONY: conf-dist
-
-.NOTPARALLEL:
--- a/run-octave.in
+++ b/run-octave.in
@@ -30,11 +30,6 @@
 top_srcdir='%abs_top_srcdir%'
 builddir='%builddir%'
 
-ldpreloadsep="%ldpreloadsep%"
-liboctinterp="$builddir/src/%liboctinterp%"
-liboctave="$builddir/liboctave/%liboctave%"
-libcruft="$builddir/libcruft/%libcruft%"
-
 d1="$top_srcdir/test"
 d2="$top_srcdir/scripts"
 d3="$builddir/scripts"
@@ -53,7 +48,7 @@
 LOADPATH="$d1_path:$d2_path:$d3_path:$d4_path"
 IMAGEPATH="$top_srcdir/scripts/image"
 DOCFILE="$builddir/doc/interpreter/doc-cache"
-INFOFILE="$builddir/doc/interpreter/octave.info"
+INFOFILE="$top_srcdir/doc/interpreter/octave.info"
 
 if [ $# -gt 0 ]; then
   if [ "x$1" = "x-g" ]; then
@@ -69,7 +64,7 @@
 fi
 
 OCTAVE_SITE_INITFILE="$top_srcdir/scripts/startup/main-rcfile" \
-LD_PRELOAD="$libcruft$ldpreloadsep$liboctave$ldpreloadsep$liboctinterp" \
-%library_path_var%="$builddir/src:$builddir/liboctave:$builddir/libcruft:$%library_path_var%" \
-  exec $driver "$builddir/src/octave" --no-init-path --path="$LOADPATH" --image-path="$IMAGEPATH" --doc-cache-file="$DOCFILE" --info-file="$INFOFILE" "$@"
-
+  exec $builddir/libtool --mode=execute $driver \
+    "$builddir/src/octave" --no-init-path --path="$LOADPATH" \
+    --image-path="$IMAGEPATH" --doc-cache-file="$DOCFILE" \
+    --info-file="$INFOFILE" "$@"
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,35 @@
+2009-11-10  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am, audio/module.mk, deprecated/module.mk,
+	elfun/module.mk, general/module.mk, geometry/module.mk,
+	help/module.mk, image/module.mk, io/module.mk,
+	linear-algebra/module.mk, miscellaneous/module.mk,
+	optimization/module.mk, path/module.mk, pkg/module.mk,
+	plot/module.mk, polynomial/module.mk, set/module.mk,
+	signal/module.mk, sparse/Makefile.in, specfun/Makefile.in,
+	special-matrix/Makefile.in, startup/Makefile.in,
+	statistics/Makefile.in, statistics/base/module.mk,
+	statistics/distributions/module.mk, statistics/models/module.mk,
+	statistics/tests/module.mk, strings/module.mk, testfun/module.mk,
+	time/module.mk: New files.
+	* Makefile.in, move-if-change, configure.ac, audio/Makefile.in,
+	deprecated/Makefile.in, elfun/Makefile.in, general/Makefile.in,
+	geometry/Makefile.in, help/Makefile.in, image/Makefile.in,
+	io/Makefile.in, linear-algebra/Makefile.in,
+	miscellaneous/Makefile.in, optimization/Makefile.in,
+	path/Makefile.in, pkg/Makefile.in, plot/Makefile.in,
+	polynomial/Makefile.in, set/Makefile.in, signal/Makefile.in,
+	skip-autoheader, sparse/module.mk, specfun/module.mk,
+	special-matrix/module.mk, startup/module.mk,
+	statistics/base/Makefile.in, statistics/distributions/Makefile.in,
+	statistics/models/Makefile.in, statistics/tests/Makefile.in,
+	strings/Makefile.in, testfun/Makefile.in, time/Makefile.in:
+	Delete.
+	* mk-pkg-add: Rename from mkpkgadd.
+	* mkdoc, mk-pkg-addd: Operate on explicit lists of files instead
+	of directory names.
+	* mkdoc: Skip files not ending in .m.
+
 2009-11-10  Ben Abbott <bpabbott@mac.com>
 
 	* plot/__go_draw_axes__.m: No 'with linestyle' when linestyle == 'none'.
new file mode 100644
--- /dev/null
+++ b/scripts/Makefile.am
@@ -0,0 +1,439 @@
+# Makefile for octave's scripts directory
+#
+# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
+#               2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ..
+
+include ../common.mk 
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+FCN_FILE_DIRS =
+
+EXTRA_DIST = \
+  gethelp.cc \
+  mkdoc \
+  mk-pkg-add
+
+FCN_FILES =
+
+GEN_FCN_FILES =
+
+PKG_ADD_FILES =
+
+IMAGES =
+
+include audio/module.mk
+include deprecated/module.mk
+include elfun/module.mk
+include general/module.mk
+include geometry/module.mk
+include help/module.mk
+include image/module.mk
+include io/module.mk
+include linear-algebra/module.mk
+include miscellaneous/module.mk
+include optimization/module.mk
+include path/module.mk
+include pkg/module.mk
+include plot/module.mk
+include polynomial/module.mk
+include set/module.mk
+include signal/module.mk
+include sparse/module.mk
+include specfun/module.mk
+include special-matrix/module.mk
+include startup/module.mk
+include statistics/base/module.mk
+include statistics/distributions/module.mk
+include statistics/models/module.mk
+include statistics/tests/module.mk
+include strings/module.mk
+include testfun/module.mk
+include time/module.mk
+
+nobase_fcnfile_DATA = $(FCN_FILES) $(GEN_FCN_FILES)
+
+octave_dirstamp = $(am__leading_dot)dirstamp
+
+audio/PKG_ADD: $(audio_FCN_FILES) $(audio_GEN_FCN_FILES) audio/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(audio_FCN_FILES) -- $(audio_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+deprecated/PKG_ADD: $(deprecated_FCN_FILES) $(deprecated_GEN_FCN_FILES) deprecated/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(deprecated_FCN_FILES) -- $(deprecated_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+elfun/PKG_ADD: $(elfun_FCN_FILES) $(elfun_GEN_FCN_FILES) elfun/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(elfun_FCN_FILES) -- $(elfun_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+general/PKG_ADD: $(general_FCN_FILES) $(general_GEN_FCN_FILES) general/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(general_FCN_FILES) -- $(general_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+geometry/PKG_ADD: $(geometry_FCN_FILES) $(geometry_GEN_FCN_FILES) geometry/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(geometry_FCN_FILES) -- $(geometry_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+help/PKG_ADD: $(help_FCN_FILES) $(help_GEN_FCN_FILES) help/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(help_FCN_FILES) -- $(help_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+image/PKG_ADD: $(image_FCN_FILES) $(image_GEN_FCN_FILES) image/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(image_FCN_FILES) -- $(image_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+io/PKG_ADD: $(io_FCN_FILES) $(io_GEN_FCN_FILES) io/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(io_FCN_FILES) -- $(io_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+linear-algebra/PKG_ADD: $(linear_algebra_FCN_FILES) $(linear_algebra_GEN_FCN_FILES) linear-algebra/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(linear_algebra_FCN_FILES) -- $(linear_algebra_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+miscellaneous/PKG_ADD: $(miscellaneous_FCN_FILES) $(miscellaneous_GEN_FCN_FILES) miscellaneous/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(miscellaneous_FCN_FILES) -- $(miscellaneous_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+optimization/PKG_ADD: $(optimization_FCN_FILES) $(optimization_GEN_FCN_FILES) optimization/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add "$(srcdir)" $(optimization_FCN_FILES) -- $(optimization_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+path/PKG_ADD: $(path_FCN_FILES) $(path_GEN_FCN_FILES) path/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(path_FCN_FILES) -- $(path_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+pkg/PKG_ADD: $(pkg_FCN_FILES) $(pkg_GEN_FCN_FILES) pkg/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(pkg_FCN_FILES) -- $(pkg_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+plot/PKG_ADD: $(plot_FCN_FILES) $(plot_GEN_FCN_FILES) plot/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(plot_FCN_FILES) -- $(plot_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+polynomial/PKG_ADD: $(polynomial_FCN_FILES) $(polynomial_GEN_FCN_FILES) polynomial/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(polynomial_FCN_FILES) -- $(polynomial_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+set/PKG_ADD: $(set_FCN_FILES) $(set_GEN_FCN_FILES) set/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(set_FCN_FILES) -- $(set_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+signal/PKG_ADD: $(signal_FCN_FILES) $(signal_GEN_FCN_FILES) signal/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(signal_FCN_FILES) -- $(signal_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+sparse/PKG_ADD: $(sparse_FCN_FILES) $(sparse_GEN_FCN_FILES) sparse/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(sparse_FCN_FILES) -- $(sparse_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+specfun/PKG_ADD: $(specfun_FCN_FILES) $(specfun_GEN_FCN_FILES) specfun/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(specfun_FCN_FILES) -- $(specfun_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+special-matrix/PKG_ADD: $(special_matrix_FCN_FILES) $(special_matrix_GEN_FCN_FILES) special-matrix/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(special_matrix_FCN_FILES) -- $(special_matrix_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+startup/PKG_ADD: $(startup_FCN_FILES) $(startup_GEN_FCN_FILES) startup/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(startup_FCN_FILES) -- $(startup_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+statistics/base/PKG_ADD: $(statistics_base_FCN_FILES) $(statistics_base_GEN_FCN_FILES) statistics/base/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(statistics_base_FCN_FILES) -- $(statistics_base_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+statistics/distributions/PKG_ADD: $(statistics_distributions_FCN_FILES) $(statistics_distributions_GEN_FCN_FILES) statistics/distributions/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(statistics_distributions_FCN_FILES) -- $(statistics_distributions_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+statistics/models/PKG_ADD: $(statistics_models_FCN_FILES) $(statistics_models_GEN_FCN_FILES) statistics/models/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(statistics_models_FCN_FILES) -- $(statistics_models_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+statistics/tests/PKG_ADD: $(statistics_tests_FCN_FILES) $(statistics_tests_GEN_FCN_FILES) statistics/tests/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(statistics_tests_FCN_FILES) -- $(statistics_tests_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+strings/PKG_ADD: $(strings_FCN_FILES) $(strings_GEN_FCN_FILES) strings/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(strings_FCN_FILES) -- $(strings_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+testfun/PKG_ADD: $(testfun_FCN_FILES) $(testfun_GEN_FCN_FILES) testfun/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(testfun_FCN_FILES) -- $(testfun_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+time/PKG_ADD: $(time_FCN_FILES) $(time_GEN_FCN_FILES) time/$(octave_dirstamp) mk-pkg-add
+	@echo "generating $@"
+	@$(srcdir)/mk-pkg-add $(srcdir) $(time_FCN_FILES) -- $(time_GEN_FCN_FILES) > $@-t
+	@mv $@-t $@
+
+$(audio_GEN_FCN_FILES): audio/$(octave_dirstamp)
+$(deprecated_GEN_FCN_FILES): deprecated/$(octave_dirstamp)
+$(elfun_GEN_FCN_FILES): elfun/$(octave_dirstamp)
+$(general_GEN_FCN_FILES): general/$(octave_dirstamp)
+$(geometry_GEN_FCN_FILES): geometry/$(octave_dirstamp)
+$(help_GEN_FCN_FILES): help/$(octave_dirstamp)
+$(image_GEN_FCN_FILES): image/$(octave_dirstamp)
+$(io_GEN_FCN_FILES): io/$(octave_dirstamp)
+$(linear_algebra_GEN_FCN_FILES): linear-algebra/$(octave_dirstamp)
+$(miscellaneous_GEN_FCN_FILES): miscellaneous/$(octave_dirstamp)
+$(optimization_GEN_FCN_FILES): optimization/$(octave_dirstamp)
+$(path_GEN_FCN_FILES): path/$(octave_dirstamp)
+$(pkg_GEN_FCN_FILES): pkg/$(octave_dirstamp)
+$(plot_GEN_FCN_FILES): plot/$(octave_dirstamp)
+$(polynomial_GEN_FCN_FILES): polynomial/$(octave_dirstamp)
+$(set_GEN_FCN_FILES): set/$(octave_dirstamp)
+$(signal_GEN_FCN_FILES): signal/$(octave_dirstamp)
+$(sparse_GEN_FCN_FILES): sparse/$(octave_dirstamp)
+$(specfun_GEN_FCN_FILES): specfun/$(octave_dirstamp)
+$(special_matrix_GEN_FCN_FILES): special-matrix/$(octave_dirstamp)
+$(startup_GEN_FCN_FILES): startup/$(octave_dirstamp)
+$(statistics_base_GEN_FCN_FILES): statistics/base/$(octave_dirstamp)
+$(statistics_distributions_GEN_FCN_FILES): statistics/distributions/$(octave_dirstamp)
+$(statistics_models_GEN_FCN_FILES): statistics/models/$(octave_dirstamp)
+$(statistics_tests_GEN_FCN_FILES): statistics/tests/$(octave_dirstamp)
+$(strings_GEN_FCN_FILES): strings/$(octave_dirstamp)
+$(testfun_GEN_FCN_FILES): testfun/$(octave_dirstamp)
+$(time_GEN_FCN_FILES): time/$(octave_dirstamp)
+
+audio/$(octave_dirstamp):
+	@$(MKDIR_P) audio
+	@: > audio/$(octave_dirstamp)
+deprecated/$(octave_dirstamp):
+	@$(MKDIR_P) deprecated
+	@: > deprecated/$(octave_dirstamp)
+elfun/$(octave_dirstamp):
+	@$(MKDIR_P) elfun
+	@: > elfun/$(octave_dirstamp)
+general/$(octave_dirstamp):
+	@$(MKDIR_P) general
+	@: > general/$(octave_dirstamp)
+geometry/$(octave_dirstamp):
+	@$(MKDIR_P) geometry
+	@: > geometry/$(octave_dirstamp)
+help/$(octave_dirstamp):
+	@$(MKDIR_P) help
+	@: > help/$(octave_dirstamp)
+image/$(octave_dirstamp):
+	@$(MKDIR_P) image
+	@: > image/$(octave_dirstamp)
+io/$(octave_dirstamp):
+	@$(MKDIR_P) io
+	@: > io/$(octave_dirstamp)
+linear-algebra/$(octave_dirstamp):
+	@$(MKDIR_P) linear-algebra
+	@: > linear-algebra/$(octave_dirstamp)
+miscellaneous/$(octave_dirstamp):
+	@$(MKDIR_P) miscellaneous
+	@: > miscellaneous/$(octave_dirstamp)
+optimization/$(octave_dirstamp):
+	@$(MKDIR_P) optimization
+	@: > optimization/$(octave_dirstamp)
+path/$(octave_dirstamp):
+	@$(MKDIR_P) path
+	@: > path/$(octave_dirstamp)
+pkg/$(octave_dirstamp):
+	@$(MKDIR_P) pkg
+	@: > pkg/$(octave_dirstamp)
+plot/$(octave_dirstamp):
+	@$(MKDIR_P) plot
+	@: > plot/$(octave_dirstamp)
+polynomial/$(octave_dirstamp):
+	@$(MKDIR_P) polynomial
+	@: > polynomial/$(octave_dirstamp)
+set/$(octave_dirstamp):
+	@$(MKDIR_P) set
+	@: > set/$(octave_dirstamp)
+signal/$(octave_dirstamp):
+	@$(MKDIR_P) signal
+	@: > signal/$(octave_dirstamp)
+sparse/$(octave_dirstamp):
+	@$(MKDIR_P) sparse
+	@: > sparse/$(octave_dirstamp)
+specfun/$(octave_dirstamp):
+	@$(MKDIR_P) specfun
+	@: > specfun/$(octave_dirstamp)
+special-matrix/$(octave_dirstamp):
+	@$(MKDIR_P) special-matrix
+	@: > special-matrix/$(octave_dirstamp)
+startup/$(octave_dirstamp):
+	@$(MKDIR_P) startup
+	@: > startup/$(octave_dirstamp)
+statistics/base/$(octave_dirstamp):
+	@$(MKDIR_P) statistics/base
+	@: > statistics/base/$(octave_dirstamp)
+statistics/distributions/$(octave_dirstamp):
+	@$(MKDIR_P) statistics/distributions
+	@: > statistics/distributions/$(octave_dirstamp)
+statistics/models/$(octave_dirstamp):
+	@$(MKDIR_P) statistics/models
+	@: > statistics/models/$(octave_dirstamp)
+statistics/tests/$(octave_dirstamp):
+	@$(MKDIR_P) statistics/tests
+	@: > statistics/tests/$(octave_dirstamp)
+strings/$(octave_dirstamp):
+	@$(MKDIR_P) strings
+	@: > strings/$(octave_dirstamp)
+testfun/$(octave_dirstamp):
+	@$(MKDIR_P) testfun
+	@: > testfun/$(octave_dirstamp)
+time/$(octave_dirstamp):
+	@$(MKDIR_P) time
+	@: > time/$(octave_dirstamp)
+
+FCN_FILES_IN = $(GEN_FCN_FILES:.m=.in)
+
+EXTRA_DIST += \
+  $(IMAGES) \
+  $(FCN_FILES) \
+  $(FCN_FILES_IN)
+
+all-local: $(GEN_FCN_FILES) $(PKG_ADD_FILES) DOCSTRINGS
+
+DOCSTRINGS: gethelp$(BUILD_EXEEXT) mkdoc $(FCN_FILES)
+	@echo "generating $@"
+	@$(srcdir)/mkdoc "$(srcdir)" $(FCN_FILES) -- $(GEN_FCN_FILES) > $@.t
+	@mv $@.t $@
+
+gethelp$(BUILD_EXEEXT): gethelp.cc
+	$(BUILD_CXX) $(BUILD_CXXFLAGS) -o $@ $^ $(BUILD_LDFLAGS)
+
+$(GEN_FCN_FILES) : %.m : %.in Makefile
+	@$(do_subst_config_vals)
+
+check-m-sources:
+	@echo -n "checking whether files in source tree are listed in module.mk files..."; \
+	for f in $$(find $(srcdir) -name '*.m'); do \
+	  found=false; \
+	  for m in $(FCN_FILES); do \
+	    if [ "$$f" = $(srcdir)/"$$m" ]; then \
+	      found=true; \
+	      break; \
+	    fi; \
+	  done; \
+	  if $$found; then \
+	    true; \
+	  else \
+	    missing=$$(echo $$f | $(SED) "s|^$(srcdir)||"); \
+	    echo "$$missing: not listed in SOURCES"; \
+	  fi; \
+	done; \
+	if test -z "$$missing"; then \
+	  echo "yes"; \
+	fi
+.PHONY: check-m-sources
+
+install-data-local: install-images install-startup-files install-pkg-add
+.PHONY: install-data-local
+
+uninstall-local: uninstall-images uninstall-startup-files uninstall-pkg-add
+.PHONY: uninstall-local
+
+install-images:
+	$(MKDIR_P) $(DESTDIR)$(imagedir)
+	for im in $(IMAGES); do \
+	  f=`echo $$im | $(SED) 's,image/,,'`; \
+	  echo "$(INSTALL_DATA) $(srcdir)/$$im $(DESTDIR)$(imagedir)/$$f"; \
+	  $(INSTALL_DATA) $(srcdir)/$$im $(DESTDIR)$(imagedir)/$$f; \
+	done
+.PHONY: install-images
+
+uninstall-images:
+	for im in $(IMAGES); do \
+	  f=`echo $$im | $(SED) 's,.*/,,'`; \
+	  echo "rm -f $(DESTDIR)$(imagedir)/$$f"; \
+	  rm -f $(DESTDIR)$(imagedir)/$$f; \
+	done
+.PHONY: uninstall-images
+
+install-startup-files:
+	$(MKDIR_P) $(DESTDIR)$(fcnfiledir)/startup
+	if test -f $(DESTDIR)$(fcnfiledir)/startup/octaverc; then true; \
+	else \
+	  $(INSTALL_DATA) $(srcdir)/$(SYSTEM_STARTUP_FILE_SRC) \
+	    $(DESTDIR)$(fcnfiledir)/startup/octaverc; \
+	fi
+	if test -f $(DESTDIR)$(fcnfiledir)/startup/inputrc; then true; \
+	else \
+	  $(INSTALL_DATA) $(srcdir)/$(SYSTEM_INPUTRC_FILE_SRC) \
+	    $(DESTDIR)$(fcnfiledir)/startup/inputrc; \
+	fi
+	$(MKDIR_P) $(DESTDIR)$(localfcnfiledir)/startup
+	if test -f $(DESTDIR)$(localfcnfiledir)/startup/octaverc; \
+	then true; \
+	else \
+	  $(INSTALL_DATA) $(srcdir)/$(LOCAL_STARTUP_FILE_SRC) \
+	    $(DESTDIR)$(localfcnfiledir)/startup/octaverc; \
+	fi
+.PHONY: install-startup-files
+
+uninstall-startup-files:
+	rm -f $(DESTDIR)$(fcnfiledir)/startup/octaverc
+	rm -f $(DESTDIR)$(fcnfiledir)/startup/inputrc
+	rm -f $(DESTDIR)$(localfcnfiledir)/startup/octaverc
+.PHONY: uninstall-startup-files
+
+install-pkg-add:
+	for f in $(PKG_ADD_FILES); do \
+	  if [ -n "`cat $$f`" ]; then \
+	    $(MKDIR_P) $(DESTDIR)$(fcnfiledir)/`echo $$f | $(SED) 's,/[^/]*$$,,'`; \
+	    $(INSTALL_DATA) $$f $(DESTDIR)$(fcnfiledir)/$$f; \
+	  fi \
+	done
+.PHONY: install-pkg-add
+
+uninstall-pkg-add:
+	for f in $(PKG_ADD_FILES); do \
+	  rm -f $(DESTDIR)$(fcnfiledir)/$$f; \
+	done
+.PHONY: uninstall-pkg-add
+
+# ## optimization:
+
+# EXTRAS = glpktest1 glpktest2
deleted file mode 100644
--- a/scripts/Makefile.in
+++ /dev/null
@@ -1,126 +0,0 @@
-# Makefile for octave's scripts directory
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
-#               2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-script_sub_dir = .
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES =
-
-ifeq ($(srcdir),.)
-  M_FILE_DIRS := $(srcdir)
-else
-  M_FILE_DIRS := $(srcdir) .
-endif
-
-## Define this with =, not := so that the generated plot/gnuplot_binary.m
-## file will be included in the list when it is available.
-ALL_M_FILES = $(shell find $(M_FILE_DIRS) -name '*.m' -print)
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in ChangeLog $(SOURCES) \
-	configure.ac configure mkinstalldirs mkdoc mkpkgadd gethelp.cc \
-	skip-autoheader move-if-change) DOCSTRINGS
-
-SUBDIRS = audio deprecated elfun general geometry help image io \
-	linear-algebra miscellaneous optimization path pkg plot polynomial \
-	set signal sparse specfun special-matrix startup \
-	statistics strings testfun time
-
-DISTSUBDIRS = $(SUBDIRS)
-
-FCN_FILES = # $(wildcard $(srcdir)/*.m)
-FCN_FILES_NO_DIR = # $(notdir $(FCN_FILES))
-
-CONFIG_FILES = @ac_config_files@
-
-all: $(SUBDIRS) DOCSTRINGS
-.PHONY: all
-
-configfiles: $(CONFIG_FILES)
-.PHONY: configfiles
-
-$(CONFIG_FILES): %: %.in config.status
-	./config.status $@
-
-config.status: configure
-	./config.status --recheck
-
-configure: configure.ac
-	if [ ! -f skip-autoconf ]; then autoconf --force; fi
-	if [ ! -f skip-autoheader ]; then autoheader --force; fi
-
-$(SUBDIRS):
-	$(MAKE) -C $@ all
-.PHONY: $(SUBDIRS)
-
-## Kluge alert:
-plot/gnuplot_binary.m:
-	$(MAKE) -C plot $(notdir $@)
-
-DOCSTRINGS: plot/gnuplot_binary.m gethelp$(BUILD_EXEEXT) mkdoc $(ALL_M_FILES)
-	$(srcdir)/mkdoc $(ALL_M_FILES) > $@.t
-	mv $@.t $@
-
-gethelp$(BUILD_EXEEXT): gethelp.cc
-	$(BUILD_CXX) $(BUILD_CXXFLAGS) -o $@ $^ $(BUILD_LDFLAGS)
-
-install install-strip uninstall clean mostlyclean distclean maintainer-clean::
-	@$(subdir-for-command)
-.PHONY: install install-strip uninstall
-.PHONY: clean mostlyclean distclean maintainer-clean
-
-tags TAGS:: $(SOURCES)
-	$(subdir-for-command)
-
-tags::
-	ctags $(SOURCES)
-
-TAGS:: $(SOURCES)
-	etags $(SOURCES)
-
-clean distclean maintainer-clean::
-	rm -f gethelp$(BUILD_EXEEXT)
-
-distclean maintainer-clean::
-	rm -f tags TAGS Makefile config.log config.status DOCSTRINGS
-	rm -rf autom4te.cache
-
-maintainer-clean::
-	rm -f configure
-
-dist:
-	ln $(DISTFILES) ../`cat ../.fname`/scripts
-	for dir in $(DISTSUBDIRS); do mkdir ../`cat ../.fname`/scripts/$$dir; $(MAKE) -C $$dir $@; done
-.PHONY: dist
-
-check-m-sources:
-	@$(subdir-for-command)
-.PHONY: check-m-sources
deleted file mode 100644
--- a/scripts/audio/Makefile.in
+++ /dev/null
@@ -1,84 +0,0 @@
-# Makefile for octave's scripts/audio directory
-#
-# Copyright (C) 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = audio
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = lin2mu.m loadaudio.m mu2lin.m playaudio.m record.m \
-  saveaudio.m setaudio.m wavread.m wavwrite.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/audio
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/audio/module.mk
@@ -0,0 +1,16 @@
+FCN_FILE_DIRS += audio
+
+audio_FCN_FILES = \
+  audio/lin2mu.m \
+  audio/loadaudio.m \
+  audio/mu2lin.m \
+  audio/playaudio.m \
+  audio/record.m \
+  audio/saveaudio.m \
+  audio/setaudio.m \
+  audio/wavread.m \
+  audio/wavwrite.m
+
+FCN_FILES += $(audio_FCN_FILES)
+
+PKG_ADD_FILES += audio/PKG_ADD
deleted file mode 100644
--- a/scripts/configure.ac
+++ /dev/null
@@ -1,42 +0,0 @@
-dnl configure.in
-dnl
-dnl Process this file with autoconf to produce a configure script.
-dnl
-dnl Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2005, 2006, 2007,
-dnl               2008, 2009 John W. Eaton
-### 
-### This file is part of Octave.
-### 
-### Octave is free software; you can redistribute it and/or modify it
-### under the terms of the GNU General Public License as published by the
-### Free Software Foundation; either version 3 of the License, or (at
-### your option) any later version.
-### 
-### Octave is distributed in the hope that it will be useful, but WITHOUT
-### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-### FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-### for more details.
-### 
-### You should have received a copy of the GNU General Public License
-### along with Octave; see the file COPYING.  If not, see
-### <http://www.gnu.org/licenses/>.
-
-AC_INIT
-AC_REVISION()
-AC_PREREQ(2.52)
-AC_CONFIG_SRCDIR([startup/inputrc])
-
-AC_PROG_INSTALL
-
-AC_SUBST(ac_config_files)
-AC_CONFIG_FILES([Makefile audio/Makefile deprecated/Makefile elfun/Makefile \
-	  general/Makefile geometry/Makefile help/Makefile image/Makefile \
-	  io/Makefile linear-algebra/Makefile miscellaneous/Makefile \
-	  optimization/Makefile path/Makefile pkg/Makefile plot/Makefile \
-	  polynomial/Makefile set/Makefile \
-	  signal/Makefile sparse/Makefile specfun/Makefile \
-	  special-matrix/Makefile startup/Makefile statistics/Makefile \
-	  statistics/base/Makefile statistics/distributions/Makefile \
-	  statistics/models/Makefile statistics/tests/Makefile \
-	  strings/Makefile time/Makefile testfun/Makefile])
-AC_OUTPUT
deleted file mode 100644
--- a/scripts/deprecated/Makefile.in
+++ /dev/null
@@ -1,108 +0,0 @@
-# Makefile for octave's scripts/deprecated directory
-#
-# Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = deprecated
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = beta_cdf.m beta_inv.m beta_pdf.m beta_rnd.m \
-  binomial_cdf.m binomial_inv.m binomial_pdf.m binomial_rnd.m \
-  chisquare_cdf.m chisquare_inv.m chisquare_pdf.m chisquare_rnd.m \
-  clearplot.m clg.m com2str.m create_set.m \
-  dmult.m exponential_cdf.m exponential_inv.m \
-  exponential_pdf.m exponential_rnd.m f_cdf.m f_inv.m f_pdf.m \
-  f_rnd.m gamma_cdf.m gamma_inv.m gamma_pdf.m gamma_rnd.m \
-  geometric_cdf.m geometric_inv.m geometric_pdf.m geometric_rnd.m \
-  hypergeometric_cdf.m hypergeometric_inv.m hypergeometric_pdf.m \
-  hypergeometric_rnd.m intersection.m is_bool.m is_complex.m \
-  is_list.m is_matrix.m is_scalar.m is_square.m is_stream.m \
-  is_struct.m is_symmetric.m is_vector.m iscommand.m israwcommand.m \
-  isstr.m lchol.m loadimage.m lognormal_cdf.m lognormal_inv.m \
-  lognormal_pdf.m lognormal_rnd.m mark_as_command.m \
-  mark_as_rawcommand.m meshdom.m normal_cdf.m normal_inv.m \
-  normal_pdf.m normal_rnd.m pascal_cdf.m pascal_inv.m pascal_pdf.m \
-  pascal_rnd.m poisson_cdf.m poisson_inv.m poisson_pdf.m \
-  poisson_rnd.m polyinteg.m setstr.m spatan2.m spchol2inv.m \
-  spcholinv.m spcumprod.m spcumsum.m spchol.m spdet.m spdiag.m \
-  spfind.m spinv.m spkron.m splchol.m split.m splu.m spmax.m spmin.m \
-  spprod.m spqr.m spsum.m spsumsq.m struct_contains.m \
-  struct_elements.m t_cdf.m t_inv.m t_pdf.m t_rnd.m uniform_cdf.m \
-  uniform_inv.m uniform_pdf.m uniform_rnd.m unmark_command.m \
-  unmark_rawcommand.m weibcdf.m weibinv.m weibpdf.m weibrnd.m \
-  weibull_cdf.m weibull_inv.m weibull_pdf.m weibull_rnd.m \
-  wiener_rnd.m str2mat.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/deprecated
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/deprecated/module.mk
@@ -0,0 +1,123 @@
+FCN_FILE_DIRS += deprecated
+
+deprecated_FCN_FILES = \
+  deprecated/beta_cdf.m \
+  deprecated/beta_inv.m \
+  deprecated/beta_pdf.m \
+  deprecated/beta_rnd.m \
+  deprecated/binomial_cdf.m \
+  deprecated/binomial_inv.m \
+  deprecated/binomial_pdf.m \
+  deprecated/binomial_rnd.m \
+  deprecated/chisquare_cdf.m \
+  deprecated/chisquare_inv.m \
+  deprecated/chisquare_pdf.m \
+  deprecated/chisquare_rnd.m \
+  deprecated/clearplot.m \
+  deprecated/clg.m \
+  deprecated/com2str.m \
+  deprecated/create_set.m \
+  deprecated/dmult.m \
+  deprecated/exponential_cdf.m \
+  deprecated/exponential_inv.m \
+  deprecated/exponential_pdf.m \
+  deprecated/exponential_rnd.m \
+  deprecated/f_cdf.m \
+  deprecated/f_inv.m \
+  deprecated/f_pdf.m \
+  deprecated/f_rnd.m \
+  deprecated/gamma_cdf.m \
+  deprecated/gamma_inv.m \
+  deprecated/gamma_pdf.m \
+  deprecated/gamma_rnd.m \
+  deprecated/geometric_cdf.m \
+  deprecated/geometric_inv.m \
+  deprecated/geometric_pdf.m \
+  deprecated/geometric_rnd.m \
+  deprecated/hypergeometric_cdf.m \
+  deprecated/hypergeometric_inv.m \
+  deprecated/hypergeometric_pdf.m \
+  deprecated/hypergeometric_rnd.m \
+  deprecated/intersection.m \
+  deprecated/is_bool.m \
+  deprecated/is_complex.m \
+  deprecated/is_list.m \
+  deprecated/is_matrix.m \
+  deprecated/is_scalar.m \
+  deprecated/is_square.m \
+  deprecated/is_stream.m \
+  deprecated/is_struct.m \
+  deprecated/is_symmetric.m \
+  deprecated/is_vector.m \
+  deprecated/iscommand.m \
+  deprecated/israwcommand.m \
+  deprecated/isstr.m \
+  deprecated/lchol.m \
+  deprecated/loadimage.m \
+  deprecated/lognormal_cdf.m \
+  deprecated/lognormal_inv.m \
+  deprecated/lognormal_pdf.m \
+  deprecated/lognormal_rnd.m \
+  deprecated/mark_as_command.m \
+  deprecated/mark_as_rawcommand.m \
+  deprecated/meshdom.m \
+  deprecated/normal_cdf.m \
+  deprecated/normal_inv.m \
+  deprecated/normal_pdf.m \
+  deprecated/normal_rnd.m \
+  deprecated/pascal_cdf.m \
+  deprecated/pascal_inv.m \
+  deprecated/pascal_pdf.m \
+  deprecated/pascal_rnd.m \
+  deprecated/poisson_cdf.m \
+  deprecated/poisson_inv.m \
+  deprecated/poisson_pdf.m \
+  deprecated/poisson_rnd.m \
+  deprecated/polyinteg.m \
+  deprecated/setstr.m \
+  deprecated/spatan2.m \
+  deprecated/spchol2inv.m \
+  deprecated/spcholinv.m \
+  deprecated/spcumprod.m \
+  deprecated/spcumsum.m \
+  deprecated/spchol.m \
+  deprecated/spdet.m \
+  deprecated/spdiag.m \
+  deprecated/spfind.m \
+  deprecated/spinv.m \
+  deprecated/spkron.m \
+  deprecated/splchol.m \
+  deprecated/split.m \
+  deprecated/splu.m \
+  deprecated/spmax.m \
+  deprecated/spmin.m \
+  deprecated/spprod.m \
+  deprecated/spqr.m \
+  deprecated/spsum.m \
+  deprecated/spsumsq.m \
+  deprecated/struct_contains.m \
+  deprecated/struct_elements.m \
+  deprecated/t_cdf.m \
+  deprecated/t_inv.m \
+  deprecated/t_pdf.m \
+  deprecated/t_rnd.m \
+  deprecated/uniform_cdf.m \
+  deprecated/uniform_inv.m \
+  deprecated/uniform_pdf.m \
+  deprecated/uniform_rnd.m \
+  deprecated/unmark_command.m \
+  deprecated/unmark_rawcommand.m \
+  deprecated/weibcdf.m \
+  deprecated/weibinv.m \
+  deprecated/weibpdf.m \
+  deprecated/weibrnd.m \
+  deprecated/weibull_cdf.m \
+  deprecated/weibull_inv.m \
+  deprecated/weibull_pdf.m \
+  deprecated/weibull_rnd.m \
+  deprecated/wiener_rnd.m \
+  deprecated/str2mat.m
+
+FCN_FILES += $(deprecated_FCN_FILES)
+
+PKG_ADD_FILES += deprecated/PKG_ADD
deleted file mode 100644
--- a/scripts/elfun/Makefile.in
+++ /dev/null
@@ -1,87 +0,0 @@
-# Makefile for octave's scripts/elfun directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = elfun
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = acosd.m acot.m acotd.m acoth.m acsc.m acscd.m \
-  acsch.m asec.m asecd.m asech.m asind.m atand.m cosd.m \
-  cot.m cotd.m coth.m csc.m cscd.m csch.m lcm.m sec.m secd.m \
-  sech.m sind.m tand.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/elfun
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/elfun/module.mk
@@ -0,0 +1,32 @@
+FCN_FILE_DIRS += elfun
+
+elfun_FCN_FILES = \
+  elfun/acosd.m \
+  elfun/acot.m \
+  elfun/acotd.m \
+  elfun/acoth.m \
+  elfun/acsc.m \
+  elfun/acscd.m \
+  elfun/acsch.m \
+  elfun/asec.m \
+  elfun/asecd.m \
+  elfun/asech.m \
+  elfun/asind.m \
+  elfun/atand.m \
+  elfun/cosd.m \
+  elfun/cot.m \
+  elfun/cotd.m \
+  elfun/coth.m \
+  elfun/csc.m \
+  elfun/cscd.m \
+  elfun/csch.m \
+  elfun/lcm.m \
+  elfun/sec.m \
+  elfun/secd.m \
+  elfun/sech.m \
+  elfun/sind.m \
+  elfun/tand.m
+
+FCN_FILES += $(elfun_FCN_FILES)
+
+PKG_ADD_FILES += elfun/PKG_ADD
deleted file mode 100644
--- a/scripts/general/Makefile.in
+++ /dev/null
@@ -1,97 +0,0 @@
-# Makefile for octave's scripts/general directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = general
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = __isequal__.m __splinen__.m accumarray.m arrayfun.m \
-  bicubic.m bitcmp.m bitget.m bitset.m blkdiag.m cart2pol.m \
-  cart2sph.m cellidx.m cell2mat.m celldisp.m circshift.m colon.m common_size.m \
-  cplxpair.m cumtrapz.m dblquad.m deal.m del2.m display.m flipdim.m \
-  fliplr.m flipud.m genvarname.m gradient.m idivide.m int2str.m \
-  interp1.m interp1q.m interp2.m interp3.m interpn.m interpft.m \
-  is_duplicate_entry.m isa.m isdefinite.m isdir.m isequal.m \
-  isequalwithequalnans.m isscalar.m issquare.m issymmetric.m \
-  isvector.m loadobj.m logical.m logspace.m mod.m nargchk.m \
-  nargoutchk.m nextpow2.m nthroot.m num2str.m perror.m pol2cart.m \
-  polyarea.m postpad.m prepad.m quadgk.m quadl.m quadv.m rat.m \
-  rem.m repmat.m rot90.m rotdim.m runlength.m saveobj.m shift.m shiftdim.m \
-  sortrows.m sph2cart.m strerror.m structfun.m subsindex.m \
-  triplequad.m trapz.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/general
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/general/module.mk
@@ -0,0 +1,86 @@
+FCN_FILE_DIRS += general
+
+general_FCN_FILES = \
+  general/__isequal__.m \
+  general/__splinen__.m \
+  general/accumarray.m \
+  general/arrayfun.m \
+  general/bicubic.m \
+  general/bitcmp.m \
+  general/bitget.m \
+  general/bitset.m \
+  general/blkdiag.m \
+  general/cart2pol.m \
+  general/cart2sph.m \
+  general/cellidx.m \
+  general/cell2mat.m \
+  general/celldisp.m \
+  general/circshift.m \
+  general/colon.m \
+  general/common_size.m \
+  general/cplxpair.m \
+  general/cumtrapz.m \
+  general/dblquad.m \
+  general/deal.m \
+  general/del2.m \
+  general/display.m \
+  general/flipdim.m \
+  general/fliplr.m \
+  general/flipud.m \
+  general/genvarname.m \
+  general/gradient.m \
+  general/idivide.m \
+  general/int2str.m \
+  general/interp1.m \
+  general/interp1q.m \
+  general/interp2.m \
+  general/interp3.m \
+  general/interpn.m \
+  general/interpft.m \
+  general/is_duplicate_entry.m \
+  general/isa.m \
+  general/isdefinite.m \
+  general/isdir.m \
+  general/isequal.m \
+  general/isequalwithequalnans.m \
+  general/isscalar.m \
+  general/issquare.m \
+  general/issymmetric.m \
+  general/isvector.m \
+  general/loadobj.m \
+  general/logical.m \
+  general/logspace.m \
+  general/mod.m \
+  general/nargchk.m \
+  general/nargoutchk.m \
+  general/nextpow2.m \
+  general/nthroot.m \
+  general/num2str.m \
+  general/perror.m \
+  general/pol2cart.m \
+  general/polyarea.m \
+  general/postpad.m \
+  general/prepad.m \
+  general/quadgk.m \
+  general/quadl.m \
+  general/quadv.m \
+  general/rat.m \
+  general/rem.m \
+  general/repmat.m \
+  general/rot90.m \
+  general/rotdim.m \
+  general/runlength.m \
+  general/saveobj.m \
+  general/shift.m \
+  general/shiftdim.m \
+  general/sortrows.m \
+  general/sph2cart.m \
+  general/strerror.m \
+  general/structfun.m \
+  general/subsindex.m \
+  general/triplequad.m \
+  general/trapz.m
+
+FCN_FILES += $(general_FCN_FILES)
+
+PKG_ADD_FILES += general/PKG_ADD
deleted file mode 100644
--- a/scripts/geometry/Makefile.in
+++ /dev/null
@@ -1,100 +0,0 @@
-# Makefile for octave's scripts/geometry directory
-#
-# Copyright (C) 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = geometry
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = \
-  convhull.m \
-  delaunay3.m \
-  delaunayn.m \
-  delaunay.m \
-  dsearch.m \
-  dsearchn.m \
-  griddata.m \
-  griddata3.m \
-  griddatan.m \
-  inpolygon.m \
-  rectint.m \
-  trimesh.m \
-  triplot.m \
-  trisurf.m \
-  tsearchn.m \
-  voronoi.m \
-  voronoin.m
-
-DISTFILES = $(addprefix $(srcdir)/,Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/geometry
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/geometry/module.mk
@@ -0,0 +1,24 @@
+FCN_FILE_DIRS += geometry
+
+geometry_FCN_FILES = \
+  geometry/convhull.m \
+  geometry/delaunay3.m \
+  geometry/delaunayn.m \
+  geometry/delaunay.m \
+  geometry/dsearch.m \
+  geometry/dsearchn.m \
+  geometry/griddata.m \
+  geometry/griddata3.m \
+  geometry/griddatan.m \
+  geometry/inpolygon.m \
+  geometry/rectint.m \
+  geometry/trimesh.m \
+  geometry/triplot.m \
+  geometry/trisurf.m \
+  geometry/tsearchn.m \
+  geometry/voronoi.m \
+  geometry/voronoin.m
+
+FCN_FILES += $(geometry_FCN_FILES)
+
+PKG_ADD_FILES += geometry/PKG_ADD
deleted file mode 100644
--- a/scripts/help/Makefile.in
+++ /dev/null
@@ -1,94 +0,0 @@
-# Makefile for octave's scripts/help directory
-#
-# Copyright (C) 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = help
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = \
-  __additional_help_message__.m \
-  __makeinfo__.m \
-  __strip_html_tags__.m \
-  doc.m \
-  gen_doc_cache.m \
-  get_first_help_sentence.m \
-  help.m \
-  lookfor.m \
-  print_usage.m \
-  type.m \
-  which.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/help
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/help/module.mk
@@ -0,0 +1,18 @@
+FCN_FILE_DIRS += help
+
+help_FCN_FILES = \
+  help/__additional_help_message__.m \
+  help/__makeinfo__.m \
+  help/__strip_html_tags__.m \
+  help/doc.m \
+  help/gen_doc_cache.m \
+  help/get_first_help_sentence.m \
+  help/help.m \
+  help/lookfor.m \
+  help/print_usage.m \
+  help/type.m \
+  help/which.m
+
+FCN_FILES += $(help_FCN_FILES)
+
+PKG_ADD_FILES += help/PKG_ADD
deleted file mode 100644
--- a/scripts/image/Makefile.in
+++ /dev/null
@@ -1,100 +0,0 @@
-# Makefile for octave's scripts/image directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2003, 2005, 2006, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = image
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = __img__.m __img_via_file__.m autumn.m bone.m brighten.m colormap.m \
-  contrast.m cool.m copper.m flag.m gmap40.m gray.m gray2ind.m hot.m hsv.m \
-  hsv2rgb.m image.m image_viewer.m imagesc.m imfinfo.m imread.m imshow.m \
-  imwrite.m ind2gray.m ind2rgb.m jet.m ntsc2rgb.m ocean.m pink.m prism.m \
-  rainbow.m rgb2hsv.m rgb2ind.m rgb2ntsc.m saveimage.m spring.m summer.m \
-  white.m winter.m
-
-IMAGES = default.img
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES) $(IMAGES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(imagedir)
-	for f in $(IMAGES); do \
-	  rm -f $(DESTDIR)$(imagedir)/$$f; \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(imagedir)/$$f; \
-	done
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(archlibdir)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-	for f in $(IMAGES); \
-	  do rm -f $(DESTDIR)$(imagedir)/$$f; \
-	done
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/image
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/image/module.mk
@@ -0,0 +1,49 @@
+FCN_FILE_DIRS += image
+
+image_FCN_FILES = \
+  image/__img__.m \
+  image/__img_via_file__.m \
+  image/autumn.m \
+  image/bone.m \
+  image/brighten.m \
+  image/colormap.m \
+  image/contrast.m \
+  image/cool.m \
+  image/copper.m \
+  image/flag.m \
+  image/gmap40.m \
+  image/gray.m \
+  image/gray2ind.m \
+  image/hot.m \
+  image/hsv.m \
+  image/hsv2rgb.m \
+  image/image.m \
+  image/image_viewer.m \
+  image/imagesc.m \
+  image/imfinfo.m \
+  image/imread.m \
+  image/imshow.m \
+  image/imwrite.m \
+  image/ind2gray.m \
+  image/ind2rgb.m \
+  image/jet.m \
+  image/ntsc2rgb.m \
+  image/ocean.m \
+  image/pink.m \
+  image/prism.m \
+  image/rainbow.m \
+  image/rgb2hsv.m \
+  image/rgb2ind.m \
+  image/rgb2ntsc.m \
+  image/saveimage.m \
+  image/spring.m \
+  image/summer.m \
+  image/white.m \
+  image/winter.m
+
+IMAGES += \
+  image/default.img
+
+FCN_FILES += $(image_FCN_FILES)
+
+PKG_ADD_FILES += image/PKG_ADD
deleted file mode 100644
--- a/scripts/io/Makefile.in
+++ /dev/null
@@ -1,83 +0,0 @@
-# Makefile for octave's scripts/io directory
-#
-# Copyright (C) 1996, 1997, 2002, 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = io
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = beep.m csvread.m csvwrite.m dlmwrite.m strread.m textread.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/io
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/io/module.mk
@@ -0,0 +1,13 @@
+FCN_FILE_DIRS += io
+
+io_FCN_FILES = \
+  io/beep.m \
+  io/csvread.m \
+  io/csvwrite.m \
+  io/dlmwrite.m \
+  io/strread.m \
+  io/textread.m
+
+FCN_FILES += $(io_FCN_FILES)
+
+PKG_ADD_FILES += io/PKG_ADD
deleted file mode 100644
--- a/scripts/linear-algebra/Makefile.in
+++ /dev/null
@@ -1,87 +0,0 @@
-# Makefile for octave's scripts/linear-algebra directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008, 2009
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = linear-algebra
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = commutation_matrix.m cond.m condest.m cross.m \
-  dot.m duplication_matrix.m expm.m housh.m krylov.m krylovb.m logm.m \
-  null.m onenormest.m orth.m planerot.m qzhess.m rank.m rref.m subspace.m \
-  trace.m vec.m vech.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/linear-algebra
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/linear-algebra/module.mk
@@ -0,0 +1,29 @@
+FCN_FILE_DIRS += linear-algebra
+
+linear_algebra_FCN_FILES = \
+  linear-algebra/commutation_matrix.m \
+  linear-algebra/cond.m \
+  linear-algebra/condest.m \
+  linear-algebra/cross.m \
+  linear-algebra/dot.m \
+  linear-algebra/duplication_matrix.m \
+  linear-algebra/expm.m \
+  linear-algebra/housh.m \
+  linear-algebra/krylov.m \
+  linear-algebra/krylovb.m \
+  linear-algebra/logm.m \
+  linear-algebra/null.m \
+  linear-algebra/onenormest.m \
+  linear-algebra/orth.m \
+  linear-algebra/planerot.m \
+  linear-algebra/qzhess.m \
+  linear-algebra/rank.m \
+  linear-algebra/rref.m \
+  linear-algebra/subspace.m \
+  linear-algebra/trace.m \
+  linear-algebra/vec.m \
+  linear-algebra/vech.m
+
+FCN_FILES += $(linear_algebra_FCN_FILES)
+
+PKG_ADD_FILES += linear-algebra/PKG_ADD
deleted file mode 100644
--- a/scripts/miscellaneous/Makefile.in
+++ /dev/null
@@ -1,93 +0,0 @@
-# Makefile for octave's scripts/miscellaneous directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008, 2009
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = miscellaneous
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = __xzip__.m ans.m bincoeff.m bug_report.m bunzip2.m bzip2.m \
-  cast.m comma.m compare_versions.m computer.m copyfile.m debug.m \
-  delete.m dir.m dos.m dump_prefs.m edit.m \
-  fileattrib.m fileparts.m flops.m fullfile.m getfield.m gunzip.m gzip.m \
-  info.m inputname.m intwarning.m ismac.m ispc.m isunix.m license.m \
-  list_primes.m ls.m ls_command.m menu.m mex.m mexext.m mkoctfile.m \
-  movefile.m namelengthmax.m news.m orderfields.m pack.m paren.m \
-  parseparams.m perl.m run.m semicolon.m setfield.m substruct.m swapbytes.m \
-  symvar.m tar.m tempdir.m tempname.m texas_lotto.m unix.m unpack.m untar.m \
-  unzip.m ver.m version.m warning_ids.m what.m xor.m zip.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/miscellaneous
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/miscellaneous/module.mk
@@ -0,0 +1,73 @@
+FCN_FILE_DIRS += miscellaneous
+
+miscellaneous_FCN_FILES = \
+  miscellaneous/__xzip__.m \
+  miscellaneous/ans.m \
+  miscellaneous/bincoeff.m \
+  miscellaneous/bug_report.m \
+  miscellaneous/bunzip2.m \
+  miscellaneous/bzip2.m \
+  miscellaneous/cast.m \
+  miscellaneous/comma.m \
+  miscellaneous/compare_versions.m \
+  miscellaneous/computer.m \
+  miscellaneous/copyfile.m \
+  miscellaneous/debug.m \
+  miscellaneous/delete.m \
+  miscellaneous/dir.m \
+  miscellaneous/dos.m \
+  miscellaneous/dump_prefs.m \
+  miscellaneous/edit.m \
+  miscellaneous/fileattrib.m \
+  miscellaneous/fileparts.m \
+  miscellaneous/flops.m \
+  miscellaneous/fullfile.m \
+  miscellaneous/getfield.m \
+  miscellaneous/gunzip.m \
+  miscellaneous/gzip.m \
+  miscellaneous/info.m \
+  miscellaneous/inputname.m \
+  miscellaneous/intwarning.m \
+  miscellaneous/ismac.m \
+  miscellaneous/ispc.m \
+  miscellaneous/isunix.m \
+  miscellaneous/license.m \
+  miscellaneous/list_primes.m \
+  miscellaneous/ls.m \
+  miscellaneous/ls_command.m \
+  miscellaneous/menu.m \
+  miscellaneous/mex.m \
+  miscellaneous/mexext.m \
+  miscellaneous/mkoctfile.m \
+  miscellaneous/movefile.m \
+  miscellaneous/namelengthmax.m \
+  miscellaneous/news.m \
+  miscellaneous/orderfields.m \
+  miscellaneous/pack.m \
+  miscellaneous/paren.m \
+  miscellaneous/parseparams.m \
+  miscellaneous/perl.m \
+  miscellaneous/run.m \
+  miscellaneous/semicolon.m \
+  miscellaneous/setfield.m \
+  miscellaneous/substruct.m \
+  miscellaneous/swapbytes.m \
+  miscellaneous/symvar.m \
+  miscellaneous/tar.m \
+  miscellaneous/tempdir.m \
+  miscellaneous/tempname.m \
+  miscellaneous/texas_lotto.m \
+  miscellaneous/unix.m \
+  miscellaneous/unpack.m \
+  miscellaneous/untar.m \
+  miscellaneous/unzip.m \
+  miscellaneous/ver.m \
+  miscellaneous/version.m \
+  miscellaneous/warning_ids.m \
+  miscellaneous/what.m \
+  miscellaneous/xor.m \
+  miscellaneous/zip.m
+
+FCN_FILES += $(miscellaneous_FCN_FILES)
+
+PKG_ADD_FILES += miscellaneous/PKG_ADD
rename from scripts/mkpkgadd
rename to scripts/mk-pkg-add
--- a/scripts/mkpkgadd
+++ b/scripts/mk-pkg-add
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# Copyright (C) 2002, 2003, 2007 John W. Eaton
+# Copyright (C) 2002, 2003, 2007, 2009 John W. Eaton
 #
 # This file is part of Octave.
 # 
@@ -18,23 +18,20 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-if [ $# -eq 1 ]; then
-  dir="$1"
-else
-  echo "usage: mkpkgadd directory" 1>&2
-  exit 1
-fi
+## Expecting arguments in this order:
+##
+##  SRCDIR SRCDIR-FILES ... -- LOCAL-FILES ...
 
-cd $dir
+set -e
+
+prefix="$1/"
+shift
 
-m_files=`ls *.m`
-cxx_files=`ls *.cc`
-
-if [ -n "$m_files" ]; then
-  sed -n 's/^[#%][#%]* *PKG_ADD: *//p' $m_files
-fi
-
-if [ -n "$cxx_files" ]; then
-  sed -n -e 's,^//* *PKG_ADD: *,,p' \
-         -e 's,^/\** *PKG_ADD: *\(.*\) \*/$,\1,p' $cxx_files
-fi
+for arg
+do
+  if [ "$arg" = "--" ]; then
+    prefix=""
+  else
+    sed -n 's/^[#%][#%]* *PKG_ADD: *//p' "$prefix$arg"
+  fi
+done
--- a/scripts/mkdoc
+++ b/scripts/mkdoc
@@ -18,14 +18,16 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
+## Expecting arguments in this order:
+##
+##  SRCDIR SRCDIR-FILES ... -- LOCAL-FILES ...
+
 set -e
 
 PERL=${PERL:-'perl'}
 
-if test $# -eq 0; then
-  echo "usage: mkdoc file ..." 1>&2
-  exit 1
-fi
+prefix="$1/"
+shift
 
 if test -f gethelp; then
   cat << EOF
@@ -37,17 +39,21 @@
 EOF
   for arg
   do
-    echo "$arg" | $PERL -n -e 'chop;
-               $f = "$_";
-               m{(.*)/(.*)\.m};
-               for (qx{./gethelp $2 "$f" < "$f"}) {
-                 s/^\s+\@/\@/ unless $i_am_in_example;
-                 s/^\s+\@group/\@group/;
-                 s/^\s+\@end\s+group/\@end\s+group/;
-                 $i_am_in_example = 1 if /\s*\@example/;
-                 $i_am_in_example = 0 if /\s*\@end\s+example/;
-                 print;
-               }'
+    if [ "$arg" = "--" ]; then
+      prefix=""
+    else
+      echo "$prefix$arg" | $PERL -n -e 'chop;
+	$f = "$_";
+        next unless m{(.*)/(.*)\.m};
+	for (qx{./gethelp $2 "$f" < "$f"}) {
+	  s/^\s+\@/\@/ unless $i_am_in_example;
+	  s/^\s+\@group/\@group/;
+	  s/^\s+\@end\s+group/\@end\s+group/;
+	  $i_am_in_example = 1 if /\s*\@example/;
+	  $i_am_in_example = 0 if /\s*\@end\s+example/;
+	  print;
+	}'
+    fi
   done
 else
   echo "gethelp program seems to be missing!" 1>&2
deleted file mode 100755
--- a/scripts/move-if-change
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# Like mv $1 $2, but if the files are the same, just delete $1.
-# Status is 0 if $2 is changed, 1 otherwise.
-
-if test -r $2; then
-  if cmp $1 $2 > /dev/null; then
-    echo $2 is unchanged
-    rm -f $1
-  else
-    mv -f $1 $2
-  fi
-else
-  mv -f $1 $2
-fi
deleted file mode 100644
--- a/scripts/optimization/Makefile.in
+++ /dev/null
@@ -1,100 +0,0 @@
-# Makefile for octave's scripts/optimization directory
-#
-# Copyright (C) 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = optimization
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = \
-  fzero.m \
-  __fdjac__.m \
-  __dogleg__.m \
-  __doglegm__.m \
-  fsolve.m \
-  fminunc.m \
-  glpk.m \
-  glpkmex.m \
-  lsqnonneg.m \
-  pqpnonneg.m \
-  optimset.m \
-  optimget.m \
-  __all_opts__.m \
-  qp.m \
-  sqp.m
-
-EXTRAS = glpktest1 glpktest2
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/optimization
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/optimization/module.mk
@@ -0,0 +1,22 @@
+FCN_FILE_DIRS += optimization
+
+optimization_FCN_FILES = \
+  optimization/fzero.m \
+  optimization/__fdjac__.m \
+  optimization/__dogleg__.m \
+  optimization/__doglegm__.m \
+  optimization/fsolve.m \
+  optimization/fminunc.m \
+  optimization/glpk.m \
+  optimization/glpkmex.m \
+  optimization/lsqnonneg.m \
+  optimization/pqpnonneg.m \
+  optimization/optimset.m \
+  optimization/optimget.m \
+  optimization/__all_opts__.m \
+  optimization/qp.m \
+  optimization/sqp.m
+
+FCN_FILES += $(optimization_FCN_FILES)
+
+PKG_ADD_FILES += optimization/PKG_ADD
deleted file mode 100644
--- a/scripts/path/Makefile.in
+++ /dev/null
@@ -1,83 +0,0 @@
-# Makefile for octave's scripts/path directory
-#
-# Copyright (C) 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = path
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = __extractpath__.m matlabroot.m pathdef.m savepath.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/path
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/path/module.mk
@@ -0,0 +1,11 @@
+FCN_FILE_DIRS += path
+
+path_FCN_FILES = \
+  path/__extractpath__.m \
+  path/matlabroot.m \
+  path/pathdef.m \
+  path/savepath.m
+
+FCN_FILES += $(path_FCN_FILES)
+
+PKG_ADD_FILES += path/PKG_ADD
deleted file mode 100644
--- a/scripts/pkg/Makefile.in
+++ /dev/null
@@ -1,83 +0,0 @@
-# Makefile for octave's scripts/pkg directory
-#
-# Copyright (C) 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = pkg
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = pkg.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/pkg
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/pkg/module.mk
@@ -0,0 +1,8 @@
+FCN_FILE_DIRS += pkg
+
+pkg_FCN_FILES = \
+  pkg/pkg.m
+
+FCN_FILES += $(pkg_FCN_FILES)
+
+PKG_ADD_FILES += pkg/PKG_ADD
deleted file mode 100644
--- a/scripts/plot/Makefile.in
+++ /dev/null
@@ -1,257 +0,0 @@
-# Makefile for octave's scripts/plot directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008, 2009
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = plot
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = \
-  __actual_axis_position__.m \
-  __add_datasource__.m \
-  __area__.m \
-  __axes_limits__.m \
-  __axis_label__.m \
-  __bar__.m \
-  __bars__.m \
-  __clabel__.m \
-  __contour__.m \
-  __default_plot_options__.m \
-  __errcomm__.m \
-  __errplot__.m \
-  __ezplot__.m \
-  __gnuplot_get_var__.m \
-  __gnuplot_has_feature__.m \
-  __gnuplot_open_stream__.m \
-  __go_close_all__.m \
-  __go_draw_axes__.m \
-  __go_draw_figure__.m \
-  __gnuplot_ginput__.m \
-  __gnuplot_version__.m \
-  __interp_cube__.m \
-  __line__.m \
-  __marching_cube__.m \
-  __next_line_color__.m \
-  __patch__.m \
-  __plr1__.m \
-  __plr2__.m \
-  __plt1__.m \
-  __plt2__.m \
-  __plt2mm__.m \
-  __plt2mv__.m \
-  __plt2ss__.m \
-  __plt2sv__.m \
-  __plt2vm__.m \
-  __plt2vs__.m \
-  __plt2vv__.m \
-  __plt__.m \
-  __plt_get_axis_arg__.m \
-  __pltopt1__.m \
-  __pltopt__.m \
-  __quiver__.m \
-  __scatter__.m \
-  __stem__.m \
-  allchild.m \
-  ancestor.m \
-  area.m \
-  axes.m \
-  axis.m \
-  backend.m \
-  bar.m \
-  barh.m \
-  box.m \
-  caxis.m \
-  cla.m \
-  clabel.m \
-  clf.m \
-  close.m \
-  closereq.m \
-  colorbar.m \
-  comet.m \
-  compass.m \
-  contour3.m \
-  contour.m \
-  contourc.m \
-  contourf.m \
-  cylinder.m \
-  diffuse.m \
-  gnuplot_drawnow.m \
-  ellipsoid.m \
-  errorbar.m \
-  ezcontourf.m \
-  ezcontour.m \
-  ezmeshc.m \
-  ezmesh.m \
-  ezplot.m \
-  ezplot3.m \
-  ezpolar.m \
-  ezsurfc.m \
-  ezsurf.m \
-  feather.m \
-  figure.m \
-  fill.m \
-  findall.m \
-  findobj.m \
-  fplot.m \
-  gca.m \
-  gcbf.m \
-  gcbo.m \
-  gcf.m \
-  ginput.m \
-  grid.m \
-  gtext.m \
-  hggroup.m \
-  hidden.m \
-  hist.m \
-  hold.m \
-  isfigure.m \
-  ishghandle.m \
-  ishold.m \
-  isocolors.m \
-  isonormals.m \
-  isosurface.m \
-  legend.m \
-  line.m \
-  linkprop.m \
-  loglog.m \
-  loglogerr.m \
-  mesh.m \
-  meshc.m \
-  meshgrid.m \
-  meshz.m \
-  ndgrid.m \
-  newplot.m \
-  orient.m \
-  pareto.m \
-  patch.m \
-  pcolor.m \
-  peaks.m \
-  pie.m \
-  plot.m \
-  plotmatrix.m \
-  plotyy.m \
-  plot3.m \
-  plotyy.m \
-  polar.m \
-  print.m \
-  quiver.m \
-  quiver3.m \
-  refresh.m \
-  refreshdata.m \
-  replot.m \
-  ribbon.m \
-  rose.m \
-  scatter.m \
-  scatter3.m \
-  semilogx.m \
-  semilogxerr.m \
-  semilogy.m \
-  semilogyerr.m \
-  shading.m \
-  shg.m \
-  slice.m \
-  sombrero.m \
-  specular.m \
-  sphere.m \
-  spinmap.m \
-  stairs.m \
-  stem.m \
-  stem3.m \
-  subplot.m \
-  surf.m \
-  surface.m \
-  surfc.m \
-  surfl.m \
-  surfnorm.m \
-  text.m \
-  title.m \
-  view.m \
-  waitforbuttonpress.m \
-  xlabel.m \
-  xlim.m \
-  ylabel.m \
-  ylim.m \
-  zlabel.m \
-  zlim.m
-
-SOURCES_IN = gnuplot_binary.in
-
-GEN_M = $(SOURCES_IN:.in=.m)
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES) $(SOURCES_IN))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES)) $(GEN_M)
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: $(GEN_M) PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD $(GEN_M)
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/plot
-.PHONY: dist
-
-$(GEN_M): %.m : %.in $(TOPDIR)/Makeconf
-	@$(do-subst-config-vals)
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/plot/module.mk
@@ -0,0 +1,177 @@
+FCN_FILE_DIRS += plot
+
+plot_GEN_FCN_FILES = \
+  plot/gnuplot_binary.m
+
+GEN_FCN_FILES += $(plot_GEN_FCN_FILES)
+
+plot_FCN_FILES = \
+  plot/__actual_axis_position__.m \
+  plot/__add_datasource__.m \
+  plot/__area__.m \
+  plot/__axes_limits__.m \
+  plot/__axis_label__.m \
+  plot/__bar__.m \
+  plot/__bars__.m \
+  plot/__clabel__.m \
+  plot/__contour__.m \
+  plot/__default_plot_options__.m \
+  plot/__errcomm__.m \
+  plot/__errplot__.m \
+  plot/__ezplot__.m \
+  plot/__gnuplot_get_var__.m \
+  plot/__gnuplot_ginput__.m \
+  plot/__gnuplot_has_feature__.m \
+  plot/__gnuplot_open_stream__.m \
+  plot/__gnuplot_version__.m \
+  plot/__go_close_all__.m \
+  plot/__go_draw_axes__.m \
+  plot/__go_draw_figure__.m \
+  plot/__interp_cube__.m \
+  plot/__line__.m \
+  plot/__marching_cube__.m \
+  plot/__next_line_color__.m \
+  plot/__patch__.m \
+  plot/__plr1__.m \
+  plot/__plr2__.m \
+  plot/__plt1__.m \
+  plot/__plt2__.m \
+  plot/__plt2mm__.m \
+  plot/__plt2mv__.m \
+  plot/__plt2ss__.m \
+  plot/__plt2sv__.m \
+  plot/__plt2vm__.m \
+  plot/__plt2vs__.m \
+  plot/__plt2vv__.m \
+  plot/__plt__.m \
+  plot/__plt_get_axis_arg__.m \
+  plot/__pltopt1__.m \
+  plot/__pltopt__.m \
+  plot/__quiver__.m \
+  plot/__scatter__.m \
+  plot/__stem__.m \
+  plot/allchild.m \
+  plot/ancestor.m \
+  plot/area.m \
+  plot/axes.m \
+  plot/axis.m \
+  plot/backend.m \
+  plot/bar.m \
+  plot/barh.m \
+  plot/box.m \
+  plot/caxis.m \
+  plot/cla.m \
+  plot/clabel.m \
+  plot/clf.m \
+  plot/close.m \
+  plot/closereq.m \
+  plot/colorbar.m \
+  plot/comet.m \
+  plot/compass.m \
+  plot/contour.m \
+  plot/contour3.m \
+  plot/contourc.m \
+  plot/contourf.m \
+  plot/cylinder.m \
+  plot/diffuse.m \
+  plot/ellipsoid.m \
+  plot/errorbar.m \
+  plot/ezcontour.m \
+  plot/ezcontourf.m \
+  plot/ezmesh.m \
+  plot/ezmeshc.m \
+  plot/ezplot.m \
+  plot/ezplot3.m \
+  plot/ezpolar.m \
+  plot/ezsurf.m \
+  plot/ezsurfc.m \
+  plot/feather.m \
+  plot/figure.m \
+  plot/fill.m \
+  plot/findall.m \
+  plot/findobj.m \
+  plot/fplot.m \
+  plot/gca.m \
+  plot/gcbf.m \
+  plot/gcbo.m \
+  plot/gcf.m \
+  plot/ginput.m \
+  plot/gnuplot_drawnow.m \
+  plot/grid.m \
+  plot/gtext.m \
+  plot/hggroup.m \
+  plot/hidden.m \
+  plot/hist.m \
+  plot/hold.m \
+  plot/isfigure.m \
+  plot/ishghandle.m \
+  plot/ishold.m \
+  plot/isocolors.m \
+  plot/isonormals.m \
+  plot/isosurface.m \
+  plot/legend.m \
+  plot/line.m \
+  plot/linkprop.m \
+  plot/loglog.m \
+  plot/loglogerr.m \
+  plot/mesh.m \
+  plot/meshc.m \
+  plot/meshgrid.m \
+  plot/meshz.m \
+  plot/ndgrid.m \
+  plot/newplot.m \
+  plot/orient.m \
+  plot/pareto.m \
+  plot/patch.m \
+  plot/pcolor.m \
+  plot/peaks.m \
+  plot/pie.m \
+  plot/plot.m \
+  plot/plot3.m \
+  plot/plotmatrix.m \
+  plot/plotyy.m \
+  plot/polar.m \
+  plot/print.m \
+  plot/quiver.m \
+  plot/quiver3.m \
+  plot/refresh.m \
+  plot/refreshdata.m \
+  plot/replot.m \
+  plot/ribbon.m \
+  plot/rose.m \
+  plot/scatter.m \
+  plot/scatter3.m \
+  plot/semilogx.m \
+  plot/semilogxerr.m \
+  plot/semilogy.m \
+  plot/semilogyerr.m \
+  plot/shading.m \
+  plot/shg.m \
+  plot/slice.m \
+  plot/sombrero.m \
+  plot/specular.m \
+  plot/sphere.m \
+  plot/spinmap.m \
+  plot/stairs.m \
+  plot/stem.m \
+  plot/stem3.m \
+  plot/subplot.m \
+  plot/surf.m \
+  plot/surface.m \
+  plot/surfc.m \
+  plot/surfl.m \
+  plot/surfnorm.m \
+  plot/text.m \
+  plot/title.m \
+  plot/view.m \
+  plot/waitforbuttonpress.m \
+  plot/xlabel.m \
+  plot/xlim.m \
+  plot/ylabel.m \
+  plot/ylim.m \
+  plot/zlabel.m \
+  plot/zlim.m
+
+FCN_FILES += $(plot_FCN_FILES)
+
+PKG_ADD_FILES += plot/PKG_ADD
deleted file mode 100644
--- a/scripts/polynomial/Makefile.in
+++ /dev/null
@@ -1,87 +0,0 @@
-# Makefile for octave's scripts/polynomial directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008, 2009
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = polynomial
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = compan.m conv.m convn.m deconv.m mkpp.m mpoles.m \
-  pchip.m poly.m polyaffine.m polyder.m polyderiv.m polyfit.m \
-  polygcd.m polyint.m polyout.m polyreduce.m polyval.m \
-  polyvalm.m ppval.m residue.m roots.m spline.m unmkpp.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/polynomial
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/polynomial/module.mk
@@ -0,0 +1,30 @@
+FCN_FILE_DIRS += polynomial
+
+polynomial_FCN_FILES = \
+  polynomial/compan.m \
+  polynomial/conv.m \
+  polynomial/convn.m \
+  polynomial/deconv.m \
+  polynomial/mkpp.m \
+  polynomial/mpoles.m \
+  polynomial/pchip.m \
+  polynomial/poly.m \
+  polynomial/polyaffine.m \
+  polynomial/polyder.m \
+  polynomial/polyderiv.m \
+  polynomial/polyfit.m \
+  polynomial/polygcd.m \
+  polynomial/polyint.m \
+  polynomial/polyout.m \
+  polynomial/polyreduce.m \
+  polynomial/polyval.m \
+  polynomial/polyvalm.m \
+  polynomial/ppval.m \
+  polynomial/residue.m \
+  polynomial/roots.m \
+  polynomial/spline.m \
+  polynomial/unmkpp.m
+
+FCN_FILES += $(polynomial_FCN_FILES)
+
+PKG_ADD_FILES += polynomial/PKG_ADD
deleted file mode 100644
--- a/scripts/set/Makefile.in
+++ /dev/null
@@ -1,85 +0,0 @@
-# Makefile for octave's scripts/set directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008, 2009
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = set
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = complement.m intersect.m ismember.m \
-  setdiff.m setxor.m union.m unique.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/set
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/set/module.mk
@@ -0,0 +1,14 @@
+FCN_FILE_DIRS += set
+
+set_FCN_FILES = \
+  set/complement.m \
+  set/intersect.m \
+  set/ismember.m \
+  set/setdiff.m \
+  set/setxor.m \
+  set/union.m \
+  set/unique.m
+
+FCN_FILES += $(set_FCN_FILES)
+
+PKG_ADD_FILES += set/PKG_ADD
deleted file mode 100644
--- a/scripts/signal/Makefile.in
+++ /dev/null
@@ -1,91 +0,0 @@
-# Makefile for octave's scripts/signal directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = signal
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = arch_fit.m arch_rnd.m arch_test.m arma_rnd.m autocor.m \
-  autocov.m autoreg_matrix.m bartlett.m blackman.m detrend.m \
-  diffpara.m durbinlevinson.m fftconv.m fftfilt.m fftshift.m \
-  filter2.m fractdiff.m freqz.m freqz_plot.m hamming.m hanning.m \
-  hurst.m ifftshift.m periodogram.m rectangle_lw.m rectangle_sw.m \
-  sinc.m sinetone.m sinewave.m spectral_adf.m spectral_xdf.m \
-  spencer.m stft.m synthesis.m triangle_lw.m triangle_sw.m \
-  unwrap.m yulewalker.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/signal
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/signal/module.mk
@@ -0,0 +1,45 @@
+FCN_FILE_DIRS += signal
+
+signal_FCN_FILES = \
+  signal/arch_fit.m \
+  signal/arch_rnd.m \
+  signal/arch_test.m \
+  signal/arma_rnd.m \
+  signal/autocor.m \
+  signal/autocov.m \
+  signal/autoreg_matrix.m \
+  signal/bartlett.m \
+  signal/blackman.m \
+  signal/detrend.m \
+  signal/diffpara.m \
+  signal/durbinlevinson.m \
+  signal/fftconv.m \
+  signal/fftfilt.m \
+  signal/fftshift.m \
+  signal/filter2.m \
+  signal/fractdiff.m \
+  signal/freqz.m \
+  signal/freqz_plot.m \
+  signal/hamming.m \
+  signal/hanning.m \
+  signal/hurst.m \
+  signal/ifftshift.m \
+  signal/periodogram.m \
+  signal/rectangle_lw.m \
+  signal/rectangle_sw.m \
+  signal/sinc.m \
+  signal/sinetone.m \
+  signal/sinewave.m \
+  signal/spectral_adf.m \
+  signal/spectral_xdf.m \
+  signal/spencer.m \
+  signal/stft.m \
+  signal/synthesis.m \
+  signal/triangle_lw.m \
+  signal/triangle_sw.m \
+  signal/unwrap.m \
+  signal/yulewalker.m
+
+FCN_FILES += $(signal_FCN_FILES)
+
+PKG_ADD_FILES += signal/PKG_ADD
deleted file mode 100644
deleted file mode 100644
--- a/scripts/sparse/Makefile.in
+++ /dev/null
@@ -1,86 +0,0 @@
-# Makefile for octave's scripts/sparse directory
-#
-# Copyright (C) 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = sparse
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = bicgstab.m cgs.m colperm.m etreeplot.m gplot.m nonzeros.m normest.m \
-  pcg.m pcr.m spalloc.m spaugment.m spconvert.m spdiags.m speye.m \
-  spfun.m sphcat.m spones.m sprand.m sprandn.m sprandsym.m spstats.m \
-  spvcat.m spy.m svds.m treelayout.m treeplot.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/sparse
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/sparse/module.mk
@@ -0,0 +1,33 @@
+FCN_FILE_DIRS += sparse
+
+sparse_FCN_FILES = \
+  sparse/bicgstab.m \
+  sparse/cgs.m \
+  sparse/colperm.m \
+  sparse/etreeplot.m \
+  sparse/gplot.m \
+  sparse/nonzeros.m \
+  sparse/normest.m \
+  sparse/pcg.m \
+  sparse/pcr.m \
+  sparse/spalloc.m \
+  sparse/spaugment.m \
+  sparse/spconvert.m \
+  sparse/spdiags.m \
+  sparse/speye.m \
+  sparse/spfun.m \
+  sparse/sphcat.m \
+  sparse/spones.m \
+  sparse/sprand.m \
+  sparse/sprandn.m \
+  sparse/sprandsym.m \
+  sparse/spstats.m \
+  sparse/spvcat.m \
+  sparse/spy.m \
+  sparse/svds.m \
+  sparse/treelayout.m \
+  sparse/treeplot.m
+
+FCN_FILES += $(sparse_FCN_FILES)
+
+PKG_ADD_FILES += sparse/PKG_ADD
deleted file mode 100644
--- a/scripts/specfun/Makefile.in
+++ /dev/null
@@ -1,86 +0,0 @@
-# Makefile for octave's scripts/specfun directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = specfun
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = bessel.m beta.m betai.m betaln.m erfinv.m factor.m \
-  factorial.m gammai.m isprime.m legendre.m nchoosek.m \
-  perms.m pow2.m primes.m reallog.m realpow.m realsqrt.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/specfun
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/specfun/module.mk
@@ -0,0 +1,24 @@
+FCN_FILE_DIRS += specfun
+
+specfun_FCN_FILES = \
+  specfun/bessel.m \
+  specfun/beta.m \
+  specfun/betai.m \
+  specfun/betaln.m \
+  specfun/erfinv.m \
+  specfun/factor.m \
+  specfun/factorial.m \
+  specfun/gammai.m \
+  specfun/isprime.m \
+  specfun/legendre.m \
+  specfun/nchoosek.m \
+  specfun/perms.m \
+  specfun/pow2.m \
+  specfun/primes.m \
+  specfun/reallog.m \
+  specfun/realpow.m \
+  specfun/realsqrt.m
+
+FCN_FILES += $(specfun_FCN_FILES)
+
+PKG_ADD_FILES += specfun/PKG_ADD
deleted file mode 100644
--- a/scripts/special-matrix/Makefile.in
+++ /dev/null
@@ -1,85 +0,0 @@
-# Makefile for octave's scripts/special-matrix directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = special-matrix
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = hadamard.m hankel.m hilb.m invhilb.m magic.m pascal.m \
-  rosser.m sylvester_matrix.m toeplitz.m vander.m wilkinson.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/special-matrix
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/special-matrix/module.mk
@@ -0,0 +1,18 @@
+FCN_FILE_DIRS += special-matrix
+
+special_matrix_FCN_FILES = \
+  special-matrix/hadamard.m \
+  special-matrix/hankel.m \
+  special-matrix/hilb.m \
+  special-matrix/invhilb.m \
+  special-matrix/magic.m \
+  special-matrix/pascal.m \
+  special-matrix/rosser.m \
+  special-matrix/sylvester_matrix.m \
+  special-matrix/toeplitz.m \
+  special-matrix/vander.m \
+  special-matrix/wilkinson.m
+
+FCN_FILES += $(special_matrix_FCN_FILES)
+
+PKG_ADD_FILES += special-matrix/PKG_ADD
deleted file mode 100644
--- a/scripts/startup/Makefile.in
+++ /dev/null
@@ -1,107 +0,0 @@
-# Makefile for octave's scripts/startup directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2003, 2005, 2006, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = startup
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = __finish__.m main-rcfile local-rcfile inputrc
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)
-	if test -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/octaverc; then true; \
-	else \
-	  $(INSTALL_DATA) $(srcdir)/main-rcfile \
-	    $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/octaverc; \
-	fi
-	if test -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/inputrc; then true; \
-	else \
-	  $(INSTALL_DATA) $(srcdir)/inputrc \
-	    $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/inputrc; \
-	fi
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(localfcnfiledir)/$(script_sub_dir)
-	if test -f $(DESTDIR)$(localfcnfiledir)/$(script_sub_dir)/octaverc; \
-	then true; \
-	else \
-	  $(INSTALL_DATA) $(srcdir)/local-rcfile \
-	    $(DESTDIR)$(localfcnfiledir)/$(script_sub_dir)/octaverc; \
-	fi
-	for f in $(FCN_FILES_NO_DIR); do \
-	  rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$f; \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$f; \
-	done
-.PHONY: install install-strip
-
-uninstall:
-	for f in $(FCN_FILES_NO_DIR); \
-	  do rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$f; \
-	done
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/startup
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/startup/module.mk
@@ -0,0 +1,25 @@
+FCN_FILE_DIRS += startup
+
+startup_FCN_FILES = \
+  startup/__finish__.m
+
+SYSTEM_STARTUP_FILE_SRC = startup/main-rcfile
+
+SYSTEM_INPUTRC_FILE_SRC = startup/inputrc
+
+LOCAL_STARTUP_FILE_SRC = startup/local-rcfile
+
+STARTUP_FILE_SRC = \
+  $(SYSTEM_STARTUP_FILE_SRC) \
+  $(SYSTEM_INPUTRC_FILE_SRC) \
+  $(LOCAL_STARTUP_FILE_SRC)
+
+FCN_FILES += \
+  $(startup_FCN_FILES) \
+  $(SYSTEM_STARTUP_FILE_SRC) \
+  $(LOCAL_STARTUP_FILE_SRC)
+
+EXTRA_DIST += \
+  $(SYSTEM_INPUTRC_FILE_SRC)
+
+PKG_ADD_FILES += startup/PKG_ADD
deleted file mode 100644
--- a/scripts/statistics/Makefile.in
+++ /dev/null
@@ -1,71 +0,0 @@
-# Makefile for octave's scripts/statistics directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2005, 2007, 2008
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = statistics
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-DISTFILES = $(srcdir)/Makefile.in
-
-SUBDIRS = base distributions models tests
-
-DISTSUBDIRS = $(SUBDIRS)
-
-all: $(SUBDIRS)
-.PHONY: all
-
-$(SUBDIRS):
-	$(MAKE) -C $@ all
-.PHONY: $(SUBDIRS)
-
-install install-strip uninstall clean mostlyclean distclean maintainer-clean::
-	@$(subdir-for-command)
-.PHONY: install install-strip uninstall
-.PHONY: clean mostlyclean distclean maintainer-clean
-
-tags TAGS:
-	$(subdir-for-command)
-
-distclean::
-	rm -f Makefile
-
-maintainer-clean::
-	rm -f tags TAGS Makefile
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/statistics
-	for dir in $(DISTSUBDIRS); do mkdir ../../`cat ../../.fname`/scripts/statistics/$$dir; $(MAKE) -C $$dir $@; done
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-	@$(subdir-for-command)
-.PHONY: check-m-sources
deleted file mode 100644
--- a/scripts/statistics/base/Makefile.in
+++ /dev/null
@@ -1,87 +0,0 @@
-# Makefile for octave's scripts/statistics/base directory
-#
-# Copyright (C) 1998, 2002, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../../..
-
-script_sub_dir = statistics/base
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = __quantile__.m center.m cloglog.m cor.m corrcoef.m cov.m \
-  cut.m gls.m histc.m iqr.m kendall.m kurtosis.m logit.m mahalanobis.m \
-  mean.m meansq.m median.m mode.m moment.m ols.m ppplot.m prctile.m probit.m \
-  qqplot.m quantile.m range.m ranks.m run_count.m skewness.m spearman.m \
-  statistics.m std.m studentize.m table.m values.m var.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../../`cat ../../../.fname`/scripts/$(script_sub_dir)
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/statistics/base/module.mk
@@ -0,0 +1,43 @@
+FCN_FILE_DIRS += statistics/base
+
+statistics_base_FCN_FILES = \
+  statistics/base/__quantile__.m \
+  statistics/base/center.m \
+  statistics/base/cloglog.m \
+  statistics/base/cor.m \
+  statistics/base/corrcoef.m \
+  statistics/base/cov.m \
+  statistics/base/cut.m \
+  statistics/base/gls.m \
+  statistics/base/histc.m \
+  statistics/base/iqr.m \
+  statistics/base/kendall.m \
+  statistics/base/kurtosis.m \
+  statistics/base/logit.m \
+  statistics/base/mahalanobis.m \
+  statistics/base/mean.m \
+  statistics/base/meansq.m \
+  statistics/base/median.m \
+  statistics/base/mode.m \
+  statistics/base/moment.m \
+  statistics/base/ols.m \
+  statistics/base/ppplot.m \
+  statistics/base/prctile.m \
+  statistics/base/probit.m \
+  statistics/base/qqplot.m \
+  statistics/base/quantile.m \
+  statistics/base/range.m \
+  statistics/base/ranks.m \
+  statistics/base/run_count.m \
+  statistics/base/skewness.m \
+  statistics/base/spearman.m \
+  statistics/base/statistics.m \
+  statistics/base/std.m \
+  statistics/base/studentize.m \
+  statistics/base/table.m \
+  statistics/base/values.m \
+  statistics/base/var.m
+
+FCN_FILES += $(statistics_base_FCN_FILES)
+
+PKG_ADD_FILES += statistics/base/PKG_ADD
deleted file mode 100644
--- a/scripts/statistics/distributions/Makefile.in
+++ /dev/null
@@ -1,100 +0,0 @@
-# Makefile for octave's scripts/statistics/distributions directory
-#
-# Copyright (C) 1998, 2002, 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../../..
-
-script_sub_dir = statistics/distributions
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = betacdf.m betainv.m betapdf.m betarnd.m binocdf.m \
-  binoinv.m binopdf.m binornd.m cauchy_cdf.m cauchy_inv.m \
-  cauchy_pdf.m cauchy_rnd.m chi2cdf.m chi2inv.m chi2pdf.m \
-  chi2rnd.m discrete_cdf.m discrete_inv.m discrete_pdf.m \
-  discrete_rnd.m empirical_cdf.m empirical_inv.m empirical_pdf.m \
-  empirical_rnd.m expcdf.m expinv.m exppdf.m exprnd.m fcdf.m \
-  finv.m fpdf.m frnd.m gamcdf.m gaminv.m gampdf.m gamrnd.m \
-  geocdf.m geoinv.m geopdf.m geornd.m hygecdf.m hygeinv.m \
-  hygepdf.m hygernd.m kolmogorov_smirnov_cdf.m laplace_cdf.m \
-  laplace_inv.m laplace_pdf.m laplace_rnd.m logistic_cdf.m \
-  logistic_inv.m logistic_pdf.m logistic_rnd.m logncdf.m \
-  logninv.m lognpdf.m lognrnd.m nbincdf.m nbininv.m nbinpdf.m \
-  nbinrnd.m normcdf.m norminv.m normpdf.m normrnd.m \
-  poisscdf.m poissinv.m poisspdf.m poissrnd.m stdnormal_cdf.m \
-  stdnormal_inv.m stdnormal_pdf.m stdnormal_rnd.m tcdf.m tinv.m \
-  tpdf.m trnd.m unidrnd.m unidcdf.m unidinv.m unidpdf.m unifrnd.m \
-  unifcdf.m unifinv.m unifpdf.m wblcdf.m wblinv.m wblpdf.m wblrnd.m \
-  wienrnd.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../../`cat ../../../.fname`/scripts/$(script_sub_dir)
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/statistics/distributions/module.mk
@@ -0,0 +1,97 @@
+FCN_FILE_DIRS += statistics/distributions
+
+statistics_distributions_FCN_FILES = \
+  statistics/distributions/betacdf.m \
+  statistics/distributions/betainv.m \
+  statistics/distributions/betapdf.m \
+  statistics/distributions/betarnd.m \
+  statistics/distributions/binocdf.m \
+  statistics/distributions/binoinv.m \
+  statistics/distributions/binopdf.m \
+  statistics/distributions/binornd.m \
+  statistics/distributions/cauchy_cdf.m \
+  statistics/distributions/cauchy_inv.m \
+  statistics/distributions/cauchy_pdf.m \
+  statistics/distributions/cauchy_rnd.m \
+  statistics/distributions/chi2cdf.m \
+  statistics/distributions/chi2inv.m \
+  statistics/distributions/chi2pdf.m \
+  statistics/distributions/chi2rnd.m \
+  statistics/distributions/discrete_cdf.m \
+  statistics/distributions/discrete_inv.m \
+  statistics/distributions/discrete_pdf.m \
+  statistics/distributions/discrete_rnd.m \
+  statistics/distributions/empirical_cdf.m \
+  statistics/distributions/empirical_inv.m \
+  statistics/distributions/empirical_pdf.m \
+  statistics/distributions/empirical_rnd.m \
+  statistics/distributions/expcdf.m \
+  statistics/distributions/expinv.m \
+  statistics/distributions/exppdf.m \
+  statistics/distributions/exprnd.m \
+  statistics/distributions/fcdf.m \
+  statistics/distributions/finv.m \
+  statistics/distributions/fpdf.m \
+  statistics/distributions/frnd.m \
+  statistics/distributions/gamcdf.m \
+  statistics/distributions/gaminv.m \
+  statistics/distributions/gampdf.m \
+  statistics/distributions/gamrnd.m \
+  statistics/distributions/geocdf.m \
+  statistics/distributions/geoinv.m \
+  statistics/distributions/geopdf.m \
+  statistics/distributions/geornd.m \
+  statistics/distributions/hygecdf.m \
+  statistics/distributions/hygeinv.m \
+  statistics/distributions/hygepdf.m \
+  statistics/distributions/hygernd.m \
+  statistics/distributions/kolmogorov_smirnov_cdf.m \
+  statistics/distributions/laplace_cdf.m \
+  statistics/distributions/laplace_inv.m \
+  statistics/distributions/laplace_pdf.m \
+  statistics/distributions/laplace_rnd.m \
+  statistics/distributions/logistic_cdf.m \
+  statistics/distributions/logistic_inv.m \
+  statistics/distributions/logistic_pdf.m \
+  statistics/distributions/logistic_rnd.m \
+  statistics/distributions/logncdf.m \
+  statistics/distributions/logninv.m \
+  statistics/distributions/lognpdf.m \
+  statistics/distributions/lognrnd.m \
+  statistics/distributions/nbincdf.m \
+  statistics/distributions/nbininv.m \
+  statistics/distributions/nbinpdf.m \
+  statistics/distributions/nbinrnd.m \
+  statistics/distributions/normcdf.m \
+  statistics/distributions/norminv.m \
+  statistics/distributions/normpdf.m \
+  statistics/distributions/normrnd.m \
+  statistics/distributions/poisscdf.m \
+  statistics/distributions/poissinv.m \
+  statistics/distributions/poisspdf.m \
+  statistics/distributions/poissrnd.m \
+  statistics/distributions/stdnormal_cdf.m \
+  statistics/distributions/stdnormal_inv.m \
+  statistics/distributions/stdnormal_pdf.m \
+  statistics/distributions/stdnormal_rnd.m \
+  statistics/distributions/tcdf.m \
+  statistics/distributions/tinv.m \
+  statistics/distributions/tpdf.m \
+  statistics/distributions/trnd.m \
+  statistics/distributions/unidrnd.m \
+  statistics/distributions/unidcdf.m \
+  statistics/distributions/unidinv.m \
+  statistics/distributions/unidpdf.m \
+  statistics/distributions/unifrnd.m \
+  statistics/distributions/unifcdf.m \
+  statistics/distributions/unifinv.m \
+  statistics/distributions/unifpdf.m \
+  statistics/distributions/wblcdf.m \
+  statistics/distributions/wblinv.m \
+  statistics/distributions/wblpdf.m \
+  statistics/distributions/wblrnd.m \
+  statistics/distributions/wienrnd.m
+
+FCN_FILES += $(statistics_distributions_FCN_FILES)
+
+PKG_ADD_FILES += statistics/distributions/PKG_ADD
deleted file mode 100644
--- a/scripts/statistics/models/Makefile.in
+++ /dev/null
@@ -1,84 +0,0 @@
-# Makefile for octave's scripts/statistics/models directory
-#
-# Copyright (C) 1998, 2002, 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../../..
-
-script_sub_dir = statistics/models
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = logistic_regression.m logistic_regression_derivatives.m \
-  logistic_regression_likelihood.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../../`cat ../../../.fname`/scripts/$(script_sub_dir)
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/statistics/models/module.mk
@@ -0,0 +1,10 @@
+FCN_FILE_DIRS += statistics/models
+
+statistics_models_FCN_FILES = \
+  statistics/models/logistic_regression.m \
+  statistics/models/logistic_regression_derivatives.m \
+  statistics/models/logistic_regression_likelihood.m
+
+FCN_FILES += $(statistics_models_FCN_FILES)
+
+PKG_ADD_FILES += statistics/models/PKG_ADD
deleted file mode 100644
--- a/scripts/statistics/tests/Makefile.in
+++ /dev/null
@@ -1,89 +0,0 @@
-# Makefile for octave's scripts/statistics/tests directory
-#
-# Copyright (C) 1998, 2002, 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../../..
-
-script_sub_dir = statistics/tests
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = anova.m bartlett_test.m chisquare_test_homogeneity.m \
-  chisquare_test_independence.m cor_test.m f_test_regression.m \
-  hotelling_test.m hotelling_test_2.m kolmogorov_smirnov_test.m \
-  kolmogorov_smirnov_test_2.m kruskal_wallis_test.m manova.m \
-  mcnemar_test.m prop_test_2.m run_test.m sign_test.m t_test.m \
-  t_test_2.m t_test_regression.m u_test.m var_test.m welch_test.m \
-  wilcoxon_test.m z_test.m z_test_2.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../../`cat ../../../.fname`/scripts/$(script_sub_dir)
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/statistics/tests/module.mk
@@ -0,0 +1,32 @@
+FCN_FILE_DIRS += statistics/tests
+
+statistics_tests_FCN_FILES = \
+  statistics/tests/anova.m \
+  statistics/tests/bartlett_test.m \
+  statistics/tests/chisquare_test_homogeneity.m \
+  statistics/tests/chisquare_test_independence.m \
+  statistics/tests/cor_test.m \
+  statistics/tests/f_test_regression.m \
+  statistics/tests/hotelling_test.m \
+  statistics/tests/hotelling_test_2.m \
+  statistics/tests/kolmogorov_smirnov_test.m \
+  statistics/tests/kolmogorov_smirnov_test_2.m \
+  statistics/tests/kruskal_wallis_test.m \
+  statistics/tests/manova.m \
+  statistics/tests/mcnemar_test.m \
+  statistics/tests/prop_test_2.m \
+  statistics/tests/run_test.m \
+  statistics/tests/sign_test.m \
+  statistics/tests/t_test.m \
+  statistics/tests/t_test_2.m \
+  statistics/tests/t_test_regression.m \
+  statistics/tests/u_test.m \
+  statistics/tests/var_test.m \
+  statistics/tests/welch_test.m \
+  statistics/tests/wilcoxon_test.m \
+  statistics/tests/z_test.m \
+  statistics/tests/z_test_2.m
+
+FCN_FILES += $(statistics_tests_FCN_FILES)
+
+PKG_ADD_FILES += statistics/tests/PKG_ADD
deleted file mode 100644
--- a/scripts/strings/Makefile.in
+++ /dev/null
@@ -1,89 +0,0 @@
-# Makefile for octave's scripts/strings directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008, 2009
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = strings
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = base2dec.m bin2dec.m blanks.m deblank.m dec2base.m \
-  dec2bin.m dec2hex.m findstr.m hex2dec.m index.m isletter.m isstrprop.m \
-  mat2str.m regexptranslate.m rindex.m strsplit.m str2double.m \
-  str2num.m strcat.m cstrcat.m strcmpi.m strchr.m strfind.m strjust.m strmatch.m \
-  strncmpi.m strrep.m strtok.m strtrim.m strtrunc.m \
-  substr.m validatestring.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/strings
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/strings/module.mk
@@ -0,0 +1,39 @@
+FCN_FILE_DIRS += strings
+
+strings_FCN_FILES = \
+  strings/base2dec.m \
+  strings/bin2dec.m \
+  strings/blanks.m \
+  strings/deblank.m \
+  strings/dec2base.m \
+  strings/dec2bin.m \
+  strings/dec2hex.m \
+  strings/findstr.m \
+  strings/hex2dec.m \
+  strings/index.m \
+  strings/isletter.m \
+  strings/isstrprop.m \
+  strings/mat2str.m \
+  strings/regexptranslate.m \
+  strings/rindex.m \
+  strings/strsplit.m \
+  strings/str2double.m \
+  strings/str2num.m \
+  strings/strcat.m \
+  strings/cstrcat.m \
+  strings/strcmpi.m \
+  strings/strchr.m \
+  strings/strfind.m \
+  strings/strjust.m \
+  strings/strmatch.m \
+  strings/strncmpi.m \
+  strings/strrep.m \
+  strings/strtok.m \
+  strings/strtrim.m \
+  strings/strtrunc.m \
+  strings/substr.m \
+  strings/validatestring.m
+
+FCN_FILES += $(strings_FCN_FILES)
+
+PKG_ADD_FILES += strings/PKG_ADD
deleted file mode 100644
--- a/scripts/testfun/Makefile.in
+++ /dev/null
@@ -1,83 +0,0 @@
-# Makefile for octave's scripts/testfun directory
-#
-# Copyright (C) 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = testfun
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = assert.m demo.m example.m fail.m rundemos.m speed.m test.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/testfun
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/testfun/module.mk
@@ -0,0 +1,14 @@
+FCN_FILE_DIRS += testfun
+
+testfun_FCN_FILES = \
+  testfun/assert.m \
+  testfun/demo.m \
+  testfun/example.m \
+  testfun/fail.m \
+  testfun/rundemos.m \
+  testfun/speed.m \
+  testfun/test.m
+
+FCN_FILES += $(testfun_FCN_FILES)
+
+PKG_ADD_FILES += testfun/PKG_ADD
deleted file mode 100644
--- a/scripts/time/Makefile.in
+++ /dev/null
@@ -1,85 +0,0 @@
-# Makefile for octave's scripts/time directory
-#
-# Copyright (C) 1995, 1996, 1997, 2002, 2005, 2006, 2007, 2008 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ../..
-
-script_sub_dir = time
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SOURCES = addtodate.m asctime.m calendar.m clock.m ctime.m date.m \
-  datenum.m datestr.m datetick.m datevec.m eomday.m etime.m is_leap_year.m \
-  now.m weekday.m
-
-DISTFILES = $(addprefix $(srcdir)/, Makefile.in $(SOURCES))
-
-FCN_FILES = $(addprefix $(srcdir)/, $(SOURCES))
-FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
-
-all: PKG_ADD
-.PHONY: all
-
-install install-strip:
-	$(do-script-install)
-.PHONY: install install-strip
-
-uninstall:
-	$(do-script-uninstall)
-.PHONY: uninstall
-
-clean:
-.PHONY: clean
-
-PKG_ADD: $(FCN_FILES)
-	@echo "making PKG_ADD"
-	@$(do-mkpkgadd)
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile PKG_ADD
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/time
-.PHONY: dist
-
-check-m-sources:
-	@$(do-check-m-sources)
-.PHONY: check-m-sources
new file mode 100644
--- /dev/null
+++ b/scripts/time/module.mk
@@ -0,0 +1,22 @@
+FCN_FILE_DIRS += time
+
+time_FCN_FILES = \
+  time/addtodate.m \
+  time/asctime.m \
+  time/calendar.m \
+  time/clock.m \
+  time/ctime.m \
+  time/date.m \
+  time/datenum.m \
+  time/datestr.m \
+  time/datetick.m \
+  time/datevec.m \
+  time/eomday.m \
+  time/etime.m \
+  time/is_leap_year.m \
+  time/now.m \
+  time/weekday.m
+
+FCN_FILES += $(time_FCN_FILES)
+
+PKG_ADD_FILES += time/PKG_ADD
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
+2009-11-10  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am, OPERATORS/module.mk, TEMPLATE-INST/module.mk,
+	find-defun-files.sh, version.h.in,
+	DLD-FUNCTIONS/config-module.awk, DLD-FUNCTIONS/config-module.sh,
+	DLD-FUNCTIONS/module-files: New files.
+	* Makefile.in, version.h: Delete.
+	* lex.ll: Rename from lex.l.  Include oct-parse.h instead of
+	y.tab.h.
+	* parse.yy: Rename from parse.y
+	* mkbuiltins, mkgendoc: Don't require filenames to start with a
+	"." at beginning of line.
+
+	* oct-conf.h.in (OCTAVE_CONF_LAPACK_LIBS): Delete macro.
+	* toplev.cc (octave_config_info): Don't include LAPACK_LIBS in the
+	struct.
+
 2009-11-10  Jaroslav Hajek  <highegg@gmail.com>
 
 	* ov-class.cc (octave_class::numel): Use base version if called from
new file mode 100644
--- /dev/null
+++ b/src/DLD-FUNCTIONS/config-module.awk
@@ -0,0 +1,47 @@
+BEGIN {
+  print "## DO NOT EDIT -- generated from module-files by config-module.awk";
+  nfiles = 0;
+} {
+  files[++nfiles] = $1;
+} END {
+  sep = " \\\n";
+  print "DLD_FUNCTIONS_LIBS = \\";
+  for (i = 1; i <= nfiles; i++) {
+    basename = files[i];
+    sub (/\.cc$/, "", basename);
+    if (i == nfiles)
+      sep = "\n";
+    printf ("  DLD-FUNCTIONS/%s.la%s", basename, sep);
+  }
+  print "octlib_LTLIBRARIES += $(DLD_FUNCTIONS_LIBS)";
+  print "if AMCOND_ENABLE_DYNAMIC_LINKING";
+  for (i = 1; i <= nfiles; i++) {
+    basename = files[i];
+    sub (/\.cc$/, "", basename);
+    printf ("DLD-FUNCTIONS/%s.oct: DLD-FUNCTIONS/%s.la\n", basename, basename);
+    print "\trm -f $@";
+    print "\tla=`echo $< | $(SED) 's,DLD-FUNCTIONS/,,'` && \\";
+    print "\t  of=`echo $@ | $(SED) 's,DLD-FUNCTIONS/,,'` && \\";
+    print "\t  cd DLD-FUNCTIONS && \\";
+    print "\t  $(LN_S) .libs/`$(SED) -n -e \"s/dlname='\\([^']*\\)'/\\1/p\" < $$la` $$of";
+  }
+  print "endif";
+
+  for (i = 1; i <= nfiles; i++) {
+    basename = files[i];
+    sub (/\.cc$/, "", basename);
+    printf ("DLD_FUNCTIONS_%s_la_SOURCES = DLD-FUNCTIONS/%s\n",
+	    basename, files[i]);
+    printf ("DLD_FUNCTIONS_%s_la_LDFLAGS = @NO_UNDEFINED_LDFLAG@ -module\n",
+	    basename);
+    printf ("DLD_FUNCTIONS_%s_la_LIBADD = $(OCT_LINK_DEPS)\n", basename);
+  }
+
+  sep = " \\\n";
+  print "DLD_FUNCTIONS_SRC = \\";
+  for (i = 1; i <= nfiles; i++) {
+    if (i == nfiles)
+      sep = "\n";
+    printf ("  DLD-FUNCTIONS/%s%s", files[i], sep);
+  }
+}
new file mode 100755
--- /dev/null
+++ b/src/DLD-FUNCTIONS/config-module.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+set -e
+
+: ${AWK=awk}
+
+$AWK -f config-module.awk < module-files > module.mk-t
+
+../../move-if-change module.mk-t module.mk
new file mode 100644
--- /dev/null
+++ b/src/DLD-FUNCTIONS/module-files
@@ -0,0 +1,76 @@
+__contourc__.cc
+__convn__.cc
+__delaunayn__.cc
+__dsearchn__.cc
+__glpk__.cc
+__lin_interpn__.cc
+__magick_read__.cc
+__pchip_deriv__.cc
+__qp__.cc
+__voronoi__.cc
+amd.cc
+balance.cc
+besselj.cc
+betainc.cc
+bsxfun.cc
+ccolamd.cc
+cellfun.cc
+chol.cc
+colamd.cc
+colloc.cc
+conv2.cc
+convhulln.cc
+daspk.cc
+dasrt.cc
+dassl.cc
+det.cc
+dispatch.cc
+dlmread.cc
+dmperm.cc
+eig.cc
+eigs.cc
+fft.cc
+fft2.cc
+fftn.cc
+fftw.cc
+filter.cc
+find.cc
+fltk_backend.cc
+gammainc.cc
+gcd.cc
+getgrent.cc
+getpwent.cc
+getrusage.cc
+givens.cc
+hess.cc
+hex2num.cc
+inv.cc
+kron.cc
+lookup.cc
+lsode.cc
+lu.cc
+luinc.cc
+matrix_type.cc
+max.cc
+md5sum.cc
+pinv.cc
+qr.cc
+quad.cc
+qz.cc
+rand.cc
+rcond.cc
+regexp.cc
+schur.cc
+sparse.cc
+spparms.cc
+sqrtm.cc
+sub2ind.cc
+svd.cc
+syl.cc
+symbfact.cc
+symrcm.cc
+time.cc
+tril.cc
+tsearch.cc
+typecast.cc
+urlwrite.cc
new file mode 100644
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,798 @@
+# Makefile for octave's src directory
+#
+# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ..
+
+include ../common.mk
+
+octlib_LTLIBRARIES = \
+  liboctinterp.la
+
+AM_CPPFLAGS = \
+  @CPPFLAGS@ -I$(top_srcdir)/libcruft/misc -I../liboctave -I$(top_srcdir)/liboctave -I. -I$(srcdir) 
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+BUILT_DISTFILES = \
+  DOCSTRINGS \
+  oct-gperf.h \
+  oct-parse.cc \
+  oct-parse.h \
+  lex.cc \
+  $(OPT_HANDLERS) \
+  $(OPT_INC)
+
+EXTRA_DIST = \
+  ChangeLog \
+  Makefile.in \
+  defaults.h.in \
+  find-defun-files.sh \
+  genprops.awk \
+  graphics.h.in \
+  mk-errno-list \
+  mk-pkg-add \
+  mkbuiltins \
+  mkdefs \
+  mkgendoc \
+  mkops \
+  mxarray.h.in \
+  oct-conf.h.in \
+  oct-errno.cc.in \
+  octave.gperf \
+  $(BUILT_DISTFILES)
+
+DLL_CDEFS = @OCTINTERP_DLL_DEFS@
+DLL_CXXDEFS = @OCTINTERP_DLL_DEFS@
+
+.cc.df:	
+	@echo making $@ from $<
+	@(echo "// DO NOT EDIT!  Generated automatically by mkdefs." ; \
+	  echo " XDEFUN_FILE_NAME (\"$<\")" ; \
+	  egrep '^(///*|/\*) *PKG_ADD:' $< ; \
+	  $(CXXCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	    $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
+	    -DMAKE_BUILTINS $< | $(srcdir)/mkdefs) > $@-t
+	@mv $@-t $@
+
+OPT_HANDLERS = \
+  DASPK-opts.cc \
+  DASRT-opts.cc \
+  DASSL-opts.cc \
+  LSODE-opts.cc \
+  Quad-opts.cc
+
+OPT_IN = \
+  ../liboctave/DASPK-opts.in \
+  ../liboctave/DASRT-opts.in \
+  ../liboctave/DASSL-opts.in \
+  ../liboctave/LSODE-opts.in \
+  ../liboctave/Quad-opts.in
+
+OPT_INC = \
+  ../liboctave/DASPK-opts.h \
+  ../liboctave/DASRT-opts.h \
+  ../liboctave/DASSL-opts.h \
+  ../liboctave/LSODE-opts.h \
+  ../liboctave/Quad-opts.h
+
+OV_INTTYPE_INC = \
+  ov-base-int.h \
+  ov-base-int.cc \
+  ov-int-traits.h \
+  ov-int16.h \
+  ov-int32.h \
+  ov-int64.h \
+  ov-int8.h \
+  ov-intx.h \
+  ov-uint16.h \
+  ov-uint32.h \
+  ov-uint64.h \
+  ov-uint8.h
+
+OV_INCLUDES = \
+  ov-base-diag.h \
+  ov-base-diag.cc \
+  ov-base-mat.h \
+  ov-base-mat.cc \
+  ov-base-scalar.h \
+  ov-base-scalar.cc \
+  ov-base.h \
+  ov-bool-mat.h \
+  ov-bool-mat.cc \
+  ov-bool.h \
+  ov-builtin.h \
+  ov-cell.h \
+  ov-ch-mat.h \
+  ov-class.h \
+  ov-colon.h \
+  ov-complex.h \
+  ov-cs-list.h \
+  ov-cx-diag.h \
+  ov-cx-mat.h \
+  ov-dld-fcn.h \
+  ov-fcn-handle.h \
+  ov-fcn-inline.h \
+  ov-fcn.h \
+  ov-float.h \
+  ov-flt-complex.h \
+  ov-flt-cx-diag.h \
+  ov-flt-cx-mat.h \
+  ov-flt-re-diag.h \
+  ov-flt-re-mat.h \
+  ov-list.h \
+  ov-mex-fcn.h \
+  ov-null-mat.h \
+  ov-perm.h \
+  ov-range.h \
+  ov-re-diag.h \
+  ov-re-mat.h \
+  ov-scalar.h \
+  ov-str-mat.h \
+  ov-struct.h \
+  ov-type-conv.h \
+  ov-typeinfo.h \
+  ov-usr-fcn.h \
+  ov.h \
+  $(OV_INTTYPE_INC)
+
+OV_SPARSE_INCLUDES = \
+  ov-base-sparse.h \
+  ov-bool-sparse.h \
+  ov-cx-sparse.h \
+  ov-re-sparse.h
+
+PT_INCLUDES = \
+  pt-all.h \
+  pt-arg-list.h \
+  pt-assign.h \
+  pt-binop.h \
+  pt-bp.h \
+  pt-cbinop.h \
+  pt-cell.h \
+  pt-check.h \
+  pt-cmd.h \
+  pt-colon.h \
+  pt-const.h \
+  pt-decl.h \
+  pt-eval.h \
+  pt-except.h \
+  pt-exp.h \
+  pt-fcn-handle.h \
+  pt-id.h \
+  pt-idx.h \
+  pt-jump.h \
+  pt-loop.h \
+  pt-mat.h \
+  pt-misc.h \
+  pt-pr-code.h \
+  pt-select.h \
+  pt-stmt.h \
+  pt-unop.h \
+  pt-walk.h \
+  pt.h
+
+octinclude_HEADERS = \
+  Cell.h \
+  base-list.h \
+  builtins.h \
+  c-file-ptr-stream.h \
+  comment-list.h \
+  debug.h \
+  defaults.h \
+  defun-dld.h \
+  defun-int.h \
+  defun.h \
+  dirfns.h \
+  display.h \
+  dynamic-ld.h \
+  error.h \
+  file-io.h \
+  gl-render.h \
+  graphics.h \
+  graphics-props.cc \
+  gripes.h \
+  help.h \
+  input.h \
+  lex.h \
+  load-path.h \
+  load-save.h \
+  ls-ascii-helper.h \
+  ls-hdf5.h \
+  ls-mat-ascii.h \
+  ls-mat4.h \
+  ls-mat5.h \
+  ls-oct-ascii.h \
+  ls-oct-binary.h \
+  ls-utils.h \
+  mex.h \
+  mexproto.h \
+  mxarray.h \
+  oct-conf.h \
+  oct-errno.h \
+  oct-fstrm.h \
+  oct-gperf.h \
+  oct-hdf5.h \
+  oct-hist.h \
+  oct-iostrm.h \
+  oct-lvalue.h \
+  oct-map.h \
+  oct-obj.h \
+  oct-prcstrm.h \
+  oct-procbuf.h \
+  oct-stdstrm.h \
+  oct-stream.h \
+  oct-strstrm.h \
+  oct.h \
+  octave.h \
+  ops.h \
+  pager.h \
+  parse.h \
+  pr-output.h \
+  procstream.h \
+  sighandlers.h \
+  siglist.h \
+  sparse-xdiv.h \
+  sparse-xpow.h \
+  symtab.h \
+  sysdep.h \
+  token.h \
+  toplev.h \
+  txt-eng-ft.h \
+  txt-eng.h \
+  unwind-prot.h \
+  utils.h \
+  variables.h \
+  version.h \
+  xdiv.h \
+  xnorm.h \
+  xpow.h \
+  zfstream.h \
+  $(OV_INCLUDES) \
+  $(OV_SPARSE_INCLUDES) \
+  $(PT_INCLUDES)
+
+OV_INTTYPE_SRC = \
+  ov-int16.cc \
+  ov-int32.cc \
+  ov-int64.cc \
+  ov-int8.cc \
+  ov-uint16.cc \
+  ov-uint32.cc \
+  ov-uint64.cc \
+  ov-uint8.cc
+
+OV_SPARSE_SRC = \
+  ov-base-sparse.cc \
+  ov-bool-sparse.cc \
+  ov-cx-sparse.cc \
+  ov-re-sparse.cc
+
+OV_SRC = \
+  ov-base.cc \
+  ov-bool-mat.cc \
+  ov-bool.cc \
+  ov-builtin.cc \
+  ov-cell.cc \
+  ov-ch-mat.cc \
+  ov-class.cc \
+  ov-colon.cc \
+  ov-complex.cc \
+  ov-cs-list.cc \
+  ov-cx-diag.cc \
+  ov-cx-mat.cc \
+  ov-dld-fcn.cc \
+  ov-fcn-handle.cc \
+  ov-fcn-inline.cc \
+  ov-fcn.cc \
+  ov-float.cc \
+  ov-flt-complex.cc \
+  ov-flt-cx-diag.cc \
+  ov-flt-cx-mat.cc \
+  ov-flt-re-diag.cc \
+  ov-flt-re-mat.cc \
+  ov-list.cc \
+  ov-mex-fcn.cc \
+  ov-null-mat.cc \
+  ov-perm.cc \
+  ov-range.cc \
+  ov-re-diag.cc \
+  ov-re-mat.cc \
+  ov-scalar.cc \
+  ov-str-mat.cc \
+  ov-struct.cc \
+  ov-typeinfo.cc \
+  ov-usr-fcn.cc \
+  ov.cc \
+  $(OV_INTTYPE_SRC) \
+  $(OV_SPARSE_SRC)
+
+PT_SRC = \
+  pt-arg-list.cc \
+  pt-assign.cc \
+  pt-binop.cc \
+  pt-bp.cc \
+  pt-cbinop.cc \
+  pt-cell.cc \
+  pt-check.cc \
+  pt-cmd.cc \
+  pt-colon.cc \
+  pt-const.cc \
+  pt-decl.cc \
+  pt-eval.cc \
+  pt-except.cc \
+  pt-exp.cc \
+  pt-fcn-handle.cc \
+  pt-id.cc \
+  pt-idx.cc \
+  pt-jump.cc \
+  pt-loop.cc \
+  pt-mat.cc \
+  pt-misc.cc \
+  pt-pr-code.cc \
+  pt-select.cc \
+  pt-stmt.cc \
+  pt-unop.cc \
+  pt.cc
+
+DIST_SRC = \
+  Cell.cc \
+  bitfcns.cc \
+  c-file-ptr-stream.cc \
+  comment-list.cc \
+  cutils.c \
+  data.cc \
+  debug.cc \
+  defaults.cc \
+  defun.cc \
+  dirfns.cc \
+  display.cc \
+  dynamic-ld.cc \
+  error.cc \
+  file-io.cc \
+  gl-render.cc \
+  graphics.cc \
+  gripes.cc \
+  help.cc \
+  input.cc \
+  lex.ll \
+  load-path.cc \
+  load-save.cc \
+  ls-ascii-helper.cc \
+  ls-hdf5.cc \
+  ls-mat-ascii.cc \
+  ls-mat4.cc \
+  ls-mat5.cc \
+  ls-oct-ascii.cc \
+  ls-oct-binary.cc \
+  ls-utils.cc \
+  mappers.cc \
+  matherr.c \
+  mex.cc \
+  oct-fstrm.cc \
+  oct-hist.cc \
+  oct-iostrm.cc \
+  oct-lvalue.cc \
+  oct-map.cc \
+  oct-obj.cc \
+  oct-parse.yy \
+  oct-prcstrm.cc \
+  oct-procbuf.cc \
+  oct-stream.cc \
+  oct-strstrm.cc \
+  octave.cc \
+  pager.cc \
+  pr-output.cc \
+  procstream.cc \
+  sighandlers.cc \
+  siglist.c \
+  sparse-xdiv.cc \
+  sparse-xpow.cc \
+  strfns.cc \
+  symtab.cc \
+  syscalls.cc \
+  sysdep.cc \
+  token.cc \
+  toplev.cc \
+  txt-eng-ft.cc \
+  unwind-prot.cc \
+  utils.cc \
+  variables.cc \
+  xdiv.cc \
+  xnorm.cc \
+  xpow.cc \
+  zfstream.cc \
+  $(OV_SRC) \
+  $(PT_SRC)
+
+include DLD-FUNCTIONS/module.mk
+include OPERATORS/module.mk
+include TEMPLATE-INST/module.mk
+
+if AMCOND_ENABLE_DYNAMIC_LINKING
+  DLD_DYNAMIC_SRC = $(DLD_FUNCTIONS_SRC)
+  DLD_STATIC_SRC =
+  OCT_FILES = $(DLD_FUNCTIONS_SRC:.cc=.oct)
+else
+  DLD_DYNAMIC_SRC =
+  DLD_STATIC_SRC = $(DLD_FUNCTIONS_SRC)
+  OCT_FILES =
+endif
+
+liboctinterp_la_SOURCES = \
+  $(DIST_SRC) \
+  $(DLD_STATIC_SRC) \
+  $(OPERATORS_SRC) \
+  $(TEMPLATE_INST_SRC)
+
+DLD_DYNAMIC_DEF_FILES = $(DLD_DYNAMIC_SRC:.cc=.df)
+DLD_STATIC_DEF_FILES = $(DLD_STATIC_SRC:.cc=.df)
+
+SRC_DEF_FILES := $(shell $(srcdir)/find-defun-files.sh "$(srcdir)" $(DIST_SRC))
+
+DEF_FILES = $(SRC_DEF_FILES) $(DLD_DYNAMIC_DEF_FILES) $(DLD_STATIC_DEF_FILES)
+
+if AMCOND_ENABLE_DYNAMIC_LINKING
+  OCTAVE_LIBS = \
+    ./liboctinterp.la \
+    ../liboctave/liboctave.la \
+    ../libcruft/libcruft.la \
+    $(FFTW_XLDFLAGS) $(FFTW_XLIBS) \
+    $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS) \
+    $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) \
+    $(FT2_LDFLAGS) $(FT2_LIBS) \
+    $(HDF5_LDFLAGS) $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
+    $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
+    $(READLINE_LIBS) $(TERM_LIBS) \
+    $(LIBGLOB) \
+    $(LAPACK_LIBS) $(BLAS_LIBS) \
+    $(LIBS) \
+    $(FLIBS)
+else
+  ## FIXME -- this list is probably not complete now.  It may not even
+  ## be possible to build a statically linked copy of Octave that is
+  ## fully functional.
+  OCTAVE_LIBS = \
+    ./liboctinterp.la \
+    ../liboctave/liboctave.la \
+    ../libcruft/libcruft.la \
+    $(FFTW_XLDFLAGS) $(FFTW_XLIBS)
+    $(QHULL_LDFLAGS) $(QHULL_LIBS) \
+    $(ARPACK_LDFLAGS) $(ARPACK_LIBS) \
+    $(QRUPDATE_LDFLAGS) $(QRUPDATE_LIBS) \
+    $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS) \
+    $(REGEX_LDFLAGS) $(REGEX_LIBS) \
+    $(CURL_LDFLAGS) $(CURL_LIBS) \
+    $(GLPK_LDFLAGS) $(GLPK_LIBS) \
+    $(MAGICK_LDFLAGS) $(MAGICK_LIBS) \
+    $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) \
+    $(FT2_LDFLAGS) $(FT2_LIBS) \
+    $(HDF5_LDFLAGS) $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
+    $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
+    $(READLINE_LIBS) $(TERM_LIBS) \
+    $(LIBGLOB) \
+    $(LAPACK_LIBS) $(BLAS_LIBS) \
+    $(LIBS) \
+    $(FLIBS)
+endif
+
+OCTINTERP_LINK_DEPS = \
+  $(RLD_FLAG) \
+  ../liboctave/liboctave.la \
+  ../libcruft/libcruft.la \
+  $(FFTW_XLDFLAGS) $(FFTW_XLIBS) \
+  $(HDF5_LDFLAGS) $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
+  $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
+  $(READLINE_LIBS) $(TERM_LIBS) \
+  $(LIBGLOB) \
+  $(LAPACK_LIBS) $(BLAS_LIBS) \
+  $(LIBS) \
+  $(FLIBS)
+
+liboctinterp_la_LIBADD = $(OCTINTERP_LINK_DEPS)
+
+OCT_LINK_DEPS = \
+  $(RLD_FLAG) $(LDFLAGS) \
+  ./liboctinterp.la \
+  ../liboctave/liboctave.la \
+  ../libcruft/libcruft.la
+
+bin_PROGRAMS = octave
+
+octave_SOURCES = main.c
+
+nodist_liboctinterp_la_SOURCES = \
+  builtins.cc \
+  defaults.h \
+  graphics.h \
+  mxarray.h \
+  oct-conf.h \
+  oct-errno.cc \
+  ops.cc \
+  version.h \
+  $(OPT_HANDLERS) \
+  $(OPT_INC)
+
+liboctinterp_la_LDFLAGS = -release $(version) $(NO_UNDEFINED_LDFLAG)
+
+## Order matters here.  Leave builtins.cc last, because it depends on 
+## $(DEF_FILES), and building those requires all the sources
+## (except builtins.cc) to be available.  List only one of graphics.h
+## and graphics-props.cc because if both are listed, building in
+## parallel will vail.
+BUILT_SOURCES = \
+  defaults.h \
+  graphics.h \
+  lex.cc \
+  oct-conf.h \
+  oct-errno.cc \
+  oct-gperf.h \
+  oct-parse.cc \
+  ops.cc \
+  $(OPT_HANDLERS) \
+  $(OPT_INC) \
+  builtins.cc
+
+CLEANFILES = $(BUILT_SOURCES)
+
+octave_LDADD = $(OCTAVE_LIBS)
+
+all-local: $(OCT_FILES) DLD-FUNCTIONS/PKG_ADD DOCSTRINGS
+
+lex.lo lex.o oct-parse.lo oct-parse.o: \
+  AM_CXXFLAGS := $(filter-out -Wold-style-cast, $(AM_CXXFLAGS))
+
+fltk_backend.lo fltk_backend.o: \
+  AM_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(AM_CXXFLAGS) $(GRAPHICS_CFLAGS))
+
+# XERBLA = ../libcruft/blas-xtra/xerbla.o
+
+builtins.cc: $(DEF_FILES) mkbuiltins
+	@echo making $@
+	@echo DEF_FILES = $(DEF_FILES)
+	@echo $(DEF_FILES) > def-files
+	@$(srcdir)/mkbuiltins def-files > $@-t
+	@mv $@-t $@
+
+## FIXME -- maybe genprops.awk should write both output files?
+## Or maybe there should be separate commands to generate each file?
+graphics.h graphics-props.cc: graphics.h.in genprops.awk
+	@echo making graphics.h and graphics-props.cc
+	@$(AWK) -f $(srcdir)/genprops.awk $< > graphics.h-t
+	@mv graphics.h-t graphics.h
+
+DLD-FUNCTIONS/PKG_ADD: $(DLD_DYNAMIC_DEF_FILES)
+	$(srcdir)/mk-pkg-add $(DLD_DYNAMIC_DEF_FILES) > $@-t
+	@mv $@-t $@
+
+DOCSTRINGS: gendoc$(BUILD_EXEEXT)
+	@echo making $@
+	@./gendoc > $@-t
+	@mv $@-t $@
+
+doc-files: $(DEF_FILES)
+	@echo making $@
+	@echo DEF_FILES = $(DEF_FILES)
+	@echo $(DEF_FILES) > $@-t
+	mv $@-t $@
+
+gendoc.cc: doc-files mkgendoc
+	@echo making $@
+	@$(srcdir)/mkgendoc doc-files > $@-t
+	@mv $@-t $@
+
+gendoc$(BUILD_EXEEXT): gendoc.cc
+	$(BUILD_CXX) $(BUILD_CXXFLAGS) -o $@ $^ $(BUILD_LDFLAGS)
+
+ops.cc: $(OPERATORS_SRC) mkops
+	@echo making $@ from $(OPERATORS_SRC)
+	@$(srcdir)/mkops $(OPERATORS_SRC) > $@-t
+	@mv $@-t $@
+
+$(DEF_FILES): $(OPT_INC) mkdefs 
+
+install-exec-hook: make-version-links
+
+install-data-hook: install-oct
+
+uninstall-local: remove-version-links uninstall-oct
+.PHONY: uninstall-local
+
+make-version-links:
+	cd $(DESTDIR)$(bindir) && \
+	mv octave$(EXEEXT) octave-$(version)$(EXEEXT) && \
+	$(LN_S) octave-$(version)$(EXEEXT) octave$(EXEEXT)
+.PHONY: make-version-links
+
+remove-version-links:
+	rm -f $(DESTDIR)$(bindir)/octave-$(version)$(EXEEXT)
+.PHONY: remove-version-links
+
+if AMCOND_ENABLE_DYNAMIC_LINKING
+install-oct:
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octfiledir)
+	if [ -n "`cat DLD-FUNCTIONS/PKG_ADD`" ]; then \
+	  $(INSTALL_DATA) DLD-FUNCTIONS/PKG_ADD $(DESTDIR)$(octfiledir)/PKG_ADD; \
+	fi
+	cd $(DESTDIR)/$(octlibdir) && \
+	for ltlib in $(DLD_FUNCTIONS_LIBS); do \
+	  f=`echo $$ltlib | $(SED) 's,.*/,,'`; \
+	  dl=`$(SED) -n -e "s/dlname='\([^']*\)'/\1/p" < $$f`; \
+	  if [ -n "$$dl" ]; then \
+	    $(INSTALL_PROGRAM) $$dl $(DESTDIR)$(octfiledir)/`echo $$f | $(SED) 's,^lib,,; s,\.la$$,.oct,'`; \
+	  else \
+	    echo "error: dlname is empty in $$ltlib!"; \
+	    exit 1; \
+	  fi; \
+	  lnames=`$(SED) -n -e "s/library_names='\([^']*\)'/\1/p" < $$f`; \
+	  if [ -n "$$lnames" ]; then \
+	    rm -f $$f $$lnames; \
+	  fi \
+	done
+
+uninstall-oct:
+	for f in $(OCT_FILES); do \
+	  rm -f $(DESTDIR)$(octfiledir)/`echo $$f | $(SED) 's,.*/,,'`; \
+	done
+	rm -f $(DESTDIR)$(octfiledir)/PKG_ADD
+endif
+.PHONY: install-oct uninstall-oct
+
+# Special rules -- these files need special things to be defined.
+
+$(OPT_HANDLERS) : %.cc : $(top_srcdir)/liboctave/%.in $(top_srcdir)/mk-opts.pl
+	@echo making $@ from $<
+	@$(PERL) $(top_srcdir)/mk-opts.pl --opt-handler-fcns $< > $@-t
+	@mv $@-t $@
+
+## We require Bison.
+#parse.cc : parse.y
+#	@echo "expect 14 shift/reduce conflicts"
+#	$(YACC) $(YFLAGS) --output=$@ --defines=y.tab.h $<
+
+#lex.cc : lex.l
+#	$(LEX) $(LFLAGS) $< > $(@F)-t
+#	@mv $(@F)-t $@
+
+
+$(OPT_INC) : %.h : %.in
+	$(MAKE) -C $(@D) $@
+
+## We want to force an update of defaults.h and oct-conf.h every
+## time make is run because some values may come from the command
+## line or the environment.  The substitution rules use move-if-change,
+## so this should not cause trouble if the file already exists and the
+## newly generated file is not different.
+
+defaults.h: defaults.h.in Makefile
+	@$(do_subst_default_vals)
+
+oct-conf.h: oct-conf.h.in Makefile
+	@$(do_subst_config_vals)
+
+oct-errno.cc: oct-errno.cc.in Makefile
+	@echo "making $@ from $<"
+	@if test -n "$(PERL)"; then \
+	  $(srcdir)/mk-errno-list --perl "$(PERL)" < $< > $@-t; \
+	elif test -n "$(PYTHON)"; then \
+	  $(srcdir)/mk-errno-list --python "$(PYTHON)" < $< > $@-t; \
+	else \
+	  $(SED) '/@SYSDEP_ERRNO_LIST@/D' $< > $@-t; \
+	fi
+	@mv $@-t $@
+
+## Don't use a pipeline to process gperf output since if gperf
+## is missing but sed is not, the exit status of the pipeline
+## will still be success and we will end up creating an empty
+## oct-gperf.h file.
+oct-gperf.h: octave.gperf
+	$(GPERF) -t -C -D -G -L C++ -Z octave_kw_hash $< > $@-t1
+	$(SED) 's,lookup\[,gperf_lookup[,' < $@-t1 > $@-t2
+	mv $@-t2 $@
+	rm -f $@-t1
+
+display.df display.lo: CPPFLAGS += $(X11_FLAGS)
+
+DLD-FUNCTIONS/__magick_read__.df: CPPFLAGS += $(MAGICK_CPPFLAGS)
+DLD_FUNCTIONS___magick_read___la_CPPFLAGS = $(AM_CPPFLAGS) $(MAGICK_CPPFLAGS)
+DLD_FUNCTIONS___magick_read___la_LIBADD += $(MAGICK_LDFLAGS) $(MAGICK_LIBS)
+
+DLD-FUNCTIONS/convhulln.df: CPPFLAGS += $(QHULL_CPPFLAGS)
+DLD_FUNCTIONS_convhulln_la_CPPFLAGS = $(AM_CPPFLAGS) $(QHULL_CPPFLAGS)
+DLD_FUNCTIONS_convhulln_la_LIBADD += $(QHULL_LDFLAGS) $(QHULL_LIBS)
+
+DLD-FUNCTIONS/__delaunayn__.df: CPPFLAGS += $(QHULL_CPPFLAGS)
+DLD_FUNCTIONS___delaunayn___la_CPPFLAGS = $(AM_CPPFLAGS) $(QHULL_CPPFLAGS)
+DLD_FUNCTIONS___delaunayn___la_LIBADD += $(QHULL_LDFLAGS) $(QHULL_LIBS)
+
+DLD-FUNCTIONS/__voronoi__.df: CPPFLAGS += $(QHULL_CPPFLAGS)
+DLD_FUNCTIONS___voronoi___la_CPPFLAGS = $(AM_CPPFLAGS) $(QHULL_CPPFLAGS)
+DLD_FUNCTIONS___voronoi___la_LIBADD += $(QHULL_LDFLAGS) $(QHULL_LIBS)
+
+DLD-FUNCTIONS/eigs.df: CPPFLAGS += $(ARPACK_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_eigs_la_CPPFLAGS = $(AM_CPPFLAGS) $(ARPACK_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_eigs_la_LIBADD += $(ARPACK_LDFLAGS) $(ARPACK_LIBS) $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS) $(LAPACK_LIBS) $(BLAS_LIBS)
+
+#DLD-FUNCTIONS/qz.df DLD-FUNCTIONS/qz.lo:
+DLD_FUNCTIONS_qz_la_LIBADD += $(LAPACK_LIBS) $(BLAS_LIBS)
+
+DLD-FUNCTIONS/qr.df: CPPFLAGS += $(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_qr_la_CPPFLAGS = $(AM_CPPFLAGS) $(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_qr_la_LIBADD += $(QRUPDATE_LDFLAGS) $(QRUPDATE_LIBS) $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/chol.df: CPPFLAGS += $(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_chol_la_CPPFLAGS = $(AM_CPPFLAGS) $(QRUPDATE_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_chol_la_LIBADD += $(QRUPDATE_LDFLAGS) $(QRUPDATE_LIBS) $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/regexp.df: CPPFLAGS += $(REGEX_CPPFLAGS)
+DLD_FUNCTIONS_regexp_la_CPPFLAGS = $(AM_CPPFLAGS) $(REGEX_CPPFLAGS)
+DLD_FUNCTIONS_regexp_la_LIBADD += $(REGEX_LDFLAGS) $(REGEX_LIBS)
+
+DLD-FUNCTIONS/urlwrite.df: CPPFLAGS += $(CURL_CPPFLAGS)
+DLD_FUNCTIONS_urlwrite_la_CPPFLAGS = $(AM_CPPFLAGS) $(CURL_CPPFLAGS)
+DLD_FUNCTIONS_urlwrite_la_LIBADD += $(CURL_LDFLAGS) $(CURL_LIBS)
+
+DLD-FUNCTIONS/__glpk__.df: CPPFLAGS += $(GLPK_CPPFLAGS)
+DLD_FUNCTIONS___glpk___la_CPPFLAGS = $(AM_CPPFLAGS) $(GLPK_CPPFLAGS)
+DLD_FUNCTIONS___glpk___la_LIBADD += $(GLPK_LDFLAGS) $(GLPK_LIBS)
+
+DLD-FUNCTIONS/fltk_backend.df: CPPFLAGS += $(GRAPHICS_CPPFLAGS) $(FT2_CPPFLAGS)
+DLD_FUNCTIONS_fltk_backend_la_CPPFLAGS = $(AM_CPPFLAGS) $(GRAPHICS_CPPFLAGS) $(FT2_CPPFLAGS)
+DLD_FUNCTIONS_fltk_backend_la_LIBADD += $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) $(FT2_LDFLAGS) $(FT2_LIBS)
+
+DLD-FUNCTIONS/amd.df: CPPFLAGS += $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_amd_la_CPPFLAGS = $(AM_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_amd_la_LIBADD += $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/colamd.df: CPPFLAGS += $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_colamd_la_CPPFLAGS = $(AM_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_colamd_la_LIBADD += $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/ccolamd.df: CPPFLAGS += $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_ccolamd_la_CPPFLAGS = $(AM_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_ccolamd_la_LIBADD += $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/symbfact.df: CPPFLAGS += $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_symbfact_la_CPPFLAGS = $(AM_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_symbfact_la_LIBADD += $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/dmperm.df: CPPFLAGS += $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_dmperm_la_CPPFLAGS = $(AM_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_dmperm_la_LIBADD += $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/symrcm.df: CPPFLAGS += $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_symrcm_la_CPPFLAGS = $(AM_CPPFLAGS) $(SPARSE_XCPPFLAGS)
+DLD_FUNCTIONS_symrcm_la_LIBADD += $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS)
+
+DLD-FUNCTIONS/fft.df: CPPFLAGS += $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fft_la_CPPFLAGS = $(AM_CPPFLAGS) $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fft_la_LIBADD += $(FFTW_XLDFLAGS) $(FFTW_XLIBS)
+
+DLD-FUNCTIONS/fft2.df: CPPFLAGS += $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fft2_la_CPPFLAGS = $(AM_CPPFLAGS) $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fft2_la_LIBADD += $(FFTW_XLDFLAGS) $(FFTW_XLIBS)
+
+DLD-FUNCTIONS/fftn.df: CPPFLAGS += $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fftn_la_CPPFLAGS = $(AM_CPPFLAGS) $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fftn_la_LIBADD += $(FFTW_XLDFLAGS) $(FFTW_XLIBS)
+
+DLD-FUNCTIONS/fftw.df: CPPFLAGS += $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fftw_la_CPPFLAGS = $(AM_CPPFLAGS) $(FFTW_XCPPFLAGS)
+DLD_FUNCTIONS_fftw_la_LIBADD += $(FFTW_XLDFLAGS) $(FFTW_XLIBS)
deleted file mode 100644
--- a/src/Makefile.in
+++ /dev/null
@@ -1,778 +0,0 @@
-# Makefile for octave's src directory
-#
-# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-#               2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@:@srcdir@/DLD-FUNCTIONS:@srcdir@/OPERATORS:@srcdir@/TEMPLATE-INST
-
-include $(TOPDIR)/Makeconf
-
-DLL_CDEFS = @OCTINTERP_DLL_DEFS@
-DLL_CXXDEFS = @OCTINTERP_DLL_DEFS@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-PT_FLAGS = -fexternal-templates -fno-implicit-templates
-CXXFLAGS_NO_PT_FLAGS = $(filter-out $(PT_FLAGS), $(ALL_CXXFLAGS))
-
-%.df : %.cc
-	@echo making $@ from $<
-	@(echo "// DO NOT EDIT!  Generated automatically by mkdefs." ; \
-	  echo " XDEFUN_FILE_NAME (\"$<\")" ; \
-	  egrep '^(///*|/\*) *PKG_ADD:' $< ; \
-	  $(CXXCPP) $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) -DMAKE_BUILTINS $< \
-	    | $(srcdir)/mkdefs) > $@-t
-	@mv $@-t $@
-
-# How to make a .oct file from a .o file:
-
-ifeq ($(ENABLE_DYNAMIC_LINKING), true)
-  ifdef CXXPICFLAG
-    %.oct : pic/%.o octave$(EXEEXT)
-	  $(DL_LD) $(DL_LDFLAGS) -o $@ $< $(OCT_LINK_DEPS)
-  else
-    %.oct : %.o octave$(EXEEXT)
-	  $(DL_LD) $(DL_LDFLAGS) -o $@ $< $(OCT_LINK_DEPS)
-  endif
-endif
-
-OPT_BASE := $(addsuffix -opts, DASPK DASRT DASSL LSODE Quad)
-OPT_HANDLERS := $(addsuffix .cc, $(OPT_BASE))
-OPT_IN := $(addprefix ../liboctave/, $(addsuffix .in, $(OPT_BASE)))
-OPT_INC := $(addprefix ../liboctave/, $(addsuffix .h, $(OPT_BASE)))
-
-DLD_XSRC := amd.cc balance.cc besselj.cc betainc.cc bsxfun.cc \
-	cellfun.cc chol.cc ccolamd.cc colamd.cc colloc.cc \
-	conv2.cc convhulln.cc daspk.cc dasrt.cc dassl.cc det.cc \
-	dispatch.cc dlmread.cc dmperm.cc eig.cc eigs.cc fft.cc \
-	fft2.cc fftn.cc fftw.cc filter.cc find.cc fltk_backend.cc \
-	gammainc.cc gcd.cc getgrent.cc getpwent.cc getrusage.cc \
-	givens.cc hess.cc hex2num.cc inv.cc kron.cc lookup.cc \
-	lsode.cc lu.cc luinc.cc matrix_type.cc max.cc md5sum.cc \
-	pinv.cc qr.cc quad.cc qz.cc rand.cc rcond.cc regexp.cc \
-	schur.cc sparse.cc spparms.cc sqrtm.cc sub2ind.cc svd.cc syl.cc \
-	symrcm.cc symbfact.cc time.cc tril.cc tsearch.cc typecast.cc \
-	urlwrite.cc __contourc__.cc __delaunayn__.cc \
-	__dsearchn__.cc __glpk__.cc __lin_interpn__.cc \
-	__magick_read__.cc __pchip_deriv__.cc __qp__.cc \
-	__voronoi__.cc __convn__.cc
-
-DLD_SRC := $(addprefix DLD-FUNCTIONS/, $(DLD_XSRC))
-
-DLD_OBJ_1 := $(patsubst %.l, %.o, $(DLD_XSRC))
-DLD_OBJ := $(patsubst %.cc, %.o, $(DLD_OBJ_1))
-
-ifeq ($(ENABLE_DYNAMIC_LINKING), true)
-  OCT_FILES := $(patsubst %.o, %.oct, $(DLD_OBJ))
-  ifdef CXXPICFLAG
-    DLD_PICOBJ := $(addprefix pic/, $(DLD_OBJ))
-  else
-    DLD_PICOBJ := $(DLD_OBJ)
-  endif
-else
-  DLD_STATIC_OBJ := $(DLD_OBJ)
-endif
-
-OV_INTTYPE_INC := ov-base-int.h ov-int-traits.h ov-intx.h \
-	ov-int8.h ov-int16.h ov-int32.h ov-int64.h \
-	ov-uint8.h ov-uint16.h ov-uint32.h ov-uint64.h
-
-OV_INCLUDES := ov-re-mat.h ov-cx-mat.h ov-ch-mat.h ov-cs-list.h ov-list.h \
-	ov-struct.h ov-scalar.h ov-range.h ov-complex.h \
-	ov-colon.h ov-base.h ov-base-mat.h ov-base-scalar.h \
-	ov-str-mat.h ov-bool-mat.h ov-null-mat.h ov-bool.h \
-	ov-base-diag.h ov-re-diag.h ov-flt-re-diag.h ov-cx-diag.h \
-	ov-flt-cx-diag.h ov-perm.h \
-	ov-cell.h ov.h ov-fcn.h ov-builtin.h ov-dld-fcn.h \
-	ov-mex-fcn.h ov-usr-fcn.h ov-fcn-handle.h \
-	ov-fcn-inline.h ov-class.h ov-typeinfo.h ov-type-conv.h \
-	ov-flt-re-mat.h ov-flt-cx-mat.h ov-float.h ov-flt-complex.h \
-	$(OV_INTTYPE_INC)
-
-OV_SPARSE_INCLUDES := \
-	ov-base-sparse.h ov-bool-sparse.h ov-cx-sparse.h ov-re-sparse.h
-
-PT_INCLUDES := pt.h pt-all.h pt-arg-list.h pt-assign.h pt-binop.h \
-        pt-bp.h pt-cbinop.h pt-cell.h pt-check.h pt-cmd.h pt-colon.h \
-	pt-const.h pt-decl.h pt-eval.h pt-except.h pt-exp.h pt-fcn-handle.h \
-	pt-id.h pt-idx.h pt-jump.h pt-loop.h pt-mat.h pt-misc.h \
-	pt-pr-code.h pt-select.h pt-stmt.h pt-unop.h pt-walk.h
-
-INCLUDES := Cell.h base-list.h builtins.h c-file-ptr-stream.h \
-	comment-list.h debug.h defun-dld.h defun-int.h defun.h \
-	dirfns.h display.h dynamic-ld.h error.h file-io.h gl-render.h \
-	gripes.h help.h input.h lex.h load-path.h load-save.h ls-hdf5.h \
-	ls-mat-ascii.h ls-mat4.h ls-mat5.h ls-oct-ascii.h ls-ascii-helper.h \
-	ls-oct-binary.h ls-utils.h mex.h mexproto.h oct-errno.h \
-	oct-fstrm.h oct-hdf5.h oct-hist.h oct-iostrm.h oct-map.h oct-obj.h \
-	oct-prcstrm.h oct-procbuf.h oct-stdstrm.h oct-stream.h \
-	zfstream.h oct-strstrm.h oct-lvalue.h oct.h octave.h ops.h \
-	pager.h parse.h pr-output.h procstream.h sighandlers.h \
-	siglist.h sparse-xdiv.h sparse-xpow.h symtab.h sysdep.h \
-	token.h toplev.h txt-eng.h txt-eng-ft.h unwind-prot.h \
-	utils.h variables.h version.h xdiv.h xnorm.h xpow.h \
-	$(OV_INCLUDES) \
-	$(PT_INCLUDES) \
-	$(OV_SPARSE_INCLUDES)
-
-TI_XSRC := Array-os.cc Array-tc.cc
-
-TI_SRC := $(addprefix TEMPLATE-INST/, $(TI_XSRC))
-
-INTTYPE_OP_XSRC := op-int-concat.cc op-int-conv.cc \
-	op-i8-i8.cc op-i16-i16.cc op-i32-i32.cc op-i64-i64.cc \
-	op-ui8-ui8.cc op-ui16-ui16.cc op-ui32-ui32.cc op-ui64-ui64.cc
-
-SPARSE_OP_XSRC := op-bm-sbm.cc op-b-sbm.cc op-cm-scm.cc op-cm-sm.cc \
-	op-cs-scm.cc op-cs-sm.cc op-m-scm.cc op-m-sm.cc op-sbm-b.cc \
-	op-sbm-bm.cc op-sbm-sbm.cc op-scm-cm.cc op-scm-cs.cc op-scm-m.cc \
-	op-scm-s.cc op-scm-scm.cc op-scm-sm.cc op-sm-cm.cc \
-	op-sm-cs.cc op-sm-m.cc op-sm-s.cc op-sm-scm.cc op-sm-sm.cc \
-	op-s-scm.cc op-s-sm.cc
-
-DOUBLE_OP_XSRC := op-double-conv.cc op-cm-cm.cc op-cm-cs.cc op-cm-m.cc \
-	op-cm-s.cc op-cs-cm.cc op-cs-cs.cc op-cs-m.cc \
-	op-cs-s.cc op-m-cm.cc \
-	op-m-cs.cc op-m-m.cc op-m-s.cc op-s-cm.cc \
-	op-s-cs.cc op-s-m.cc op-s-s.cc 
-
-FLOAT_OP_XSRC := op-float-conv.cc op-fcm-fcm.cc op-fcm-fcs.cc op-fcm-fm.cc \
-	op-fcm-fs.cc op-fcs-fcm.cc op-fcs-fcs.cc op-fcs-fm.cc \
-	op-fcs-fs.cc op-fm-fcm.cc \
-	op-fm-fcs.cc op-fm-fm.cc op-fm-fs.cc op-fs-fcm.cc \
-	op-fs-fcs.cc op-fs-fm.cc op-fs-fs.cc 
-
-DIAG_OP_XSRC := op-cdm-cdm.cc op-cdm-cm.cc op-cdm-cs.cc op-cdm-dm.cc \
-	op-cdm-m.cc op-cdm-s.cc op-cm-cdm.cc op-cm-dm.cc op-dm-cdm.cc \
-	op-dm-cm.cc op-dm-cs.cc op-dm-dm.cc op-dm-m.cc op-dm-s.cc \
-	op-m-cdm.cc op-m-dm.cc op-dm-sm.cc op-dm-scm.cc
-
-FDIAG_OP_XSRC := op-fcdm-fcdm.cc op-fcdm-fcm.cc op-fcdm-fcs.cc op-fcdm-fdm.cc \
-	op-fcdm-fm.cc op-fcdm-fs.cc op-fcm-fcdm.cc op-fcm-fdm.cc \
-	op-fdm-fcdm.cc op-fdm-fcm.cc op-fdm-fcs.cc op-fdm-fdm.cc \
-	op-fdm-fm.cc op-fdm-fs.cc op-fm-fcdm.cc op-fm-fdm.cc
-
-PERM_OP_XSRC := op-cm-pm.cc op-fcm-pm.cc op-fm-pm.cc op-pm-fcm.cc \
-	op-pm-fm.cc op-m-pm.cc op-pm-cm.cc op-pm-m.cc op-pm-pm.cc \
-	op-pm-sm.cc op-pm-scm.cc
-
-OP_XSRC :=  op-b-b.cc op-b-bm.cc op-bm-b.cc op-bm-bm.cc op-cell.cc \
-	op-chm.cc op-class.cc op-list.cc op-range.cc op-str-m.cc \
-	op-str-s.cc op-str-str.cc op-struct.cc \
-	$(DOUBLE_OP_XSRC) $(FLOAT_OP_XSRC) $(INTTYPE_OP_XSRC) \
-	$(SPARSE_OP_XSRC) $(DIAG_OP_XSRC) $(FDIAG_OP_XSRC) $(PERM_OP_XSRC)
-
-OP_SRC := $(addprefix OPERATORS/, $(OP_XSRC))
-
-OP_INCLUDES := OPERATORS/op-int.h \
-	OPERATORS/op-dm-template.cc OPERATORS/op-dms-template.cc OPERATORS/op-pm-template.cc
-
-OV_INTTYPE_SRC := \
-	ov-int8.cc ov-int16.cc ov-int32.cc ov-int64.cc \
-	ov-uint8.cc ov-uint16.cc ov-uint32.cc ov-uint64.cc
-
-OV_SPARSE_SRC := \
-	ov-base-sparse.cc ov-bool-sparse.cc ov-cx-sparse.cc ov-re-sparse.cc
-
-OV_SRC := ov-base.cc ov-ch-mat.cc \
-	ov-cs-list.cc ov-list.cc ov-re-mat.cc ov-cx-mat.cc \
-	ov-range.cc ov-scalar.cc ov-complex.cc ov-str-mat.cc \
-	ov-struct.cc \
-	ov-colon.cc ov-bool-mat.cc ov-bool.cc ov-null-mat.cc ov-cell.cc \
-	ov.cc ov-fcn.cc ov-builtin.cc ov-dld-fcn.cc \
-	ov-mex-fcn.cc ov-usr-fcn.cc ov-fcn-handle.cc ov-fcn-inline.cc \
-	ov-class.cc ov-typeinfo.cc \
-	ov-flt-re-mat.cc ov-flt-cx-mat.cc ov-float.cc ov-flt-complex.cc \
-	ov-re-diag.cc ov-flt-re-diag.cc ov-cx-diag.cc ov-flt-cx-diag.cc \
-	ov-perm.cc \
-	$(OV_INTTYPE_SRC) \
-	$(OV_SPARSE_SRC)
-
-PT_SRC := pt.cc pt-arg-list.cc pt-assign.cc pt-bp.cc pt-binop.cc \
-	pt-cbinop.cc pt-cell.cc pt-check.cc pt-cmd.cc pt-colon.cc \
-	pt-const.cc pt-decl.cc pt-eval.cc pt-except.cc pt-exp.cc \
-	pt-fcn-handle.cc pt-id.cc pt-idx.cc pt-jump.cc pt-loop.cc \
-	pt-mat.cc pt-misc.cc pt-pr-code.cc pt-select.cc pt-stmt.cc \
-	pt-unop.cc
-
-DIST_SRC := Cell.cc bitfcns.cc c-file-ptr-stream.cc comment-list.cc \
-	cutils.c data.cc debug.cc defaults.cc defun.cc dirfns.cc \
-	display.cc dynamic-ld.cc error.cc file-io.cc gl-render.cc \
-	graphics.cc gripes.cc help.cc input.cc lex.l load-path.cc \
-	load-save.cc ls-hdf5.cc ls-mat-ascii.cc ls-mat4.cc \
-	ls-mat5.cc ls-oct-ascii.cc ls-ascii-helper.cc \
-	ls-oct-binary.cc ls-utils.cc main.c mappers.cc matherr.c \
-	mex.cc oct-fstrm.cc oct-hist.cc oct-iostrm.cc oct-map.cc \
-	oct-obj.cc oct-prcstrm.cc oct-procbuf.cc oct-stream.cc \
-	octave.cc zfstream.cc oct-strstrm.cc oct-lvalue.cc pager.cc \
-	parse.y pr-output.cc procstream.cc sighandlers.cc \
-	siglist.c sparse-xdiv.cc sparse-xpow.cc strfns.cc \
-	syscalls.cc symtab.cc sysdep.cc token.cc toplev.cc \
-	txt-eng-ft.cc \
-	unwind-prot.cc utils.cc variables.cc xdiv.cc xnorm.cc xpow.cc \
-	$(OV_SRC) \
-	$(PT_SRC)
-
-SOURCES := $(DIST_SRC) $(OP_SRC) $(TI_SRC)
-
-BUILT_EXTRAS := graphics.h mxarray.h
-
-EXTRAS := ov-base-int.cc ov-base-mat.cc ov-base-diag.cc ov-base-scalar.cc graphics-props.cc
-
-EXTRA_OBJECTS := oct-errno.o octave.o builtins.o ops.o
-
-INCLUDES_FOR_INSTALL := $(INCLUDES) $(EXTRAS) $(BUILT_EXTRAS)
-
-OBJECTS_4 := $(notdir $(SOURCES))
-OBJECTS_3 := $(patsubst %.l, %.o, $(OBJECTS_4))
-OBJECTS_2 := $(patsubst %.y, %.o, $(OBJECTS_3))
-OBJECTS_1 := $(patsubst %.c, %.o, $(OBJECTS_2))
-OBJECTS := $(patsubst %.cc, %.o, $(OBJECTS_1)) $(EXTRA_OBJECTS)
-
-ifeq ($(SHARED_LIBS), true)
-  ifdef CXXPICFLAG
-    PICOBJ := $(addprefix pic/, $(OBJECTS))
-  else
-    PICOBJ := $(OBJECTS)
-  endif
-endif
-
-# Ugh.
-
-DEP_5 := $(SOURCES) $(DLD_SRC) builtins.cc oct-errno.cc ops.cc main.c
-DEP_4 := $(notdir $(DEP_5))
-DEP_3 := $(patsubst %.l, %.cc, $(DEP_4))
-DEP_2 := $(patsubst %.y, %.cc, $(DEP_3))
-DEP_1 := $(patsubst %.c, %.d, $(DEP_2))
-MAKEDEPS := $(patsubst %.cc, %.d, $(DEP_1))
-
-# Some stupid egreps don't like empty elements in alternation patterns,
-# so we have to repeat ourselves because some stupid egreps don't like
-# empty elements in alternation patterns.
-
-DEFUN_PATTERN = "^[ \t]*DEF(CONSTFUN|CMD|UN|UN_DLD|UNX_DLD|UN_TEXT)[ \t]*\\("
-
-DLD_DEF_FILES_1 := $(patsubst %.l, %.df, $(DLD_XSRC))
-DLD_DEF_FILES := $(patsubst %.cc, %.df, $(DLD_DEF_FILES_1))
-
-DEF_4 := $(addprefix $(srcdir)/, $(SOURCES))
-DEF_3 := $(notdir $(shell egrep -l $(DEFUN_PATTERN) $(DEF_4)))
-DEF_2 := $(patsubst %.y, %.df, $(DEF_3))
-DEF_1 := $(patsubst %.l, %.df, $(DEF_2))
-DEF_FILES := $(patsubst %.cc, %.df, $(DEF_1)) $(DLD_DEF_FILES)
-
-DOC_FILES := $(sort $(DEF_FILES))
-
-ifeq ($(ENABLE_DYNAMIC_LINKING), true)
-  OCTAVE_LIBS = -L. $(LIBOCTINTERP) \
-    -L../liboctave $(LIBOCTAVE) \
-    -L../libcruft $(LIBCRUFT) \
-    $(FFTW_LDFLAGS) $(FFTW_LIBS) \
-    $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) \
-    $(FT2_LDFLAGS) $(FT2_LIBS) \
-    $(HDF5_LDFLAGS) $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
-    $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
-    $(READLINE_LIBS) $(TERM_LIBS) \
-    $(LIBGLOB) \
-    $(BLAS_LIBS) \
-    $(FLIBS) \
-    $(LIBS)
-else
-  ## FIXME -- this list is probably not complete now.  It may not even
-  ## be possible to build a statically linked copy of Octave that is
-  ## fully functional.
-  OCTAVE_LIBS = -L. $(LIBOCTINTERP) \
-    -L../liboctave $(LIBOCTAVE) \
-    -L../libcruft $(LIBCRUFT) \
-    $(FFTW_LDFLAGS) $(FFTW_LIBS)
-    $(QHULL_LDFLAGS) $(QHULL_LIBS) \
-    $(ARPACK_LDFLAGS) $(ARPACK_LIBS) \
-    $(QRUPDATE_LDFLAGS) $(QRUPDATE_LIBS) \
-    $(SPARSE_LDFLAGS) $(SPARSE_LIBS) \
-    $(REGEX_LDFLAGS) $(REGEX_LIBS) \
-    $(CURL_LDFLAGS) $(CURL_LIBS) \
-    $(GLPK_LDFLAGS) $(GLPK_LIBS) \
-    $(MAGICK_LDFLAGS) $(MAGICK_LIBS) \
-    $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) \
-    $(FT2_LDFLAGS) $(FT2_LIBS) \
-    $(HDF5_LDFLAGS) $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
-    $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
-    $(READLINE_LIBS) $(TERM_LIBS) \
-    $(LIBGLOB) \
-    $(BLAS_LIBS) \
-    $(FLIBS) \
-    $(LIBS)
-endif
-
-OCTINTERP_LINK_DEPS = $(RLD_FLAG) -L../liboctave $(LIBOCTAVE) \
-  -L../libcruft $(LIBCRUFT) \
-  $(FFTW_LDFLAGS) $(FFTW_LIBS) \
-  $(HDF5_LDFLAGS) $(HDF5_LIBS) $(Z_LDFLAGS) $(Z_LIBS) \
-  $(OPENGL_LIBS) $(X11_LIBS) $(CARBON_LIBS) \
-  $(READLINE_LIBS) $(TERM_LIBS) \
-  $(LIBGLOB) \
-  $(BLAS_LIBS) \
-  $(FLIBS) \
-  $(LIBS)
-
-OCT_LINK_DEPS = $(RLD_FLAG) $(LDFLAGS) -L. $(LIBOCTINTERP) \
-  -L../liboctave $(LIBOCTAVE) \
-  -L../libcruft $(LIBCRUFT)
-
-BUILT_DISTFILES = DOCSTRINGS oct-gperf.h parse.cc lex.cc y.tab.h \
-	$(OPT_HANDLERS) $(BUILT_EXTRAS)
-
-DISTFILES = Makefile.in ChangeLog genprops.awk mkdefs mkops mkgendoc \
-	mkbuiltins mk-errno-list mk-pkg-add \
-	defaults.h.in graphics.h.in mxarray.h.in oct-conf.h.in \
-	oct-errno.cc.in octave.gperf \
-	$(INCLUDES) $(DIST_SRC) $(EXTRAS)
-
-all: octave$(EXEEXT) $(OCT_FILES) PKG_ADD DOCSTRINGS
-.PHONY: all
-
-objects: $(OBJECTS)
-
-lex.o parse.o pic/lex.o pic/parse.o: \
-	ALL_CXXFLAGS := $(filter-out -Wold-style-cast, $(ALL_CXXFLAGS))
-
-$(DLD_PICOBJ): \
-	ALL_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(ALL_CXXFLAGS))
-
-fltk_backend.o pic/fltk_backend.o: \
-	ALL_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(ALL_CXXFLAGS) $(GRAPHICS_CFLAGS))
-
-XERBLA = ../libcruft/blas-xtra/xerbla.o
-ifdef FPICFLAG
-  PIC_XERBLA = ../libcruft/blas-xtra/pic/xerbla.o
-else
-  PIC_XERBLA = $(XERBLA)
-endif
-
-ifeq ($(SHARED_LIBS), true)
-  ifeq ($(STATIC_LIBS), true)
-    LIBRARIES = $(LIBPRE)octinterp.$(LIBEXT) $(SHLPRE)octinterp.$(SHLEXT_VER)
-  else
-    LIBRARIES = $(SHLPRE)octinterp.$(SHLEXT_VER)
-  endif
-else
-  ifeq ($(STATIC_LIBS), true)
-    LIBRARIES = $(LIBPRE)octinterp.$(LIBEXT)
-  else
-    ## This is not going to work, but hey, you asked for it...
-    LIBRARIES =
-  endif
-endif
-
-libraries: $(LIBRARIES)
-.PHONY: libraries
-
-$(LIBPRE)octinterp.$(LIBEXT): $(OBJECTS) $(XERBLA)
-	rm -f $@
-	$(TEMPLATE_AR) $(TEMPLATE_ARFLAGS) $@ $^
-	$(RANLIB) $@
-
-$(SHLPRE)octinterp.$(SHLEXT_VER): $(SHLPRE)octinterp.$(SHLEXT)
-	rm -f $@
-	$(LN_S) $< $@
-
-$(SHLPRE)octinterp.$(SHLEXT): $(PICOBJ) $(PIC_XERBLA)
-	rm -f $@
-	$(SH_LD) $(SH_LDFLAGS) $(LDFLAGS) $(SONAME_FLAGS) -o $@ $^ $(OCTINTERP_LINK_DEPS)
-
-octave$(EXEEXT): $(LIBRARIES) main.o $(DLD_STATIC_OBJ)
-	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
-	$(ALL_LDFLAGS) -o $@ main.o $(DLD_STATIC_OBJ) \
-	$(RLD_FLAG) \
-	$(OCTAVE_LIBS)
-
-stmp-pic: pic
-	@if [ -f stmp-pic ]; then \
-	  true; \
-	else \
-	  echo "touch stmp-pic"; \
-	  touch stmp-pic; \
-	fi
-
-pic:
-	@if [ -d pic ]; then \
-	  true; \
-	else \
-	  echo "mkdir pic"; \
-	  mkdir pic; \
-	fi
-
-$(PICOBJ): stmp-pic
-
-builtins.cc: $(DEF_FILES) mkbuiltins
-	@echo making $@
-	@echo DEF_FILES = $(DEF_FILES)
-	@echo $(DEF_FILES) > def-files
-	@$(srcdir)/mkbuiltins def-files > $@-t
-	@mv $@-t $@
-
-## FIXME -- maybe genprops.awk should write both output files?
-## Or maybe there should be separate commands to generate each file?
-graphics.h graphics-props.cc: graphics.h.in genprops.awk
-	@echo making graphics.h and graphics-props.cc
-	@$(AWK) -f $(srcdir)/genprops.awk $< > graphics.h-t
-	@mv graphics.h-t graphics.h
-
-PKG_ADD: $(DLD_DEF_FILES)
-	$(srcdir)/mk-pkg-add $(DLD_DEF_FILES) > $@-t
-	@mv $@-t $@
-
-DOCSTRINGS: gendoc$(BUILD_EXEEXT)
-	@echo making $@
-	@./gendoc > $@-t
-	@mv $@-t $@
-
-doc-files: $(DOC_FILES)
-	@echo making $@
-	@echo DOC_FILES = $(DOC_FILES)
-	@echo $(DOC_FILES) > $@-t
-	mv $@-t $@
-
-gendoc.cc: doc-files mkgendoc
-	@echo making $@
-	@$(srcdir)/mkgendoc doc-files > $@-t
-	@mv $@-t $@
-
-gendoc$(BUILD_EXEEXT): gendoc.cc
-	$(BUILD_CXX) $(BUILD_CXXFLAGS) -o $@ $^ $(BUILD_LDFLAGS)
-
-ops.cc: $(OP_SRC) mkops
-	@echo making $@ from $(OP_SRC)
-	@$(srcdir)/mkops $(OP_SRC) > $@-t
-	@mv $@-t $@
-
-PREREQ := defaults.h graphics.h oct-conf.h oct-errno.cc oct-gperf.h parse.cc lex.cc 
-
-$(DEF_FILES): $(OPT_INC) mkdefs 
-
-ifndef omit_deps
-$(MAKEDEPS): $(OPT_INC) $(OPT_HANDLERS) $(PREREQ)
-endif
-
-check: all
-.PHONY: check
-
-install: install-bin install-oct install-lib install-inc
-.PHONY: install
-
-install-strip:
-	$(MAKE) INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s" install
-.PHONY: install-strip
-
-install-bin:
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
-	rm -f $(DESTDIR)$(bindir)/octave$(EXEEXT)
-	$(INSTALL_PROGRAM) octave$(EXEEXT) $(DESTDIR)$(bindir)/octave-$(version)$(EXEEXT)
-	cd $(DESTDIR)$(bindir) ; $(LN_S) octave-$(version)$(EXEEXT) octave$(EXEEXT)
-.PHONY: install-bin
-
-install-oct:
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octfiledir)
-	$(INSTALL_DATA) PKG_ADD $(DESTDIR)$(octfiledir)/PKG_ADD
-	if [ -n "$(OCT_FILES)" ]; then \
-	  xfiles="$(OCT_FILES)"; \
-	  for f in $$xfiles; do \
-	    $(INSTALL_PROGRAM) $$f $(DESTDIR)$(octfiledir)/$$f; \
-	  done; \
-	fi
-.PHONY: install-oct
-
-install-lib:
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octlibdir)
-	if $(STATIC_LIBS); then \
-	  rm -f $(DESTDIR)$(octlibdir)/$(LIBPRE)octinterp.$(LIBEXT); \
-	  $(INSTALL_DATA) $(LIBPRE)octinterp.$(LIBEXT) \
-	    $(DESTDIR)$(octlibdir)/$(LIBPRE)octinterp.$(LIBEXT); \
-	  $(RANLIB) $(DESTDIR)$(octlibdir)/$(LIBPRE)octinterp.$(LIBEXT); \
-	fi
-	if $(SHARED_LIBS); then \
-	  rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octinterp.$(SHLLIB_VER); \
-	  $(INSTALL) $(SHLLIBPRE)octinterp.$(SHLLIB) \
-	    $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octinterp.$(SHLLIB_VER); \
-	  rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octinterp.$(SHLLIB); \
-	  (cd $(DESTDIR)$(octlibdir) ; $(LN_S) $(SHLLIBPRE)octinterp.$(SHLLIB_VER) $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octinterp.$(SHLLIB)); \
-	  if  test x$(SHLBIN) != x ; then \
-	    rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)octinterp.$(SHLBIN); \
-	    $(INSTALL_PROGRAM) \
-	      $(SHLBINPRE)octinterp.$(SHLBIN) $(DESTDIR)$(bindir)/$(SHLBINPRE)octinterp.$(SHLBIN); \
-	  fi; \
-	fi
-.PHONY: install-lib
-
-install-inc:
-	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octincludedir)/octave
-	for f in $(INCLUDES_FOR_INSTALL); do \
-	  rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  if [ -f $$f ]; then \
-	    $(INSTALL_DATA) $$f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  else \
-	    $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  fi ; \
-	done
-	for f in defaults.h oct-conf.h oct-gperf.h; do \
-	  rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	  if [ -f $$f ]; then \
-	    $(INSTALL_DATA) $$f $(DESTDIR)$(octincludedir)/octave/$$f ; \
-	  else \
-	    $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(octincludedir)/octave/$$f ; \
-	  fi ; \
-	done
-.PHONY: install-inc
-
-uninstall:
-	rm -f $(DESTDIR)$(bindir)/octave$(EXEEXT)
-	rm -f $(DESTDIR)$(bindir)/octave-$(version)$(EXEEXT)
-	rm -f $(DESTDIR)$(octlibdir)/$(LIBPRE)octinterp.$(LIBEXT)
-	rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octinterp.$(SHLLIB)
-	rm -f $(DESTDIR)$(octlibdir)/$(SHLLIBPRE)octinterp.$(SHLLIB_VER)
-	if test x$(SHLBIN) != x ; then \
-	  rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)octinterp.$(SHLBIN); \
-	  rm -f $(DESTDIR)$(bindir)/$(SHLBINPRE)octinterp.$(SHLBIN_VER); \
-	fi
-	for f in $(INCLUDES_FOR_INSTALL) defaults.h oct-conf.h oct-gperf.h; do \
-	  rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \
-	done
-	if [ -n "$(OCT_FILES)" ]; then \
-	  xfiles="$(OCT_FILES)"; \
-	  for f in $$xfiles; do \
-	    rm -f $(DESTDIR)$(octfiledir)/$$f; \
-	  done; \
-	fi
-	rm -f $(DESTDIR)$(octfiledir)/PKG_ADD
-	-rmdir $(DESTDIR)$(octincludedir)/octave
-	-rmdir $(DESTDIR)$(octincludedir)
-	-rmdir $(DESTDIR)$(octlibdir)
-	-rmdir $(DESTDIR)$(octfiledir)
-.PHONY: uninstall
-
-tags: $(SOURCES) $(DLD_SRC)
-	ctags $(SOURCES) $(DLD_SRC)
-
-TAGS: $(SOURCES) $(DLD_SRC)
-	etags $(SOURCES) $(DLD_SRC)
-
-clean:
-	rm -f $(LIBPRE)octinterp.$(LIBEXT)
-	rm -f $(SHLPRE)octinterp.$(SHLEXT_VER) $(SHLPRE)octinterp.$(SHLEXT)
-	rm -f $(SHLBINPRE)octinterp.$(SHLBIN_VER) $(SHLBINPRE)octinterp.$(SHLBIN)
-	rm -f $(OBJECTS) $(DLD_OBJ) $(MAKEDEPS) $(DOC_FILES) $(OCT_FILES)
-	rm -f $(PICOBJ) $(DLD_PICOBJ) stmp-pic gendoc$(EXEEXT)
-	rm -f builtins.cc ops.cc defaults.h oct-conf.h def-files
-	rm -f PKG_ADD
-	-rmdir pic
-.PHONY: clean
-
-mostlyclean: clean
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile octave$(EXEEXT) .fname so_locations oct-errno.cc
-	rm -f tags TAGS y.output yy.lex.c parse.output
-	rm -f stamp-liboctave-prereq
-	rm -f doc-files gendoc.cc graphics.h graphics-props.cc mxarray.h DOCSTRINGS
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f lex.cc parse.cc y.tab.h
-	rm -f oct-gperf.h $(OPT_HANDLERS)
-.PHONY: maintainer-clean
-
-dist: parse.cc lex.cc oct-gperf.h
-	ln $(addprefix $(srcdir)/, $(DISTFILES)) ../`cat ../.fname`/src
-	ln $(BUILT_DISTFILES) ../`cat ../.fname`/src
-	for f in DLD-FUNCTIONS OPERATORS TEMPLATE-INST; do \
-	  if [ -d ../`cat ../.fname`/src/$$f ]; then \
-	    true; \
-	  else \
-	    mkdir ../`cat ../.fname`/src/$$f; \
-	  fi; \
-	done
-	ln $(addprefix $(srcdir)/, $(DLD_SRC)) ../`cat ../.fname`/src/DLD-FUNCTIONS
-	ln $(addprefix $(srcdir)/, $(OP_SRC)) ../`cat ../.fname`/src/OPERATORS
-	ln $(addprefix $(srcdir)/, $(OP_INCLUDES)) ../`cat ../.fname`/src/OPERATORS
-	ln $(addprefix $(srcdir)/, $(TI_SRC)) ../`cat ../.fname`/src/TEMPLATE-INST
-	rm -f parse.cc lex.cc y.tab.h y.output yy.lex.c
-	rm -f oct-gperf.h defaults.h oct-conf.h *.d *.df builtins.cc
-.PHONY: dist
-
-conf-dist:
-	ln $(addprefix $(srcdir)/, octave.cc Makefile.in) ../`cat ../.fname`/src
-.PHONY: conf-dist
-
-# Special rules -- these files need special things to be defined.
-
-$(OPT_HANDLERS) : %.cc : $(top_srcdir)/liboctave/%.in $(top_srcdir)/mk-opts.pl
-	@echo making $@ from $<
-	@$(PERL) $(top_srcdir)/mk-opts.pl --opt-handler-fcns $< > $@-t
-	@mv $@-t $@
-
-## We require Bison.
-parse.cc : parse.y
-	@echo "expect 14 shift/reduce conflicts"
-	$(YACC) $(YFLAGS) --output=$@ --defines=y.tab.h $<
-
-lex.cc : lex.l
-	$(LEX) $(LFLAGS) $< > $(@F)-t
-	@mv $(@F)-t $@
-
-
-$(OPT_INC) : %.h : %.in
-	$(MAKE) -C $(@D) $@
-
-## We want to force an update of defaults.h and oct-conf.h every
-## time make is run because some values may come from the command
-## line or the environment.  The substitution rules use move-if-change,
-## so this should not cause trouble if the file already exists and the
-## newly generated file is not different.
-
-defaults.h: defaults.h.in ../Makeconf Makefile FORCE
-	@$(do-subst-default-vals)
-
-oct-conf.h: oct-conf.h.in ../Makeconf Makefile FORCE
-	@$(do-subst-config-vals)
-
-FORCE:
-.PHONY: FORCE
-
-oct-errno.cc: oct-errno.cc.in ../Makeconf Makefile
-	@echo "making $@ from $<"
-	@if test -n "$(PERL)"; then \
-	  $(srcdir)/mk-errno-list --perl "$(PERL)" < $< > $@-t; \
-	elif test -n "$(PYTHON)"; then \
-	  $(srcdir)/mk-errno-list --python "$(PYTHON)" < $< > $@-t; \
-	else \
-	  $(SED) '/@SYSDEP_ERRNO_LIST@/D' $< > $@-t; \
-	fi
-	@mv $@-t $@
-
-## Don't use a pipeline to process gperf output since if gperf
-## is missing but sed is not, the exit status of the pipeline
-## will still be success and we will end up creating an empty
-## oct-gperf.h file.
-oct-gperf.h: octave.gperf
-	$(GPERF) -t -C -D -G -L C++ -Z octave_kw_hash $< > $@-t1
-	$(SED) 's,lookup\[,gperf_lookup[,' < $@-t1 > $@-t2
-	mv $@-t2 $@
-	rm -f $@-t1
-
-display.d display.df display.o pic/display.o: CPPFLAGS += $(X11_FLAGS)
-
-__magick_read__.d __magick_read__.df __magick_read__.o pic/__magick_read__.o: \
-  CPPFLAGS += $(MAGICK_CPPFLAGS)
-__magick_read__.oct: OCT_LINK_DEPS += $(MAGICK_LDFLAGS) $(MAGICK_LIBS)
-
-convhull.d convhull.df convhull.o pic/convhull.o: CPPFLAGS += $(QHULL_CPPFLAGS)
-convhulln.oct: OCT_LINK_DEPS += $(QHULL_LDFLAGS) $(QHULL_LIBS)
-
-__delaunayn__.d __delaunayn__.df __delaunayn__.o pic/__delaunayn__.o: \
-  CPPFLAGS += $(QHULL_CPPFLAGS)
-__delaunayn__.oct: OCT_LINK_DEPS += $(QHULL_LDFLAGS) $(QHULL_LIBS)
-
-__voronoi__.d __voronoi__.df __voronoi__.o pic/__voronoi__.o: \
-  CPPFLAGS += $(QHULL_CPPFLAGS)
-__voronoi__.oct: OCT_LINK_DEPS += $(QHULL_LDFLAGS) $(QHULL_LIBS)
-
-eigs.d eigs.df eigs.o pic/eigs.o:
-  CPPFLAGS += $(ARPACK_CPPFLAGS) $(SPARSE_CPPFLAGS)
-eigs.oct: \
-  OCT_LINK_DEPS += $(ARPACK_LDFLAGS) $(ARPACK_LIBS) \
-    $(SPARSE_LDFLAGS) $(SPARSE_LIBS) $(BLAS_LIBS)
-
-qz.d qz.df qz.o pic/qz.o:
-qz.oct: OCT_LINK_DEPS += $(BLAS_LIBS)
-
-qr.d qr.df qr.o pic/qr.o: \
-  CPPFLAGS += $(QRUPDATE_CPPFLAGS) $(SPARSE_CPPFLAGS)
-qr.oct: \
-  OCT_LINK_DEPS += $(QRUPDATE_LDFLAGS) $(QRUPDATE_LIBS) \
-    $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-chol.d chol.df chol.o pic/chol.o:
-  CPPFLAGS += $(QRUPDATE_CPPFLAGS) $(SPARSE_CPPFLAGS)
-chol.oct: \
-  OCT_LINK_DEPS += $(QRUPDATE_LDFLAGS) $(QRUPDATE_LIBS) \
-    $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-regexp.d regexp.df regexp.o pic/regexp.o: CPPFLAGS += $(REGEX_CPPFLAGS)
-regexp.oct: OCT_LINK_DEPS += $(REGEX_LDFLAGS) $(REGEX_LIBS)
-
-urlwrite.d urlwrite.df urlwrite.o pic/urlwrite.o: CPPFLAGS += $(CURL_CPPFLAGS)
-urlwrite.oct: OCT_LINK_DEPS += $(CURL_LDFLAGS) $(CURL_LIBS)
-
-__glpk__.d __glpk__.df __glpk__.o pic/__glpk__.o: CPPFLAGS += $(GLPK_CPPFLAGS)
-__glpk__.oct: OCT_LINK_DEPS += $(GLPK_LDFLAGS) $(GLPK_LIBS)
-
-fltk_backend.d fltk_backend.df fltk_backend.o pic/fltk_backend.o: \
-  CPPFLAGS += $(GRAPHICS_CPPFLAGS) $(FT2_CPPFLAGS)
-fltk_backend.oct: \
-  OCT_LINK_DEPS += $(GRAPHICS_LDFLAGS) $(GRAPHICS_LIBS) \
-    $(FT2_LDFLAGS) $(FT2_LIBS)
-
-amd.d amd.df pic/amd.o amd.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-amd.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-colamd.d colamd.df pic/colamd.o colamd.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-colamd.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-ccolamd.d ccolamd.df pic/ccolamd.o ccolamd.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-ccolamd.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-symbfact.d symbfact.df pic/symbfact.o symbfact.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-symbfact.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-dmperm.d dmperm.df pic/dmperm.o dmperm.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-dmperm.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-symrcm.d symrcm.df pic/symrcm.o symrcm.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-symrcm.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-qr.d qr.df pic/qr.o qr.o: CPPFLAGS += $(SPARSE_CPPFLAGS)
-qr.oct: OCT_LINK_DEPS += $(SPARSE_LDFLAGS) $(SPARSE_LIBS)
-
-fft.d fft.df pic/fft.o fft.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-fft.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS)
-
-fft2.d fft2.df pic/fft2.o fft2.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-fft2.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS)
-
-fftn.d fftn.df pic/fftn.o fftn.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-fftn.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS)
-
-fftw.d fftw.df pic/fftw.o fftw.o: CPPFLAGS += $(FFTW_CPPFLAGS)
-fftw.oct: OCT_LINK_DEPS += $(FFTW_LDFLAGS) $(FFTW_LIBS)
-
-pcheck: all
-.PHONY: check
-
-ifdef omit_deps
-.PHONY: $(MAKEDEPS)
-endif
-
--include $(MAKEDEPS)
new file mode 100644
--- /dev/null
+++ b/src/OPERATORS/module.mk
@@ -0,0 +1,136 @@
+EXTRA_DIST += OPERATORS/module.mk
+
+OPERATORS_SRC = \
+  OPERATORS/op-b-b.cc \
+  OPERATORS/op-b-bm.cc \
+  OPERATORS/op-b-sbm.cc \
+  OPERATORS/op-bm-b.cc \
+  OPERATORS/op-bm-bm.cc \
+  OPERATORS/op-bm-sbm.cc \
+  OPERATORS/op-cdm-cdm.cc \
+  OPERATORS/op-cdm-cm.cc \
+  OPERATORS/op-cdm-cs.cc \
+  OPERATORS/op-cdm-dm.cc \
+  OPERATORS/op-cdm-m.cc \
+  OPERATORS/op-cdm-s.cc \
+  OPERATORS/op-cell.cc \
+  OPERATORS/op-chm.cc \
+  OPERATORS/op-class.cc \
+  OPERATORS/op-cm-cdm.cc \
+  OPERATORS/op-cm-cm.cc \
+  OPERATORS/op-cm-cs.cc \
+  OPERATORS/op-cm-dm.cc \
+  OPERATORS/op-cm-m.cc \
+  OPERATORS/op-cm-pm.cc \
+  OPERATORS/op-cm-s.cc \
+  OPERATORS/op-cm-scm.cc \
+  OPERATORS/op-cm-sm.cc \
+  OPERATORS/op-cs-cm.cc \
+  OPERATORS/op-cs-cs.cc \
+  OPERATORS/op-cs-m.cc \
+  OPERATORS/op-cs-s.cc \
+  OPERATORS/op-cs-scm.cc \
+  OPERATORS/op-cs-sm.cc \
+  OPERATORS/op-dm-cdm.cc \
+  OPERATORS/op-dm-cm.cc \
+  OPERATORS/op-dm-cs.cc \
+  OPERATORS/op-dm-dm.cc \
+  OPERATORS/op-dm-m.cc \
+  OPERATORS/op-dm-s.cc \
+  OPERATORS/op-dm-scm.cc \
+  OPERATORS/op-dm-sm.cc \
+  OPERATORS/op-double-conv.cc \
+  OPERATORS/op-fcdm-fcdm.cc \
+  OPERATORS/op-fcdm-fcm.cc \
+  OPERATORS/op-fcdm-fcs.cc \
+  OPERATORS/op-fcdm-fdm.cc \
+  OPERATORS/op-fcdm-fm.cc \
+  OPERATORS/op-fcdm-fs.cc \
+  OPERATORS/op-fcm-fcdm.cc \
+  OPERATORS/op-fcm-fcm.cc \
+  OPERATORS/op-fcm-fcs.cc \
+  OPERATORS/op-fcm-fdm.cc \
+  OPERATORS/op-fcm-fm.cc \
+  OPERATORS/op-fcm-fs.cc \
+  OPERATORS/op-fcm-pm.cc \
+  OPERATORS/op-fcs-fcm.cc \
+  OPERATORS/op-fcs-fcs.cc \
+  OPERATORS/op-fcs-fm.cc \
+  OPERATORS/op-fcs-fs.cc \
+  OPERATORS/op-fdm-fcdm.cc \
+  OPERATORS/op-fdm-fcm.cc \
+  OPERATORS/op-fdm-fcs.cc \
+  OPERATORS/op-fdm-fdm.cc \
+  OPERATORS/op-fdm-fm.cc \
+  OPERATORS/op-fdm-fs.cc \
+  OPERATORS/op-float-conv.cc \
+  OPERATORS/op-fm-fcdm.cc \
+  OPERATORS/op-fm-fcm.cc \
+  OPERATORS/op-fm-fcs.cc \
+  OPERATORS/op-fm-fdm.cc \
+  OPERATORS/op-fm-fm.cc \
+  OPERATORS/op-fm-fs.cc \
+  OPERATORS/op-fm-pm.cc \
+  OPERATORS/op-fs-fcm.cc \
+  OPERATORS/op-fs-fcs.cc \
+  OPERATORS/op-fs-fm.cc \
+  OPERATORS/op-fs-fs.cc \
+  OPERATORS/op-i16-i16.cc \
+  OPERATORS/op-i32-i32.cc \
+  OPERATORS/op-i64-i64.cc \
+  OPERATORS/op-i8-i8.cc \
+  OPERATORS/op-int-concat.cc \
+  OPERATORS/op-int-conv.cc \
+  OPERATORS/op-list.cc \
+  OPERATORS/op-m-cdm.cc \
+  OPERATORS/op-m-cm.cc \
+  OPERATORS/op-m-cs.cc \
+  OPERATORS/op-m-dm.cc \
+  OPERATORS/op-m-m.cc \
+  OPERATORS/op-m-pm.cc \
+  OPERATORS/op-m-s.cc \
+  OPERATORS/op-m-scm.cc \
+  OPERATORS/op-m-sm.cc \
+  OPERATORS/op-pm-cm.cc \
+  OPERATORS/op-pm-fcm.cc \
+  OPERATORS/op-pm-fm.cc \
+  OPERATORS/op-pm-m.cc \
+  OPERATORS/op-pm-pm.cc \
+  OPERATORS/op-pm-scm.cc \
+  OPERATORS/op-pm-sm.cc \
+  OPERATORS/op-range.cc \
+  OPERATORS/op-s-cm.cc \
+  OPERATORS/op-s-cs.cc \
+  OPERATORS/op-s-m.cc \
+  OPERATORS/op-s-s.cc \
+  OPERATORS/op-s-scm.cc \
+  OPERATORS/op-s-sm.cc \
+  OPERATORS/op-sbm-b.cc \
+  OPERATORS/op-sbm-bm.cc \
+  OPERATORS/op-sbm-sbm.cc \
+  OPERATORS/op-scm-cm.cc \
+  OPERATORS/op-scm-cs.cc \
+  OPERATORS/op-scm-m.cc \
+  OPERATORS/op-scm-s.cc \
+  OPERATORS/op-scm-scm.cc \
+  OPERATORS/op-scm-sm.cc \
+  OPERATORS/op-sm-cm.cc \
+  OPERATORS/op-sm-cs.cc \
+  OPERATORS/op-sm-m.cc \
+  OPERATORS/op-sm-s.cc \
+  OPERATORS/op-sm-scm.cc \
+  OPERATORS/op-sm-sm.cc \
+  OPERATORS/op-str-m.cc \
+  OPERATORS/op-str-s.cc \
+  OPERATORS/op-str-str.cc \
+  OPERATORS/op-struct.cc \
+  OPERATORS/op-ui16-ui16.cc \
+  OPERATORS/op-ui32-ui32.cc \
+  OPERATORS/op-ui64-ui64.cc \
+  OPERATORS/op-ui8-ui8.cc
+
+octinclude_HEADERS += \
+  OPERATORS/op-dm-template.cc \
+  OPERATORS/op-dms-template.cc \
+  OPERATORS/op-int.h \
+  OPERATORS/op-pm-template.cc
new file mode 100644
--- /dev/null
+++ b/src/TEMPLATE-INST/module.mk
@@ -0,0 +1,5 @@
+EXTRA_DIST += TEMPLATE-INST/module.mk
+
+TEMPLATE_INST_SRC = \
+  TEMPLATE-INST/Array-os.cc \
+  TEMPLATE-INST/Array-tc.cc
new file mode 100755
--- /dev/null
+++ b/src/find-defun-files.sh
@@ -0,0 +1,23 @@
+#! /bin/sh
+
+set -e
+
+# Some stupid egreps don't like empty elements in alternation patterns,
+# so we have to repeat ourselves because some stupid egreps don't like
+# empty elements in alternation patterns.
+
+DEFUN_PATTERN="^[ \t]*DEF(CONSTFUN|CMD|UN|UN_DLD|UNX_DLD|UN_TEXT)[ \t]*\\("
+
+srcdir="$1"
+shift
+
+for arg
+do
+  file=`echo "$arg" | sed 's/\.ll$/.cc/; s/\.yy$/.cc/'`;
+  if [ ! -f $file ]; then
+    file="$srcdir/$file"
+  fi
+  if [ "`egrep -l "$DEFUN_PATTERN" $file`" ]; then
+    echo "$file" | sed 's/\.cc$/.df/';
+  fi
+done
rename from src/lex.l
rename to src/lex.ll
--- a/src/lex.l
+++ b/src/lex.ll
@@ -76,7 +76,7 @@
 #include "toplev.h"
 #include "utils.h"
 #include "variables.h"
-#include <y.tab.h>
+#include <oct-parse.h>
 #include <oct-gperf.h>
 
 #if ! (defined (FLEX_SCANNER) \
--- a/src/mkbuiltins
+++ b/src/mkbuiltins
@@ -87,7 +87,7 @@
 EOF
 
 for file in $DEF_FILES; do
-  fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'`
+  fcn=`echo $file | $SED 's,.*/,,; s/\.df//; s/-/_/g;'`
   echo "static void"
   echo "install_${fcn}_fcns (void)"
   echo "{"
@@ -104,7 +104,7 @@
 EOF
 
 for file in $DEF_FILES; do
-  fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'`
+  fcn=`echo $file | $SED 's,.*/,,; s/\.df//; s/-/_/g;'`
   echo "  install_${fcn}_fcns ();"
 done
 
--- a/src/mkgendoc
+++ b/src/mkgendoc
@@ -89,7 +89,7 @@
 EOF
 
 for file in $DOC_FILES; do
-  fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'`
+  fcn=`echo $file | $SED 's,.*/,,; s/\.df//; s/-/_/g;'`
   echo "static void"
   echo "print_${fcn}_doc_strings (void)"
   echo "{"
@@ -113,7 +113,7 @@
 EOF
 
 for file in $DOC_FILES; do
-  fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'`
+  fcn=`echo $file | $SED 's,.*/,,; s/\.df//; s/-/_/g;'`
   echo "  print_${fcn}_doc_strings ();"
 done
 
--- a/src/oct-conf.h.in
+++ b/src/oct-conf.h.in
@@ -309,6 +309,10 @@
 #define OCTAVE_CONF_INCLUDEDIR %OCTAVE_CONF_INCLUDEDIR%
 #endif
 
+#ifndef OCTAVE_CONF_LAPACK_LIBS
+#define OCTAVE_CONF_LAPACK_LIBS %OCTAVE_CONF_LAPACK_LIBS%
+#endif
+
 #ifndef OCTAVE_CONF_LDFLAGS
 #define OCTAVE_CONF_LDFLAGS %OCTAVE_CONF_LDFLAGS%
 #endif
rename from src/parse.y
rename to src/oct-parse.yy
--- a/src/toplev.cc
+++ b/src/toplev.cc
@@ -1262,6 +1262,7 @@
       { false, "HDF5_LDFLAGS", OCTAVE_CONF_HDF5_LDFLAGS },
       { false, "HDF5_LIBS", OCTAVE_CONF_HDF5_LIBS },
       { false, "INCFLAGS", OCTAVE_CONF_INCFLAGS },
+      { false, "LAPACK_LIBS", OCTAVE_CONF_LAPACK_LIBS },
       { false, "LDFLAGS", OCTAVE_CONF_LDFLAGS },
       { false, "LD_CXX", OCTAVE_CONF_LD_CXX },
       { false, "LD_STATIC_FLAG", OCTAVE_CONF_LD_STATIC_FLAG },
deleted file mode 100644
--- a/src/version.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-
-Copyright (C) 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001,
-              2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-              John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#if !defined (octave_version_h)
-#define octave_version_h 1
-
-#define OCTAVE_VERSION "3.3.50+"
-
-#define OCTAVE_API_VERSION "api-v38+"
-
-#define OCTAVE_RELEASE_DATE "2009-09-12n"
-
-#define OCTAVE_COPYRIGHT "Copyright (C) 2009 John W. Eaton and others."
-
-// This is the first line printed by --version.  The GNU coding
-// standards say that the version number should follow the last space
-// on the line.
-
-#define OCTAVE_NAME_AND_VERSION "GNU Octave, version " OCTAVE_VERSION
-
-#define OCTAVE_CONFIG_STATEMENT \
-  "Octave was configured for \"" OCTAVE_CANONICAL_HOST_TYPE "\"."
-
-#define OCTAVE_COPYING_STATEMENT \
-  "This is free software; see the source code for copying conditions."
-
-#define X_OCTAVE_WARRANTY_STATEMENT(ARG) \
-  "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or\n\
-FITNESS FOR A PARTICULAR PURPOSE." ARG
-
-#define OCTAVE_WARRANTY_STATEMENT \
-  X_OCTAVE_WARRANTY_STATEMENT ("")
-
-#define OCTAVE_WWW_STATEMENT \
-  "Additional information about Octave is available at http://www.octave.org."
-
-#define OCTAVE_CONTRIB_STATEMENT \
-  "Please contribute if you find this software useful.\n\
-For more information, visit http://www.octave.org/help-wanted.html"
-
-#define OCTAVE_BUGS_STATEMENT \
-  "Report bugs to <bug@octave.org> (but first, please read\n\
-http://www.octave.org/bugs.html to learn how to write a helpful report)."
-
-#define OCTAVE_NAME_VERSION_AND_COPYRIGHT \
-  OCTAVE_NAME_AND_VERSION "\n" \
-  OCTAVE_COPYRIGHT
-
-#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY("") \
-
-#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) \
-  OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n" \
-  OCTAVE_COPYING_STATEMENT "\n" \
-  X_OCTAVE_WARRANTY_STATEMENT (ARG) "\n\n" \
-  OCTAVE_CONFIG_STATEMENT
-
-#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS(ARG) \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) "\n\n" \
-  OCTAVE_WWW_STATEMENT "\n\n" \
-  OCTAVE_CONTRIB_STATEMENT "\n\n" \
-  OCTAVE_BUGS_STATEMENT
-
-#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS ("")
-
-#define OCTAVE_STARTUP_MESSAGE \
-  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \
-    ("  For details, type `warranty'.") "\n\n" \
-  "For information about changes from previous versions, type `news'."
-
-#endif
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
new file mode 100644
--- /dev/null
+++ b/src/version.h.in
@@ -0,0 +1,99 @@
+/*
+
+Copyright (C) 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001,
+              2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+              John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if !defined (octave_version_h)
+#define octave_version_h 1
+
+#define OCTAVE_VERSION "@OCTAVE_VERSION@"
+
+#define OCTAVE_API_VERSION "@OCTAVE_API_VERSION@"
+
+#define OCTAVE_RELEASE_DATE "@OCTAVE_RELEASE_DATE@"
+
+#define OCTAVE_COPYRIGHT "@OCTAVE_COPYRIGHT@"
+
+// This is the first line printed by --version.  The GNU coding
+// standards say that the version number should follow the last space
+// on the line.
+
+#define OCTAVE_NAME_AND_VERSION "GNU Octave, version " OCTAVE_VERSION
+
+#define OCTAVE_CONFIG_STATEMENT \
+  "Octave was configured for \"" OCTAVE_CANONICAL_HOST_TYPE "\"."
+
+#define OCTAVE_COPYING_STATEMENT \
+  "This is free software; see the source code for copying conditions."
+
+#define X_OCTAVE_WARRANTY_STATEMENT(ARG) \
+  "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or\n\
+FITNESS FOR A PARTICULAR PURPOSE." ARG
+
+#define OCTAVE_WARRANTY_STATEMENT \
+  X_OCTAVE_WARRANTY_STATEMENT ("")
+
+#define OCTAVE_WWW_STATEMENT \
+  "Additional information about Octave is available at http://www.octave.org."
+
+#define OCTAVE_CONTRIB_STATEMENT \
+  "Please contribute if you find this software useful.\n\
+For more information, visit http://www.octave.org/help-wanted.html"
+
+#define OCTAVE_BUGS_STATEMENT \
+  "Report bugs to <bug@octave.org> (but first, please read\n\
+http://www.octave.org/bugs.html to learn how to write a helpful report)."
+
+#define OCTAVE_NAME_VERSION_AND_COPYRIGHT \
+  OCTAVE_NAME_AND_VERSION "\n" \
+  OCTAVE_COPYRIGHT
+
+#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY \
+  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY("") \
+
+#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) \
+  OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n" \
+  OCTAVE_COPYING_STATEMENT "\n" \
+  X_OCTAVE_WARRANTY_STATEMENT (ARG) "\n\n" \
+  OCTAVE_CONFIG_STATEMENT
+
+#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS(ARG) \
+  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) "\n\n" \
+  OCTAVE_WWW_STATEMENT "\n\n" \
+  OCTAVE_CONTRIB_STATEMENT "\n\n" \
+  OCTAVE_BUGS_STATEMENT
+
+#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \
+  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS ("")
+
+#define OCTAVE_STARTUP_MESSAGE \
+  X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \
+    ("  For details, type `warranty'.") "\n\n" \
+  "For information about changes from previous versions, type `news'."
+
+#endif
+
+/*
+;;; Local Variables: ***
+;;; mode: C++ ***
+;;; End: ***
+*/
new file mode 100644
--- /dev/null
+++ b/test/@Blork/module.mk
@@ -0,0 +1,10 @@
+FCN_FILE_DIRS += @Blork
+
+at_Blork_FCN_FILES = \
+  @Blork/Blork.m \
+  @Blork/bleek.m \
+  @Blork/display.m \
+  @Blork/get.m \
+  @Blork/set.m
+
+FCN_FILES += $(at_Blork_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/test/@Cork/module.mk
@@ -0,0 +1,10 @@
+FCN_FILE_DIRS += @Cork
+
+at_Cork_FCN_FILES = \
+  @Cork/Cork.m \
+  @Cork/click.m \
+  @Cork/display.m \
+  @Cork/get.m \
+  @Cork/set.m
+
+FCN_FILES += $(at_Cork_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/test/@Dork/module.mk
@@ -0,0 +1,12 @@
+FCN_FILE_DIRS += @Dork
+
+at_Dork_FCN_FILES = \
+  @Dork/Dork.m \
+  @Dork/bling.m \
+  @Dork/display.m \
+  @Dork/gack.m \
+  @Dork/get.m \
+  @Dork/getStash.m \
+  @Dork/set.m
+
+FCN_FILES += $(at_Dork_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/test/@Gork/module.mk
@@ -0,0 +1,13 @@
+FCN_FILE_DIRS += @Gork
+
+at_Gork_FCN_FILES = \
+  @Gork/Gork.m \
+  @Gork/cork.m \
+  @Gork/display.m \
+  @Gork/gark.m \
+  @Gork/get.m \
+  @Gork/set.m \
+  @Gork/subsasgn.m \
+  @Gork/subsref.m
+
+FCN_FILES += $(at_Gork_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/test/@Pork/module.mk
@@ -0,0 +1,11 @@
+FCN_FILE_DIRS += @Pork
+
+at_Pork_FCN_FILES = \
+  @Pork/Pork.m \
+  @Pork/bling.m \
+  @Pork/display.m \
+  @Pork/get.m \
+  @Pork/gurk.m \
+  @Pork/set.m
+
+FCN_FILES += $(at_Pork_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/test/@Sneetch/module.mk
@@ -0,0 +1,7 @@
+FCN_FILE_DIRS += @Sneetch
+
+at_Sneetch_FCN_FILES = \
+  @Sneetch/Sneetch.m \
+  @Sneetch/display.m
+
+FCN_FILES += $(at_Sneetch_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/test/@Snork/module.mk
@@ -0,0 +1,18 @@
+FCN_FILE_DIRS += @Snork
+
+at_Snork_FCN_FILES = \
+  @Snork/Snork.m \
+  @Snork/cack.m \
+  @Snork/display.m \
+  @Snork/end.m \
+  @Snork/get.m \
+  @Snork/getStash.m \
+  @Snork/gick.m \
+  @Snork/loadobj.m \
+  @Snork/saveobj.m \
+  @Snork/set.m \
+  @Snork/subsasgn.m \
+  @Snork/subsindex.m \
+  @Snork/subsref.m
+
+FCN_FILES += $(at_Snork_FCN_FILES)
new file mode 100644
--- /dev/null
+++ b/test/@Spork/module.mk
@@ -0,0 +1,14 @@
+FCN_FILE_DIRS += @Spork
+
+at_Spork_FCN_FILES = \
+  @Spork/Spork.m \
+  @Spork/cack.m \
+  @Spork/display.m \
+  @Spork/geek.m \
+  @Spork/get.m \
+  @Spork/getStash.m \
+  @Spork/loadobj.m \
+  @Spork/saveobj.m \
+  @Spork/set.m
+
+FCN_FILES += $(at_Spork_FCN_FILES)
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-10  John W. Eaton  <jwe@octave.org>
+
+	* @Blork/module.mk, @Cork/module.mk, @Dork/module.mk,
+	@Gork/module.mk, @Pork/module.mk, @Sneetch/module.mk,
+	@Snork/module.mk, @Spork/module.mk, Makefile.am: New files.
+	* Makefile.in: Delete.
+
 2009-10-19  Rik  <octdev@nomad.inbox5.com>
 
 	* fntests.m: .cc files are now included in the list of files requiring
new file mode 100644
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,79 @@
+# Makefile for octave's test directory
+#
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2006, 2007
+#               John W. Eaton
+#
+# This file is part of Octave.
+# 
+# Octave is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+# 
+# Octave is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+TOPDIR = ..
+
+include ../common.mk
+
+FCN_FILE_DIRS =
+
+FCN_FILES = \
+  fntests.m \
+  test_args.m \
+  test_classes.m \
+  test_contin.m \
+  test_diag_perm.m \
+  test_error.m \
+  test_eval-catch.m \
+  test_for.m \
+  test_func.m \
+  test_global.m \
+  test_if.m \
+  test_index-wfi-f.m \
+  test_index-wfi-t.m \
+  test_io.m \
+  test_logical-wfi-f.m \
+  test_logical-wfi-t.m \
+  test_null_assign.m \
+  test_prefer.m \
+  test_range.m \
+  test_recursion.m \
+  test_return.m \
+  test_slice.m \
+  test_string.m \
+  test_struct.m \
+  test_switch.m \
+  test_system.m \
+  test_transpose.m \
+  test_try.m \
+  test_unwind.m \
+  test_while.m
+
+include @Blork/module.mk
+include @Cork/module.mk
+include @Dork/module.mk
+include @Gork/module.mk
+include @Pork/module.mk
+include @Sneetch/module.mk
+include @Snork/module.mk
+include @Spork/module.mk
+
+EXTRA_DIST = \
+  ChangeLog \
+  build_sparse_tests.sh \
+  $(FCN_FILES)
+
+check: test_sparse.m
+	../run-octave --norc --silent --no-history $(srcdir)/fntests.m $(srcdir)
+.PHONY: check
+
+test_sparse.m: build_sparse_tests.sh
+	$(srcdir)/build_sparse_tests.sh
deleted file mode 100644
--- a/test/Makefile.in
+++ /dev/null
@@ -1,86 +0,0 @@
-# Makefile for octave's test directory
-#
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2006, 2007
-#               John W. Eaton
-#
-# This file is part of Octave.
-# 
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-# 
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-TOPDIR = ..
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-include $(TOPDIR)/Makeconf
-
-SOURCES = $(wildcard $(srcdir)/test_*.m)
-
-DISTFILES = $(addprefix $(srcdir)/, ChangeLog Makefile.in \
-	build_sparse_tests.sh fntests.m) $(SOURCES)
-
-OCTAVE_BINARY = ../src/octave
-
-ifeq ($(SHARED_LIBS), true)
-  OCTAVE_LD_LIBRARY_PATH = `pwd`/../src:`pwd`/../liboctave:`pwd`/../libcruft
-  ifeq ($(@library_path_var@),)
-    XLD_LIBRARY_PATH = $(OCTAVE_LD_LIBRARY_PATH)
-  else
-    XLD_LIBRARY_PATH = $(OCTAVE_LD_LIBRARY_PATH):$(@library_path_var@)
-  endif
-  SET_LD_LIBRARY_PATH = @library_path_var@="$(XLD_LIBRARY_PATH)"
-endif
-
-all: check
-.PHONY: all
-
-check: test_sparse.m
-	../run-octave --norc --silent --no-history $(srcdir)/fntests.m $(srcdir)
-.PHONY: check
-
-test_sparse.m: build_sparse_tests.sh
-	$(srcdir)/build_sparse_tests.sh
-
-install install-strip: all
-.PHONY: install install-strip
-
-uninstall:
-.PHONY: uninstall
-
-tags: $(SOURCES)
-	ctags $(SOURCES)
-
-TAGS: $(SOURCES)
-	etags $(SOURCES)
-
-clean:
-	rm -f fntests.log a.wav
-.PHONY: clean
-
-mostlyclean:
-.PHONY: mostlyclean
-
-distclean: clean
-	rm -f Makefile test_sparse.m
-.PHONY: distclean
-
-maintainer-clean: distclean
-	rm -f tags TAGS
-.PHONY: maintainer-clean
-
-dist:
-	ln $(DISTFILES) ../`cat ../.fname`/test
-.PHONY: dist