#
# ${R_HOME}/src/library/datasets/Makefile

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

top_builddir = ../../..
subdir = src/library/datasets

include $(top_builddir)/Makeconf

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

pkg = datasets

R_EXE = $(top_builddir)/bin/R --vanilla --no-echo

all: Makefile DESCRIPTION
	@$(ECHO) "building package '$(pkg)'"
	@$(MKINSTALLDIRS) $(top_builddir)/library/$(pkg)
	@$(MAKE) mkR mkdesc
	@$(MKINSTALLDIRS) $(top_builddir)/library/$(pkg)/data
	@for f in $(srcdir)/data/*; do \
	  $(INSTALL_DATA) $${f} $(top_builddir)/library/$(pkg)/data; \
	done
	@rm -f $(top_builddir)/library/$(pkg)/data/Rdata.*
	@$(ECHO) "tools:::data2LazyLoadDB(\"$(pkg)\", compress=3)" | \
	  R_DEFAULT_PACKAGES=NULL LC_ALL=C $(R_EXE) > /dev/null
	@$(INSTALL_DATA) $(srcdir)/data/morley.tab \
	  $(top_builddir)/library/$(pkg)/data

include $(top_srcdir)/share/make/basepkg.mk

mkR:
	@$(INSTALL_DATA) $(srcdir)/NAMESPACE $(top_builddir)/library/$(pkg)
	@rm -f $(top_builddir)/library/$(pkg)/Meta/nsInfo.rds


# dummy targets
Rsimple Rlazy Rlazycomp:
