#-*- Makefile -*- # # ${RHOME}/src/gnuwin32/check/PkgCheck # to be run from RHOME/src/library/$(PKG)/check or tests include $(RHOME)/src/gnuwin32/MkRules all: run R = $(RHOME)/bin/Rterm --vanilla LC_ALL=C RDIFF = $(RHOME)/bin/Rcmd Rdiff.sh run: $(PKG)-Ex.R @$(ECHO) "Running examples in '$(PKG)-Ex.R' ..." $(R) R_LIBS='$(RLIB);$(R_LIBS)' < $(PKG)-Ex.R > $(PKG)-Ex.Rout $(PKG)-Ex.R: $(RLIB)/$(PKG)/R-ex/* @$(ECHO) "Massaging examples into '$(PKG)-Ex.R' ..." @if test -f $(RLIB)/$(PKG)/R-ex/Rex.zip; then \ (cd $(RLIB)/$(PKG)/R-ex; unzip -oq Rex); \ perl $(RHOME)/bin/massage-Examples $(PKG) $(RLIB)/$(PKG)/R-ex/*.R > $@; \ (cd $(RLIB)/$(PKG)/R-ex; $(RM) -f *.R); \ else \ perl $(RHOME)/bin/massage-Examples $(PKG) $(RLIB)/$(PKG)/R-ex/*.R > $@; \ fi test-src-1=$(shell ls *.R 2> nul) test-src-auto=$(shell ls *.Rin 2> nul | sed 's/Rin$$/R/') test-src = $(test-src-1) $(test-src-auto) test-out = $(test-src:.R=.Rout) .SUFFIXES: .SUFFIXES: .R .Rin .Rout .Rin.R: @echo "Creating \`$@'" @$(R) < $< > nul .R.Rout: @rm -f $@ $@.fail @echo " Running \`$<'" @$(R) R_LIBS="$(RLIB);$(R_LIBS)" < $< > $@ @if test -f $@.save ; then \ mv $@ $@.fail; \ echo -n " Comparing \`$@' to \`$@.save' ..."; \ $(RDIFF) $@.fail $@.save 0 || exit 1; \ mv $@.fail $@; \ echo "OK"; \ fi tests: @(out=$(shell echo \"$(test-out)\");\ if test -n "$${out}"; then \ echo "Running specific tests"; \ $(MAKE) -f $(RHOME)/src/gnuwin32/check/PkgCheck $${out}; \ fi) clean: @rm -f $(test-out) $(test-src-auto) *.fail