Makefile.win 4.82 KB
Newer Older
Radford Neal's avatar
Radford Neal committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#-*- Makefile -*-
#
# ${R_HOME}/src/library/Makefile

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

include ../gnuwin32/MkRules
include ../../share/make/vars.mk

ECHO = echo
MKINSTALLDIRS = mkdir -p
INSTALL_DATA = cp
RVER = $(shell cut -d' ' -f1 ../../VERSION | sed -n 1p)

R_EXE = $(top_builddir)/$(BINDIR)/Rterm --vanilla --slave

.SUFFIXES: .Rdts

all: R

## beware there is a bootstrapping problem here: tools uses tools to
## dump its namespace. So it works initially, but not to update.
Radford Neal's avatar
Radford Neal committed
25 26 27 28 29
## When base is made we need to use 'date' to set the timestamp in
## its DESCRIPTION, so we remake it before dumping the DESCRIPTION files.

## VERSION is needed to use mkdesc2 in packages base and tools.
## R_ARCH is needed for etc$(R_ARCH)/Makecomf in */src/Makefile.win
Radford Neal's avatar
Radford Neal committed
30 31
R:
	@$(MKINSTALLDIRS) $(top_builddir)/library
Radford Neal's avatar
Radford Neal committed
32 33 34 35
	@for pkg in base tools compiler; do \
	  $(MAKE) -C $${pkg} -f Makefile.win R_ARCH=$(R_ARCH) VERSION=$(RVER) \
	    all install-tests || exit 1; \
	done
36
	@if [ x$(R_NO_BASE_COMPILE) != xFALSE ]; then \
Radford Neal's avatar
Radford Neal committed
37
	  for pkg in base tools; do \
38
	    $(MAKE) -C $${pkg} -f Makefile.win Rlazy || exit 1; \
Radford Neal's avatar
Radford Neal committed
39 40 41
	  done; \
	else \
	  for pkg in base tools; do \
42
	    $(MAKE) -C $${pkg} -f Makefile.win mklazycomp || exit 1; \
Radford Neal's avatar
Radford Neal committed
43 44 45
	  done; \
	fi
	@for pkg in $(R_PKGS_BASE1); do \
Radford Neal's avatar
Radford Neal committed
46
	  $(MAKE) -C $${pkg} -f Makefile.win R_ARCH=$(R_ARCH) \
Radford Neal's avatar
Radford Neal committed
47
	     all install-tests || exit 1; \
Radford Neal's avatar
Radford Neal committed
48
	done
Radford Neal's avatar
Radford Neal committed
49
	@(cd base && $(MAKE) -f Makefile.win mkdesc)
Radford Neal's avatar
Radford Neal committed
50
	@$(ECHO) "tools:::.vinstall_package_descriptions_as_RDS(\"$(top_builddir)/library\", \"$(R_PKGS_BASE)\")" | \
51
	  R_DEFAULT_PACKAGES=tools LC_ALL=C $(R_EXE) > $(R_BIT_BUCKET)
Radford Neal's avatar
Radford Neal committed
52 53 54
	@$(ECHO) "installing parsed NAMESPACE files"
	@rm -f $(top_builddir)/library/tools/Meta/nsInfo.rds
	@$(ECHO) "tools:::.vinstall_package_namespaces_as_RDS(\"$(top_builddir)/library\", \"$(R_PKGS_BASE)\")" | \
55
	  R_DEFAULT_PACKAGES=tools LC_ALL=C $(R_EXE) > $(R_BIT_BUCKET)
Radford Neal's avatar
Radford Neal committed
56 57 58 59 60 61 62 63 64 65 66 67

## do Rdobjects before metadata before help indices
docs:
	@$(MAKE) -f Makefile.win Rdobjects
	@$(MAKE) -f Makefile.win metadata
	@$(MAKE) -f Makefile.win help-indices
ifeq ($(strip $(BUILD_HTML)),YES)
	@$(MAKE) -f Makefile.win Rdfiles
endif
	@touch stamp-docs

# fix the order to make best use of parallel builds
Radford Neal's avatar
Radford Neal committed
68
RD-TS = base.Rdts stats.Rdts utils.Rdts methods.Rdts graphics.Rdts grDevices.Rdts datasets.Rdts grid.Rdts tools.Rdts tcltk.Rdts splines.Rdts stats4.Rdts compiler.Rdts parallel.Rdts
Radford Neal's avatar
Radford Neal committed
69 70 71 72
# RD-TS = $(R_PKGS_BASE:=.Rdts)
Rd-ts: $(RD-TS)

%.Rdts:
Radford Neal's avatar
Radford Neal committed
73
	@$(ECHO) "options(warn=1);tools:::.install_package_Rd_objects(\"$(srcdir)/$*\", \"$(top_builddir)/library/$*\")" | R_DEFAULT_PACKAGES=NULL $(R_EXE) || exit 1
Radford Neal's avatar
Radford Neal committed
74 75 76 77 78 79 80 81 82 83 84
	@$(ECHO) -n " $*$(ECHO_C)"

Rdobjects:
	@$(ECHO) -n "installing parsed Rd:"
	@$(MAKE) -f Makefile.win Rd-ts
	@$(ECHO)

help-indices:
	@$(ECHO) -n "writing indices for package:"
	@for pkg in $(R_PKGS_BASE); do \
	  $(ECHO) -n " $${pkg}" ; \
Radford Neal's avatar
Radford Neal committed
85
	  $(ECHO) "options(warn=1);tools:::.writePkgIndices(\"$${pkg}\", \"$(top_builddir)/library/$${pkg}\")" | R_DEFAULT_PACKAGES=utils LC_ALL=C $(R_EXE) || exit 1; \
Radford Neal's avatar
Radford Neal committed
86 87 88 89 90 91 92 93 94 95
	done
	@$(ECHO)

## FIXME: do this in parallel (but avoid interleaving output)
Rdfiles:
	@$(ECHO) "building all R object docs"
	@for pkg in $(R_PKGS_BASE); do \
	  $(ECHO) "tools:::.convertRdfiles(\"$(srcdir)/$${pkg}\", \"$(top_builddir)/library/$${pkg}\", silent = TRUE)" | LC_ALL=C $(R_EXE) || exit 1; \
	done

Radford Neal's avatar
Radford Neal committed
96 97 98 99 100 101
vignettes:
	@for pkg in grid parallel utils; do \
	    $(ECHO) "building/updating vignettes for package '$${pkg}' ..."; \
	    ($(ECHO) "tools:::.install_package_vignettes(\"$(srcdir)/$${pkg}\", \"$(top_builddir)/library/$${pkg}\")") | \
	        R_DEFAULT_PACKAGES="utils,tools" LC_ALL=C \
		  R_LIBS_USER= R_LIBS_SITE= \
102
	          $(R_EXE) > $(R_BIT_BUCKET); \
Radford Neal's avatar
Radford Neal committed
103 104 105
	done
	@rm -rf .vignettes

Radford Neal's avatar
Radford Neal committed
106 107 108
metadata:
	@$(ECHO) "building/updating package metadata ..."
	@$(ECHO) "tools:::.vinstall_package_indices(\"$(srcdir)\", \"$(top_builddir)/library\", \"$(R_PKGS_BASE)\")" | \
109
	  R_DEFAULT_PACKAGES=tools LC_ALL=C $(R_EXE) > $(R_BIT_BUCKET)
Radford Neal's avatar
Radford Neal committed
110 111 112 113

clean:
	@for pkg in $(R_PKGS_BASE); do \
	  $(MAKE) --no-print-directory -C $${pkg} \
Radford Neal's avatar
Radford Neal committed
114
	    -f Makefile.win R_ARCH=$(R_ARCH) clean-win; \
Radford Neal's avatar
Radford Neal committed
115 116 117
	done
	-@rm -f stamp-*

Radford Neal's avatar
Radford Neal committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145

### ----------- targets for R-core use ----------
### These are intended to be run on an already-built R, possibly after
### editing the code in a standard package.
### Targets of the same name can be run in individual package directories.
### These do not change datasets (no R code)
### R_PKGS_BASE2 is all except datasets and methods.

### They are not currently safe for a parallel make.

## methods needs to be dumped, so is omitted here.
Rsimple:
	@for pkg in $(R_PKGS_BASE2); do \
	  $(MAKE) -C $${pkg} -f Makefile.win Rsimple || exit 1; \
	done

## Lazy-loaded, not compiled
Rlazy:
	@for pkg in $(R_PKGS_BASE2) methods; do \
	  $(MAKE) -C $${pkg} -f Makefile.win Rlazy || exit 1; \
	done

## Lazy-loaded, compiled
Rlazycomp:
	@for pkg in $(R_PKGS_BASE2) methods; do \
	  $(MAKE) -C $${pkg} -f Makefile.win Rlazycomp || exit 1; \
	done