#
# Makefile for octave's test directory
#
# John W. Eaton
# jwe@che.utexas.edu
# Department of Chemical Engineering
# The University of Texas at Austin

TOPDIR = ..

srcdir = @srcdir@
VPATH = @srcdir@

include $(TOPDIR)/Makeconf

SOURCES =

DISTFILES = Makefile.in $(SOURCES)

SUBDIRS = octave config

all: check
.PHONY: all

# This sucks, but it looks like runtest doesn't search in $(srcdir)
# for the init file and I don't see a better way...

check:
	@if test "$(srcdir)" = "." ; then \
	  true ; \
	else \
	  cp $(srcdir)/config/unix-octave.exp config/unix-octave.exp ; \
	fi
	@if test -n "$(RUNTEST)" ; then \
	  $(RUNTEST) \
	    OCTAVE_PATH="$(srcdir)/../scripts" OCTAVE="../src/octave" \
	    --all --tool octave --srcdir $(srcdir) ; \
	else \
	  echo "***" ; \
	  echo "*** Sorry, I can't run tests without DejaGnu" ; \
	  echo "***" ; \
	fi

.PHONY: check

install: all
.PHONY: install

uninstall:
.PHONY: uninstall

tags: $(SOURCES)
	ctags $(SOURCES)

TAGS: $(SOURCES)
	etags $(SOURCES)

clean:
.PHONY: clean

mostlyclean:
.PHONY: mostlyclean

distclean: clean
	rm -f Makefile
.PHONY: distclean

realclean: distclean
	rm -f tags TAGS
.PHONY: realclean

local-dist:
	for dir in $(SUBDIRS); do mkdir ../`cat ../.fname`/test/$$dir; cd $$dir; $(MAKE) $@; cd ..; done
	ln $(DISTFILES) ../`cat ../.fname`/test
.PHONY: local-dist

dist:
	for dir in $(SUBDIRS); do mkdir ../`cat ../.fname`/test/$$dir; cd $$dir; $(MAKE) $@; cd ..; done
	ln $(DISTFILES) ../`cat ../.fname`/test
.PHONY: dist
