# 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
