BD = run
RD = res
SD = src
CD = test
DD = data
CF = conf
LD = log
BASE = baserun
useR = /usr/share/R-3.4.0/bin/R --slave --vanilla

plot: res.RData.exe
	rm -f $(LD)/plot.*
	echo 'source("src/plot.R");' | $(useR) --slave --vanilla 1> $(LD)/plot.out 2> $(LD)/plot.out2 || (mv $(LD)/plot.out2 $(LD)/plot.err; exit 1)


res.RData.exe: $(SD)/mussel.R $(DD)/data.zip
	rm -f $(LD)/model.*
	echo 'source("src/mussel.R");' | $(useR) --slave --vanilla 1> $(LD)/model.out 2> $(LD)/model.out2 || (mv $(LD)/model.out2 $(LD)/model.err; exit 1) 
##	mv $(LD)/plot.err $(LD)/plot.log
