]> git.donarmstrong.com Git - lib.git/commitdiff
add knitr rules and xls/txt conversion to mk
authorDon Armstrong <don@donarmstrong.com>
Tue, 10 Mar 2015 23:57:12 +0000 (16:57 -0700)
committerDon Armstrong <don@donarmstrong.com>
Tue, 10 Mar 2015 23:57:12 +0000 (16:57 -0700)
mk/knitr_rules.mk [new file with mode: 0644]
mk/xls_txt_conversion.mk [new file with mode: 0644]

diff --git a/mk/knitr_rules.mk b/mk/knitr_rules.mk
new file mode 100644 (file)
index 0000000..5d1bc7e
--- /dev/null
@@ -0,0 +1,15 @@
+R ?= R
+
+%.pdf: %.svg
+       inkscape -A $@ $<
+       pdfcrop $@
+       mv $(dir $@)*-crop.pdf $@
+
+%.png: %.svg
+       inkscape -e $@ -d 300 $<
+
+%.tex: %.Rnw
+       $(R) --encoding=utf-8 -e "library('knitr'); knit('$<')"
+
+%.pdf: %.tex $(wildcard *.bib) $(wildcard *.tex)
+       latexmk -pdf -pdflatex='xelatex -interaction=nonstopmode %O %S' -bibtex -use-make $<
diff --git a/mk/xls_txt_conversion.mk b/mk/xls_txt_conversion.mk
new file mode 100644 (file)
index 0000000..bc04031
--- /dev/null
@@ -0,0 +1,16 @@
+SSCONVERT ?=ssconvert
+
+%.xls: %.gnumeric
+       $(SSCONVERT) --export-type Gnumeric_Excel:excel_dsf $< $@
+
+%.txt: %.gnumeric
+       $(SSCONVERT) --export-type Gnumeric_stf:stf_assistant -O 'separator="   " quote="" eol="unix"' $< $@
+
+%.txt: %.xls
+       $(SSCONVERT) --export-type Gnumeric_stf:stf_assistant -O 'separator="   " quote="" eol="unix"' $< $@
+
+%.txt: %.xlsx
+       $(SSCONVERT) --export-type Gnumeric_stf:stf_assistant -O 'separator="   " quote="" eol="unix"' $< $@
+
+%.xls: %.txt
+       txt2xls $< > $@