#-*- Makefile -*-
#
# ${R_HOME}/src/library/base/Makefile

srcdir = .
top_srcdir = ../../..

top_builddir = ../../..
subdir = src/library/base

include $(top_builddir)/Makeconf

pkg = base

R_OSTYPE = windows
RSRC = `LC_COLLATE=C ls $(srcdir)/R/*.R $(srcdir)/R/$(R_OSTYPE)/*.R`

all:
	@$(ECHO) "building package '$(pkg)'"
	@$(MKINSTALLDIRS) $(top_builddir)/library/$(pkg)
	@$(MAKE) -f Makefile.win mkR1 mkdesc2 mkdemos2
	@$(INSTALL_DATA) $(srcdir)/inst/CITATION $(top_builddir)/library/$(pkg)
	@if ! test $(top_builddir)/library/$(pkg)/R/$(pkg) -nt all.R; then \
	  $(INSTALL_DATA) all.R $(top_builddir)/library/$(pkg)/R/$(pkg); \
	fi

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

## Note that R_COMPILER_SUPPRESS_ALL is now on by default
$(top_builddir)/library/$(pkg)/R/$(pkg).rdb: all.R
	@$(ECHO) "byte-compiling package '$(pkg)'"
	@cat $(srcdir)/makebasedb.R | \
	  _R_COMPILE_PKGS_=1 R_COMPILER_SUPPRESS_ALL=1 \
	  R_DEFAULT_PACKAGES=NULL LC_ALL=C $(R_EXE) > /dev/null
	@$(INSTALL_DATA) $(srcdir)/baseloader.R \
	  $(top_builddir)/library/$(pkg)/R/$(pkg)

mkR: mkR1

Rsimple: mkR mkRsimple

Rlazy: mkR mkRsimple
	@cat $(srcdir)/makebasedb.R | \
	  R_DEFAULT_PACKAGES=NULL LC_ALL=C $(R_EXE) > /dev/null
	@$(INSTALL_DATA) $(srcdir)/baseloader.R \
	  $(top_builddir)/library/$(pkg)/R/$(pkg)

Rlazycomp: mkR mkRsimple mklazycomp
