MJDIR=		/p/stat/Data/MJ/Rlib
SRC=		$(MJDIR)/$(RLIBDIR)/*.R
DATA=		$(MJDIR)/$(RLIBDIR)/../data/*.tab
HELPDIR=	S/help
MANDIR=		mj/man
RLIBDIR=	mj/R
RINSTALL=	/p/stat/Data/pda/R
FORCE=		-f

all:	R help zip

R:	$(RINSTALL)/mj/R/mj

$(RINSTALL)/mj/R/mj:	$(SRC) $(MANDIR)/*.Rd $(DATA)
	/unsup/R/bin/R INSTALL -l $(RINSTALL) mj

zip:	$(RINSTALL)/mj.zip

$(RINSTALL)/mj.zip:	$(RINSTALL)/mj/R/mj $(RINSTALL)/mj/INDEX
	(cd $(RINSTALL);\
	zip -r mj.zip mj)

test:
	/unsup/R/bin/R INSTALL -l /common/tmp/bsy mj

help:	$(HELPDIR)/int.plot

$(HELPDIR)/int.plot: $(MANDIR)/*.Rd
	touch $(HELPDIR)/int.plot
	@for cmd in $?; do\
	   base=`basename $${cmd} .Rd`;\
	   echo $${base};\
	   /unsup/R/bin/R CMD Rdconv -t nroff $${cmd} > $(MJDIR)/$(HELPDIR)/$${base};\
	done
	(cd $(HELPDIR);\
	rm $(FORCE) ci.plot lsd.plot mandel.plot lsd.bar mpoints mlines char \
	   circle lpq enscript cov.coef se.coef all.covars all.covariates \
	   all.predictors model.response effect.fit get.factor;\
	ln lpr lpq;\
	ln lpr enscript;\
	ln cor.coef cov.coef;\
	ln cor.coef se.coef;\
	ln all.factors all.covars;\
	ln all.factors all.covariates;\
	ln all.factors all.predictors;\
	ln all.factors model.response;\
	ln ellipse circle;\
	ln mplot mpoints;\
	ln mplot mlines;\
	ln mplot char;\
	ln int.plot ci.plot;\
	ln int.plot lsd.plot;\
	ln effect.plot effect.fit;\
	ln tukey.plot mandel.plot;\
	ln get.list get.factor;\
	ln se.bar lsd.bar)
