The R Project SVN R

Rev

Rev 3957 | Rev 5320 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#
# ${R_HOME}/tests/Examples/Makefile

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

top_builddir = ../..
subdir = tests/Examples

include $(top_builddir)/Makeconf

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = Makefile.in

R = $(top_builddir)/bin/R --vanilla

PKGS = base eda lqs modreg mva stepfun
EX_IN = $(PKGS:=-Ex.R)
EX_OUT = $(EX_IN:.R=.Rout)
.SUFFIXES:
.SUFFIXES: .R .Rout
.SECONDARY: $(EX_IN)

all: Makefile test-Examples

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    cd $(top_builddir) && \
      CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
      $(SHELL) ./config.status

test-Examples: R $(EX_OUT)

R:
    @cd $(top_builddir) && $(MAKE) R

.R.Rout:
    @if [ -f $@.bak ]; then mv $@.bak $@.bakk ; fi
    @if [ -f $@ ]; then mv $@ $@.bak ; fi
    @echo "Running all help() examples ..."
    $(R) < $< > $@

%-Ex.R: FORCE
    @if [ -f $@.bak ]; then mv $@.bak $@.bakk ; fi
    @if [ -f $@ ]; then mv $@ $@.bak ; fi
    @echo "Collecting components of $@ ..."
    @cd $(top_builddir)/src/library && \
      OPTS="--nroff --example" $(MAKE) PKGS="$*" DOCS
    @echo "Massaging examples into $@ ..."
    @$(top_builddir)/bin/massage-Examples $* \
      $(top_builddir)/library/$*/R-ex/*.R > $@
FORCE:

mostlyclean: clean
clean:
    @rm -f *.R *.Rout *.Rd* *.ps *.tex *.dat* data foo*
distclean: clean
    @rm -f *.R*bak *.R*bakk .RData sink-examp.txt Makefile
maintainer-clean: distclean

distdir: $(DISTFILES)
    @for f in $(DISTFILES); do \
      test -f $(distdir)/$${f} \
        || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
        || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
        done