The R Project SVN R

Rev

Rev 23762 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23762 Rev 23790
1
#-*- Makefile -*-
1
#-*- Makefile -*-
2
#
2
#
3
# ${RHOME}/src/gnuwin32/check/PkgCheck
3
# ${RHOME}/src/gnuwin32/check/PkgCheck
4
 
4
 
5
# to be run from RHOME/src/library/$(PKG)/check or tests
5
# to be run from RHOME/src/library/$(PKG)/check or tests
6
 
6
 
7
include $(RHOME)/src/gnuwin32/MkRules
7
include $(RHOME)/src/gnuwin32/MkRules
8
 
8
 
9
REXs=$(wildcard $(RLIB)/$(PKG)/R-ex/*)
9
REXs=$(wildcard $(RLIB)/$(PKG)/R-ex/*)
10
ifneq ($(strip $(REXs)),)
10
ifneq ($(strip $(REXs)),)
11
all: run
11
all: run
12
else 
12
else 
13
all:
13
all:
14
endif
14
endif
15
 
15
 
16
R = $(RHOME)/bin/Rterm --vanilla LC_ALL=C
16
R = $(RHOME)/bin/Rterm --vanilla LC_ALL=C
17
RDIFF = $(RHOME)/bin/Rcmd Rdiff.sh
17
RDIFF = $(RHOME)/bin/Rcmd Rdiff.sh
18
 
18
 
19
run: $(PKG)-Ex.R
19
run: $(PKG)-Ex.R
20
	@if test -f $(PKG)-Ex.Rout ; then \
20
	@if test -f $(PKG)-Ex.Rout ; then \
21
	  mv $(PKG)-Ex.Rout $(PKG)-Ex.Rout.prev ; fi
21
	  mv $(PKG)-Ex.Rout $(PKG)-Ex.Rout.prev ; fi
22
	@rm -f $(PKG)-Ex.Rout.fail
22
	@rm -f $(PKG)-Ex.Rout.fail
23
	@$(ECHO) "Running examples in '$(PKG)-Ex.R' ..."
23
	@$(ECHO) "Running examples in '$(PKG)-Ex.R' ..."
24
	@$(R) R_LIBS='$(RLIB);$(R_LIBS)' < $(PKG)-Ex.R > $(PKG)-Ex.Rout 2>&1 \
24
	@$(R) R_LIBS='$(RLIB);$(R_LIBS)' < $(PKG)-Ex.R > $(PKG)-Ex.Rout 2>&1 \
25
	  || (mv  $(PKG)-Ex.Rout $(PKG)-Ex.Rout.fail && exit 1)
25
	  || (mv  $(PKG)-Ex.Rout $(PKG)-Ex.Rout.fail && exit 1)
26
	@if test -f $(PKG)-Ex.Rout.prev ; then \
26
	@if test -f $(PKG)-Ex.Rout.prev ; then \
27
	  mv $(PKG)-Ex.Rout $(PKG)-Ex.Rout.fail; \
27
	  mv $(PKG)-Ex.Rout $(PKG)-Ex.Rout.fail; \
28
	  echo -n "Comparing \`$(PKG)-Ex.Rout' to \`$(PKG)-Ex.Rout.prev' ..."; \
28
	  echo -n "Comparing \`$(PKG)-Ex.Rout' to \`$(PKG)-Ex.Rout.prev' ..."; \
29
	  $(RDIFF) $(PKG)-Ex.Rout.fail $(PKG)-Ex.Rout.prev 0 || exit 1; \
29
	  $(RDIFF) $(PKG)-Ex.Rout.fail $(PKG)-Ex.Rout.prev 0 || exit 1; \
30
	  mv $(PKG)-Ex.Rout.fail $(PKG)-Ex.Rout; \
30
	  mv $(PKG)-Ex.Rout.fail $(PKG)-Ex.Rout; \
31
	  echo "OK"; \
31
	  echo "OK"; \
32
	fi
32
	fi
33
 
33
 
34
 
34
 
35
$(PKG)-Ex.R: $(RLIB)/$(PKG)/R-ex/*
35
$(PKG)-Ex.R: $(RLIB)/$(PKG)/R-ex/* $(RHOME)/bin/massage-Examples
36
	@$(ECHO) "Massaging examples into '$(PKG)-Ex.R' ..."
36
	@$(ECHO) "Massaging examples into '$(PKG)-Ex.R' ..."
37
	@if test -f $(RLIB)/$(PKG)/R-ex/Rex.zip; then \
37
	@if test -f $(RLIB)/$(PKG)/R-ex/Rex.zip; then \
38
	  (cd $(RLIB)/$(PKG)/R-ex; unzip -oq Rex); \
38
	  (cd $(RLIB)/$(PKG)/R-ex; unzip -oq Rex); \
39
	  perl $(RHOME)/bin/massage-Examples $(PKG) $(RLIB)/$(PKG)/R-ex/*.R > $@; \
39
	  perl $(RHOME)/bin/massage-Examples $(PKG) $(RLIB)/$(PKG)/R-ex/*.R > $@; \
40
	  (cd $(RLIB)/$(PKG)/R-ex; $(RM) -f *.R); \
40
	  (cd $(RLIB)/$(PKG)/R-ex; $(RM) -f *.R); \
41
	else \
41
	else \
42
	  perl $(RHOME)/bin/massage-Examples $(PKG) $(RLIB)/$(PKG)/R-ex/*.R > $@; \
42
	  perl $(RHOME)/bin/massage-Examples $(PKG) $(RLIB)/$(PKG)/R-ex/*.R > $@; \
43
	fi
43
	fi
44
 
44
 
45
test-src-1=$(shell ls *.R 2> /dev/null)
45
test-src-1=$(shell ls *.R 2> /dev/null)
46
test-src-auto=$(shell ls *.Rin 2> /dev/null | sed 's/Rin$$/R/')
46
test-src-auto=$(shell ls *.Rin 2> /dev/null | sed 's/Rin$$/R/')
47
test-src = $(test-src-1) $(test-src-auto)
47
test-src = $(test-src-1) $(test-src-auto)
48
test-out = $(test-src:.R=.Rout)
48
test-out = $(test-src:.R=.Rout)
49
 
49
 
50
.SUFFIXES:
50
.SUFFIXES:
51
.SUFFIXES: .R .Rin .Rout
51
.SUFFIXES: .R .Rin .Rout
52
 
52
 
53
.Rin.R:
53
.Rin.R:
54
	@echo "Creating \`$@'"
54
	@echo "Creating \`$@'"
55
	@$(R) < $< > /dev/null
55
	@$(R) < $< > /dev/null
56
 
56
 
57
.R.Rout:
57
.R.Rout:
58
	@rm -f $@ $@.fail
58
	@rm -f $@ $@.fail
59
	@echo "  Running \`$<'"
59
	@echo "  Running \`$<'"
60
	@$(R) R_LIBS="$(RLIB);$(R_LIBS)" < $< > $@  2>&1 || (mv $@ $@.fail && exit 1)
60
	@$(R) R_LIBS="$(RLIB);$(R_LIBS)" < $< > $@  2>&1 || (mv $@ $@.fail && exit 1)
61
	@if test -f $@.save ; then \
61
	@if test -f $@.save ; then \
62
	  mv $@ $@.fail; \
62
	  mv $@ $@.fail; \
63
	  echo -n "  Comparing \`$@' to \`$@.save' ..."; \
63
	  echo -n "  Comparing \`$@' to \`$@.save' ..."; \
64
	  $(RDIFF) $@.fail $@.save 0 || exit 1; \
64
	  $(RDIFF) $@.fail $@.save 0 || exit 1; \
65
	  mv $@.fail $@; \
65
	  mv $@.fail $@; \
66
	  echo "OK"; \
66
	  echo "OK"; \
67
	fi
67
	fi
68
 
68
 
69
tests:
69
tests:
70
	@(out=$(shell echo \"$(test-out)\");\
70
	@(out=$(shell echo \"$(test-out)\");\
71
	  if test -n "$${out}"; then \
71
	  if test -n "$${out}"; then \
72
	    echo "Running specific tests"; \
72
	    echo "Running specific tests"; \
73
	    rm -f *.Rout ; \
73
	    rm -f *.Rout ; \
74
	    $(MAKE) -f $(RHOME)/src/gnuwin32/check/PkgCheck $${out}; \
74
	    $(MAKE) -f $(RHOME)/src/gnuwin32/check/PkgCheck $${out}; \
75
	  fi)
75
	  fi)
76
 
76
 
77
clean:
77
clean:
78
	@rm -f $(test-out) $(test-src-auto) *.fail
78
	@rm -f $(test-out) $(test-src-auto) *.fail