changeset 10004:e517da95bf98

Eliminate TOPDIR variable in favor of built-in automake variables top_builddir and top_srcdir.
author Rik <rdrider0-list@yahoo.com>
date Sat, 19 Dec 2009 22:58:54 -0800
parents 2ea3110e15ed
children b250fee61632
files ChangeLog Makefile.am common.mk configure.ac doc/ChangeLog doc/Makefile.am doc/faq/Makefile.am doc/interpreter/Makefile.am doc/interpreter/images.awk doc/liboctave/Makefile.am doc/refcard/Makefile.am examples/Makefile.am libcruft/ChangeLog libcruft/Makefile.am liboctave/ChangeLog liboctave/Makefile.am scripts/ChangeLog scripts/Makefile.am src/ChangeLog src/Makefile.am test/ChangeLog test/Makefile.am
diffstat 22 files changed, 126 insertions(+), 154 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Dec 19 14:24:02 2009 -0800
+++ b/ChangeLog	Sat Dec 19 22:58:54 2009 -0800
@@ -1,4 +1,10 @@
-2009-12-11  Rik <octave@nomad.inbox5.com>
+2009-12-19  Rik <octave@nomad.inbox5.com>
+
+	* Makefile.am, examples/Makefile.am, common.mk, configure.ac: Eliminate
+	TOPDIR variable in favor of built-in automake variables of top_builddir
+	and top_srcdir.
+
+2009-12-19  Rik <octave@nomad.inbox5.com>
 
 	* Makefile.am: Use M4 quoting for arguments to autoconf macros containing
 	variables
--- a/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,11 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = .
+include common.mk
 
-include common.mk
+## Avoid making multiple subdirs in parallel which can lead 
+## to a confusing error message stream
+.NOTPARALLEL:
 
 ACLOCAL_AMFLAGS = -I m4
 
@@ -186,58 +188,3 @@
 	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:
--- a/common.mk	Sat Dec 19 14:24:02 2009 -0800
+++ b/common.mk	Sat Dec 19 22:58:54 2009 -0800
@@ -103,7 +103,7 @@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
 
-LIBFLAGS = -L$(TOPDIR)
+LIBFLAGS = -L$(top_builddir)
 
 DEFS = @DEFS@
 
--- a/configure.ac	Sat Dec 19 14:24:02 2009 -0800
+++ b/configure.ac	Sat Dec 19 22:58:54 2009 -0800
@@ -1091,7 +1091,7 @@
     RLD_FLAG='-Wl,-rpath -Wl,$(octlibdir)'
   ;;
   *-*-darwin*)
-    DL_LDFLAGS='-bundle -bundle_loader $(TOPDIR)/src/octave $(LDFLAGS)'
+    DL_LDFLAGS='-bundle -bundle_loader $(top_builddir)/src/octave $(LDFLAGS)'
     MKOCTFILE_DL_LDFLAGS='-bundle -bundle_loader $$BINDIR/octave-$$OCTAVE_VERSION$$EXEEXT'
     SH_LDFLAGS='-dynamiclib -single_module $(LDFLAGS)'
     case "$canonical_host_type" in
@@ -1624,9 +1624,9 @@
    LIBOCTAVE=-loctave$SHLLINKEXT
    LIBCRUFT=-lcruft$SHLLINKEXT
 else
-  LIBOCTINTERP='$(TOPDIR)/src/liboctinterp.$(LIBEXT)'
-  LIBOCTAVE='$(TOPDIR)/liboctave/liboctave.$(LIBEXT)'
-  LIBCRUFT='$(TOPDIR)/libcruft/libcruft.$(LIBEXT)'
+  LIBOCTINTERP='$(top_builddir)/src/liboctinterp.$(LIBEXT)'
+  LIBOCTAVE='$(top_builddir)/liboctave/liboctave.$(LIBEXT)'
+  LIBCRUFT='$(top_builddir)/libcruft/libcruft.$(LIBEXT)'
 fi
 
 AC_SUBST(LD_CXX)
--- a/doc/ChangeLog	Sat Dec 19 14:24:02 2009 -0800
+++ b/doc/ChangeLog	Sat Dec 19 22:58:54 2009 -0800
@@ -1,3 +1,10 @@
+2009-12-19  Rik <octave@nomad.inbox5.com>
+
+	* Makefile.am, faq/Makefile.am, interpreter/Makefile.am,
+	liboctave/Makefile.am, refcard/Makefile.am, interpreter/images.awk: 
+	Eliminate TOPDIR variable in favor of built-in automake variables of 
+	top_builddir and top_srcdir.
+
 2009-12-17  Rik  <octave@nomad.inbox5.com>
 
 	* interpreter/Makefile.am: use automake syntax to build munge-texi.
--- a/doc/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/doc/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,11 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ..
+include $(top_srcdir)/common.mk
 
-include ../common.mk
+## Avoid making multiple subdirs in parallel which can lead 
+## to a confusing error message stream
+.NOTPARALLEL:
 
 EXTRA_DIST = \
   ChangeLog \
@@ -35,4 +37,3 @@
 	$(MAKE) -C interpreter ../$@
 .PHONY: ../BUGS ../INSTALL.OCTAVE
 
-.NOTPARALLEL:
--- a/doc/faq/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/doc/faq/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,11 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ../..
+include $(top_srcdir)/common.mk
 
-include ../../common.mk
+## Automake generated rules for documentation are not parallel-safe.
+## Restrict current directory to run serially
+.NOTPARALLEL:
 
 TEXINFO_TEX = ../texinfo.tex
 
@@ -31,6 +33,3 @@
 
 EXTRA_DIST = OctaveFAQ.dvi OctaveFAQ.html OctaveFAQ.pdf OctaveFAQ.ps
 
-## Automake generated rules for documentation are not parallel-safe.
-## Restrict current directory to run serially
-.NOTPARALLEL:
--- a/doc/interpreter/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/doc/interpreter/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,11 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ../..
+include $(top_srcdir)/common.mk
 
-include ../../common.mk
+## Automake generated rules for documentation are not parallel-safe.
+## Restrict current directory to run serially
+.NOTPARALLEL:
 
 TEXINFO_TEX = ../texinfo.tex
 
@@ -33,10 +35,6 @@
 TEXMFCNF := "..$(PATH_SEPARATOR)$(srcdir)/..$(PATH_SEPARATOR)$(TEXMFCNF)$(PATH_SEPARATOR)"
 export TEXMFCNF
 
-## Automake generated rules for documentation are not parallel-safe.
-## Restrict current directory to run serially
-.NOTPARALLEL:
-
 dist_man1_MANS = \
   mkoctfile.1 \
   octave-bug.1 \
@@ -173,7 +171,7 @@
 DOCSTRING_FILES = $(shell $(srcdir)/find-docstring-files.sh "$(top_srcdir)")
 
 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; exit 1; }
+	$(top_builddir)/run-octave -f -q -H $(srcdir)/mk_doc_cache.m doc-cache $(DOCSTRING_FILES) || { rm -f doc-cache; exit 1; }
 
 ## Program compiled only to help build documentation.  No need to install
 noinst_PROGRAMS = munge-texi
--- a/doc/interpreter/images.awk	Sat Dec 19 14:24:02 2009 -0800
+++ b/doc/interpreter/images.awk	Sat Dec 19 22:58:54 2009 -0800
@@ -44,7 +44,7 @@
 	printf ("\tcp $< $@\n");
       }
       printf ("%s.%s: %s\n", $j, ext, script);
-      printf ("\t$(TOPDIR)/run-octave -f -q -H -p $(srcdir) --eval \"%s ('%s', '%s');\"\n",
+      printf ("\t$(top_builddir)/run-octave -f -q -H -p $(srcdir) --eval \"%s ('%s', '%s');\"\n",
 	      basename, $j, ext);
     }
   }
--- a/doc/liboctave/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/doc/liboctave/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,11 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ../..
+include $(top_srcdir)/common.mk
 
-include ../../common.mk
+## Automake generated rules for documentation are not parallel-safe.
+## Restrict current directory to run serially
+.NOTPARALLEL:
 
 TEXINFO_TEX = ../texinfo.tex
 
@@ -50,10 +52,7 @@
 
 all-local: dvi html pdf ps
 
-EXTRA_DIST = liboctave.dvi liboctave.html liboctave.pdf liboctave.ps
-
 liboctave.info liboctave.dvi liboctave.html liboctave.pdf: $(srcdir)/version.texi
 
-## Automake generated rules for documentation are not parallel-safe.
-## Restrict current directory to run serially
-.NOTPARALLEL:
+EXTRA_DIST = liboctave.dvi liboctave.html liboctave.pdf liboctave.ps
+
--- a/doc/refcard/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/doc/refcard/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -18,9 +18,7 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ../..
-
-include ../../common.mk
+include $(top_srcdir)/common.mk
 
 TEX = \
   refcard.tex \
@@ -39,14 +37,6 @@
   refcard-letter.ps \
   refcard-letter.pdf
 
-EXTRA_DIST = \
-  $(TEX) \
-  $(FORMATTED)
-
-CLEANFILES = refcard-a4.log refcard-legal.log refcard-letter.log
-
-MAINTAINERCLEANFILES = $(FORMATTED)
-
 all-local: $(FORMATTED)
 
 refcard-a4.dvi: refcard-a4.tex refcard.tex
@@ -75,3 +65,12 @@
 
 refcard-letter.pdf: refcard-letter.tex refcard.tex
 	-TEXINPUTS="$(srcdir):$(TEXINPUTS):" pdftex $<
+
+EXTRA_DIST = \
+  $(TEX) \
+  $(FORMATTED)
+
+CLEANFILES = refcard-a4.log refcard-legal.log refcard-letter.log
+
+MAINTAINERCLEANFILES = $(FORMATTED)
+
--- a/examples/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/examples/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -18,16 +18,44 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ..
-
-include ../common.mk
+include $(top_srcdir)/common.mk
 
 dist_archlib_SCRIPTS = info-emacs-info info-emacs-octave-help
 
 IMAGE_FILES = octave-sombrero.png
 image_DATA = $(IMAGE_FILES)
 
-EXTRA_DIST = \
+EXTRA_DIST = 
+
+FCN_FILE_DIRS =
+
+FCN_FILES =
+
+include @polynomial/module.mk
+include @FIRfilter/module.mk
+
+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:
+	-if test -n "$(DESKTOP_FILE_INSTALL)"; then \
+	  $(DESKTOP_FILE_INSTALL) --dir=$(DESTDIR)$(datadir)/applications \
+	    --vendor www.octave.org octave.desktop; \
+	fi
+
+uninstall-local:
+	if test -n "$(DESKTOP_FILE_INSTALL)"; then \
+	  rm -f $(DESTDIR)$(datadir)/applications/www.octave.org-octave.desktop; \
+	fi
+
+EXTRA_DIST += \
+  $(FCN_FILES) \
   $(IMAGE_FILES) \
   addtwomatrices.cc \
   celldemo.cc \
@@ -60,34 +88,5 @@
   structdemo.cc \
   unwinddemo.cc
 
-FCN_FILE_DIRS =
-
-FCN_FILES =
-
-include @polynomial/module.mk
-include @FIRfilter/module.mk
-
-EXTRA_DIST += $(FCN_FILES)
-
 CLEANFILES = octave.desktop
 
-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:
-	-if test -n "$(DESKTOP_FILE_INSTALL)"; then \
-	  $(DESKTOP_FILE_INSTALL) --dir=$(DESTDIR)$(datadir)/applications \
-	    --vendor www.octave.org octave.desktop; \
-	fi
-
-uninstall-local:
-	if test -n "$(DESKTOP_FILE_INSTALL)"; then \
-	  rm -f $(DESTDIR)$(datadir)/applications/www.octave.org-octave.desktop; \
-	fi
-
--- a/libcruft/ChangeLog	Sat Dec 19 14:24:02 2009 -0800
+++ b/libcruft/ChangeLog	Sat Dec 19 22:58:54 2009 -0800
@@ -1,3 +1,8 @@
+2009-12-19  Rik <octave@nomad.inbox5.com>
+
+	* Makefile.am: Eliminate TOPDIR variable in favor of built-in automake
+	variables of top_builddir and top_srcdir.
+
 2009-12-13  Rik <octave@nomad.inbox5.com>
 
 	* Makefile.am: Use simple_move_if_change_rule for cruft.def to eliminate
--- a/libcruft/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/libcruft/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,7 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ..
-
-include ../common.mk
+include $(top_srcdir)/common.mk
 
 AUTOMAKE_OPTIONS = subdir-objects
 
@@ -40,9 +38,7 @@
 
 octinclude_HEADERS =
 
-DISTCLEANFILES = cruft.def
-
-EXTRA_DIST = ChangeLog STOP.patch mkf77def.in
+EXTRA_DIST =
 
 include amos/module.mk
 include blas-xtra/module.mk
@@ -65,3 +61,7 @@
 	./mkf77def $(srcdir) $(libcruft_la_SOURCES) > $@-t
 	$(simple_move_if_change_rule)
 
+EXTRA_DIST += ChangeLog STOP.patch mkf77def.in
+
+DISTCLEANFILES = cruft.def
+
--- a/liboctave/ChangeLog	Sat Dec 19 14:24:02 2009 -0800
+++ b/liboctave/ChangeLog	Sat Dec 19 22:58:54 2009 -0800
@@ -1,3 +1,8 @@
+2009-12-19  Rik <octave@nomad.inbox5.com>
+
+	* Makefile.am: Eliminate TOPDIR variable in favor of built-in automake
+	variables of top_builddir and top_srcdir.
+
 2009-12-17  John W. Eaton  <jwe@octave.org>
 
 	* glob-match.h, glob-match.cc (glob_match::glob_internal):
--- a/liboctave/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/liboctave/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,7 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ..
- 
-include ../common.mk
+include $(top_srcdir)/common.mk
 
 AM_CPPFLAGS = -I$(top_srcdir)/libgnu -I$(top_srcdir)/libcruft/misc
 
--- a/scripts/ChangeLog	Sat Dec 19 14:24:02 2009 -0800
+++ b/scripts/ChangeLog	Sat Dec 19 22:58:54 2009 -0800
@@ -1,3 +1,8 @@
+2009-12-19  Rik <octave@nomad.inbox5.com>
+
+	* Makefile.am: Eliminate TOPDIR variable in favor of built-in automake
+	variables of top_builddir and top_srcdir.
+
 2009-12-18  Rik <octave@nomad.inbox5.com>
 
 	* Makefile.am: Use Automake syntax to build helper program gethelp
--- a/scripts/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/scripts/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,7 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ..
-
-include ../common.mk 
+include $(top_srcdir)/common.mk
 
 AUTOMAKE_OPTIONS = subdir-objects
 
--- a/src/ChangeLog	Sat Dec 19 14:24:02 2009 -0800
+++ b/src/ChangeLog	Sat Dec 19 22:58:54 2009 -0800
@@ -1,3 +1,8 @@
+2009-12-19  Rik <octave@nomad.inbox5.com>
+
+	* Makefile.am: Eliminate TOPDIR variable in favor of built-in automake
+	variables of top_builddir and top_srcdir.
+
 2009-12-18  David Grundberg  <davidg@cs.umu.se>
 
 	* ov-usr-fcn.cc (octave_user_script::do_multi_index_op):
--- a/src/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/src/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,7 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ..
-
-include ../common.mk
+include $(top_srcdir)/common.mk
 
 octlib_LTLIBRARIES = \
   liboctinterp.la
--- a/test/ChangeLog	Sat Dec 19 14:24:02 2009 -0800
+++ b/test/ChangeLog	Sat Dec 19 22:58:54 2009 -0800
@@ -1,3 +1,8 @@
+2009-12-19  Rik <octave@nomad.inbox5.com>
+
+	* Makefile.am: Eliminate TOPDIR variable in favor of built-in automake
+	variables of top_builddir and top_srcdir.
+
 2009-12-17  Rik  <octdev@nomad.inbox5.com>
 
 	* config/unix.exp: Remove obsolete file from repository
--- a/test/Makefile.am	Sat Dec 19 14:24:02 2009 -0800
+++ b/test/Makefile.am	Sat Dec 19 22:58:54 2009 -0800
@@ -19,9 +19,7 @@
 # along with Octave; see the file COPYING.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-TOPDIR = ..
-
-include ../common.mk
+include $(top_srcdir)/common.mk
 
 FCN_FILES = \
   fntests.m \
@@ -64,6 +62,12 @@
 include @Snork/module.mk
 include @Spork/module.mk
 
+check: test_sparse.m
+	$(top_builddir)/run-octave --norc --silent --no-history $(srcdir)/fntests.m $(srcdir)
+
+test_sparse.m: build_sparse_tests.sh
+	$(srcdir)/build_sparse_tests.sh
+
 EXTRA_DIST = \
   ChangeLog \
   build_sparse_tests.sh \
@@ -75,9 +79,3 @@
 DISTCLEANFILES = \
   fntests.log
 
-check: test_sparse.m
-	../run-octave --norc --silent --no-history $(srcdir)/fntests.m $(srcdir)
-
-test_sparse.m: build_sparse_tests.sh
-	$(srcdir)/build_sparse_tests.sh
-