#
# Makefile for octave's test directory
#
# John W. Eaton
# jwe@bevo.che.wisc.edu
# University of Wisconsin-Madison
# Department of Chemical Engineering

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
