-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (27 loc) · 893 Bytes
/
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
# Set this to the name of the folder containing your Stata .md files
stata_file_path = stata_markdown
# File all md files to process
md = $(shell find $(stata_file_path) -name "*.md")
Stata_Rmd = $(md:.md=.Rmd)
stata_markdown/%.Rmd: $(stata_file_path)/%.md
@echo "$< -> $@"
@/Applications/Stata/StataSE.app/Contents/MacOS/stata-se -b 'dyntext "$<", saving("$@") replace nostop'
# Using <<dd_do: quiet>> produces empty codeblocks in output, remove them
@perl -0777 -i -pe 's/~~~~\n~~~~//g' $@
index.html: index.Rmd $(Stata_Rmd)
@echo "$< -> $@"
# Bring images temporarily up to main directory
@cp $(stata_file_path)/*.svg . 2>/dev/null || :
@Rscript -e "rmarkdown::render('$<')"
# Remove any images copied up
@rm -rf *.svg
.PHONY:default
default: $(Stata_Rmd) index.html
.PHONY:clean
clean:
@git clean -xdf
.PHONY:fresh
fresh: clean default
.PHONY:open
open:
@open index.html