#!/usr/bin/make
all:html pdf

html: $(patsubst %.Rmd,%.html,$(wildcard *.Rmd)) 
pdf: $(patsubst %.Rmd,%.pdf,$(wildcard *.Rmd)) 

remembr.RDS:
	rsync klone:/gscratch/comdata/users/nathante/ml_measurement_error/mi_simulations/remembr.RDS .

%.pdf:  %.html
	Rscript -e 'xaringan::decktape("$<","$@",docker=FALSE)'

%.html: %.Rmd *.css remembr.RDS
	Rscript -e 'library(rmarkdown); rmarkdown::render("$<", output_file = "$@")'
#	firefox "$@"

clean:
	rm *.html
	rm -r *_files
	rm -r *_cache

publish: all pdf
	scp -r *.html groc:/home/nathante/public_html/slides/measurement_error_comdatahack_2022.html
	scp -r *.pdf groc:/home/nathante/public_html/slides/measurement_error_comdatahack_2022.pdf

.PHONY: clean all
