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