-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (57 loc) · 1.87 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
R.OPTS := --vanilla
fname := ct-covid-map
rmd = $(fname).Rmd
source = $(fname).R
date := $(shell date "+%Y%m%d")
.phoney: help tagfile plots flex html2web publish nocache nopartials noreports clean
## Few targets correspond to files, so, list them here to ensure they always run.
help:
## Print Constants and Targets defined in this Makefile
@echo Constants::
@echo R.OPTS: $(R.OPTS)
@echo fname: $(fname)
@echo rmd: $(rmd)
@echo source: $(source)
@echo outname: $(outname)
@echo date: $(date)
@echo
@echo Targets::
@echo --
@grep -E -A 1 "^[^\# ]+:" Makefile
@echo --
@echo
tagfile:
## build 'TAGS' file using utils::rtags() # pattern='[.]([Rr]([mM][dD])*)$$'
R $(R_OPTS) -e "utils::rtags(pattern='[.][Rr]$$', ofile='TAGS', type='etags')"
### building reports
plots:
# render figures
R $(R_OPTS) -e "source('"$(source)"')"
flex:
# render html document
R $(R_OPTS) -e "rmarkdown::render('"$(rmd)"', output_format='flexdashboard::flex_dashboard')"
### deploy report to web
html2web:
# make html page suitable for web deployment & put it in '/docs/' folder
sed '/CT COVID Map: Variations/ r gtag.js' < $(fname).html > tmp0.html ## insert google analytics tag below page title
sed '/CT COVID Map: Variations/ r html-meta.txt' < tmp0.html > index.html ## insert meta tags below page title
mv --backup index.html ./docs/.
rm -f tmp0.html
publish: flex html2web
# stage and commit webpage changes, then push changes to github
git add --verbose 'docs/*'
git commit --verbose -m "update webpage"
git push --verbose --all
### cleaning up
nocache:
# delete cache files
rm -rf $(fname)_cache $(fname)_files
nopartials:
# delete intermediate files
rm -f $(fname).aux $(fname).log $(fname).out
rm -f $(fname).tex $(fname).toc
rm -f $(fname).md $(fname).knit.md $(fname).utf8.md
noreports:
# delete formatted reports
rm -f $(fname).html $(fname).pdf
clean: nocache nopartials noreports