1#
2# ${R_HOME}/tests/Makefile
3
4VPATH = @srcdir@
5srcdir = @srcdir@
6top_srcdir = @top_srcdir@
7
8top_builddir = ..
9subdir = tests
10
11all check: test-all-basics
12check-devel: check test-all-devel
13check-all: check-devel check-recommended
14@USE_RECOMMENDED_PACKAGES_TRUE@check-recommended: test-Packages-Recommended
15@USE_RECOMMENDED_PACKAGES_FALSE@check-recommended:
16@USE_RECOMMENDED_PACKAGES_FALSE@	@$(ECHO) "Recommended packages are not installed so cannot be tested"
17
18@USE_RECOMMENDED_PACKAGES_TRUE@test-src-sloppy-b = eval-etc-2.R
19@USE_RECOMMENDED_PACKAGES_FALSE@test-src-sloppy-b =
20
21include $(top_builddir)/Makeconf
22include $(srcdir)/Makefile.common
23
24@USE_RECOMMENDED_PACKAGES_FALSE@test-src-reg3 = reg-plot-latin1.R reg-S4.R
25
26
27distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
28
29DISTFILES = Makefile.in Makefile.win Makefile.install Makefile.common \
30	$(INSTFILES) gct-foot.R reg-win.R eval-fns.R \
31	testit.Rd testit.txt.save testit.html.save \
32	testit.tex.save testit-Ex.R.save \
33	ver20.Rd ver20.txt.save ver20.html.save ver20.tex.save ver20-Ex.R.save \
34	R-intro.Rout.save \
35	test-system.R test-system.Rout.save test-system2.c \
36	reg-large.R utf8.R reg-translation.R
37
38SUBDIRS = Embedding Examples
39SUBDIRS_WITH_NO_BUILD = Pkgs
40
41## SRCDIR is used by reg-tests-1a.R, reg-IO2.R and reg-packages.R
42## NB: SRCDIR is not available on windows so make any new tests robust to this
43## GNU gettext disables LANGUAGE if LC_ALL=C, but other systems might not.
44R = LANGUAGE=en LC_ALL=C SRCDIR=$(srcdir) R_DEFAULT_PACKAGES= $(top_builddir)/bin/R --vanilla
45R2 = R_DEFAULT_PACKAGES= $(top_builddir)/bin/R --vanilla
46R3 = $(top_builddir)/bin/R CMD check
47RDIFF = $(top_builddir)/bin/R CMD Rdiff
48RDCONV = LC_CTYPE=C $(top_builddir)/bin/R CMD Rdconv
49MK = $(MAKE)
50
51all check test-all-basics test-all-devel: Makefile $(srcdir)/Makefile.common
52
53
54Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
55	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
56
57test-system2: $(srcdir)/test-system2.c
58	@$(MAIN_LD) -o $@ $(srcdir)/test-system2.c
59
60## Not run by any other target
61test-System: test-system2
62	-@$(MAKE) test-system.Rout
63
64
65## <NOTE>
66## These depend on an internet connection, and the sites being up.
67## So allow this to fail: it may be slow doing so.
68test-Internet:
69	@$(ECHO) "running tests of Internet functions"
70	-@$(MAKE) $(test-out-internet) RVAL_IF_DIFF=0
71## </NOTE>
72
73## <NOTE>
74## Not all platforms can build standalone.
75## So allow this to fail.
76test-Standalone:
77	@$(ECHO) "testing building standalone Rmath"
78	-@(cd $(top_builddir)/src/nmath/standalone; $(MAKE) check)
79## </NOTE>
80
81
82mostlyclean: clean
83clean:
84	-@for d in $(SUBDIRS); do \
85	  (cd $${d} && $(MAKE) $@); \
86	done
87	-@rm -f stamp-R Makedeps Rplot* data dumpdata.R \
88	  Rplot* Rprof.out Rprofmem.out \
89	  reg-examples-*.pdf testCID.* \
90	  reg-plot-latin1.ps reg-plot.ps \
91	  reg-plot-latin1.pdf reg-plot.pdf reg-tests-*.pdf \
92	  R-exts.* R-intro.R no-segfault.R R-intro.Rout \
93	  p-qbeta-strict-tst.pdf
94	-@rm -f FALSE* PACKAGES* .R .tex mirrors.html ./-package.Rd ex.gz
95	-@rm -f testit.txt testit.html testit.tex testit-Ex.R
96	-@rm -f ver20.txt ver20.html ver20.tex ver20-Ex.R
97	-@rm -Rf anRpackage myTst* myLib myLib_2
98	-@rm -f *.tar.gz
99	-@rm -f keepsource.tex test-system2 test-system.Rout
100	-@rm -f *.log *.tsin *.trin
101	-@rm -f df0.Rd l0.Rd m0.Rd 'integer(0)-package.Rd' .Rd .RData
102	-@rm -f p-r-random-tests_seed Rprof.out* conditions.Rout timezone.Rout
103
104distclean: clean
105	-@for d in $(SUBDIRS); do \
106	  (cd $${d} && $(MAKE) $@); \
107	done
108	-@rm -f Makefile $(test-out) $(test-src-auto) *.Rout.fail
109	-@rm -Rf *.Rcheck RecPackages
110	-@rm -f *.fail
111
112maintainer-clean: distclean
113
114R install install-strip uninstall TAGS info dvi:
115
116install-tests:
117	@$(ECHO) "installing specific tests"
118	@$(MKINSTALLDIRS) "$(DESTDIR)$(rhome)/tests"
119	@$(MKINSTALLDIRS) "$(DESTDIR)$(rhome)/tests/Packages"
120	@for f in Makefile.common $(INSTFILES) eval-fns.R; do \
121	  $(INSTALL_DATA) $(srcdir)/$${f} "$(DESTDIR)$(rhome)/tests"; \
122	done
123	@$(INSTALL_DATA) $(srcdir)/Makefile.install \
124	  "$(DESTDIR)/$(rhome)/tests/Makefile"
125	@(cd Examples; $(MAKE) install-tests)
126
127uninstall-tests:
128	@$(ECHO) "uninstalling specific tests and removing results"
129	@rm -Rf "$(DESTDIR)$(rhome)/tests"
130
131distdir: $(DISTFILES)
132	@for f in $(DISTFILES); do \
133	  test -f $(distdir)/$${f} \
134	    || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
135	    || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
136	done
137	@for d in $(SUBDIRS); do \
138	  test -d $(distdir)/$${d} \
139	    || mkdir $(distdir)/$${d} \
140	    || exit 1; \
141	  chmod 755 $(distdir)/$${d}; \
142	  (cd $${d} && $(MAKE) distdir) \
143	    || exit 1; \
144	done
145	@for d in $(SUBDIRS_WITH_NO_BUILD); do \
146	  ((cd $(srcdir); $(TAR) -c -f - $(DISTDIR_TAR_EXCLUDE) $${d}) \
147	      | (cd $(distdir); $(TAR) -x -f -)) \
148	    || exit 1; \
149	done
150