#-*- Makefile -*-
#
# ${R_HOME}/tests/Examples/Makefile.win

R_HOME=../..

include $(R_HOME)/src/gnuwin32/MkRules

INSTFILES = \
  datasets-Ex.Rout.save grDevices-Ex.Rout.save graphics-Ex.Rout.save \
  grid-Ex.Rout.save splines-Ex.Rout.save \
  stats-Ex.Rout.save stats4-Ex.Rout.save tools-Ex.Rout.save

ECHO = echo

## R_LIBS_SITE has to be non-empty or it is ignored
## Note that this does not set LC_COLLATE.  The collation of examples
## is done in C order in massageExamples(), but we want to test the
## orderings users use.
R_EXE = $(R_HOME)/$(BINDIR)/Rterm --vanilla --no-echo \
  LANGUAGE=en LC_TIME=C R_LIBS= R_LIBS_USER=NULL R_LIBS_SITE=NULL

all: test-Examples-Base

test-Examples: test-Examples-Base

TEST_DONTTEST = FALSE
test-Examples-Base:
	@$(ECHO) "tools::testInstalledPackages(scope='base', types='examples', commentDonttest=!$(TEST_DONTTEST))" | $(R_EXE)


test-Examples-Recommended: test-Examples-Base
	@$(ECHO) "tools::testInstalledPackages(scope='recommended', types='examples')" | $(R_EXE)

mostlyclean: clean
clean:
	-@rm -f *.R *.R-cnt *.Rout *.Rd* *.pdf *.tex *.dat* data foo* ex*.gz
distclean: clean
	-@rm -f *.R*bak *.R*bakk *.R*prev .RData sink-examp.txt

install-tests:
	@mkdir -p "../$(INST_TO)/Examples"
	@cp $(INSTFILES) "../$(INST_TO)/Examples"
