Commit 304c209a authored by Daniel Falster's avatar Daniel Falster
Browse files

fix Makefile for docs

No related merge requests found
Showing with 300 additions and 31 deletions
+300 -31
......@@ -12,4 +12,4 @@ figs
*.html
*.Rdata
*.rds
site_description.md
docs/metadata/sites
SITES := BCI Canada France Fushan NSW NVS Paracou Spain Sweden Swiss US
OBJDIR := ../../docs/metadata/sites
OBJS := $(addsuffix .md, $(addprefix $(OBJDIR)/, $(SITES)))
all: $(OBJS)
%.md:
Rscript knit_site_description.R $@
.PHONY: all
......@@ -5,11 +5,12 @@ library(markdown, quietly = TRUE)
library(rjson, quietly =TRUE)
library(pander, quietly =TRUE)
args <- commandArgs(TRUE)
# Generate tables for each file
for(DIR in dir("metadata", full.names = TRUE)){
cat(paste("\n", DIR))
fname <- "site_description"
mdfile <- knit(paste0(fname, ".Rmd"), output = file.path(DIR, paste0(fname, ".md"))) # produces the md file
system(paste0("pandoc -V geometry:a4paper -V geometry:margin=1in ", mdfile, " -o ", file.path(DIR, paste0(fname, ".pdf"))))
}
TARGET <- args[1] # accepts argument from command line
SITE = basename(tools::file_path_sans_ext(TARGET))
DIR <- file.path("../../data/metadata/sites", SITE) # this variable required by knitr script
cat(DIR)
knit("site_description.Rmd", output = TARGET)
# produces the md file
all: metadata base meeting
base: data.format.pdf
meeting:
make -C meeting
%.pdf: %.md
pandoc $< -V linkcolor:black -V geometry:a4paper -V geometry:margin=0.5in --listings --include-in-header=include.tex -o $@
metadata: meta_data_all.pdf
INPUTS=metadata/BCI/site_description.md metadata/Canada/site_description.md metadata/France/site_description.md metadata/Fushan/site_description.md metadata/NSW/site_description.md metadata/NVS/site_description.md metadata/Paracou/site_description.md metadata/Spain/site_description.md metadata/Sweden/site_description.md metadata/Swiss/site_description.md metadata/US/site_description.md
${INPUTS}:
Rscript knit_site_description.R
all: analysis agenda
meta_data_all.pdf: ${INPUTS}
pandoc -V linkcolor:black -V geometry:a4paper -V geometry:margin=0.5in --listings --include-in-header=include.tex ${INPUTS} -o $@
clean:
find . -name '*.pdf' -delete
find . -name 'site_description.md' -delete
analysis:
make -C analysis.plan
agenda:
make -C meeting.agenda
.PHONY: all base metadata clean
TARGETS = $(subst md,pdf,$(shell ls *.md))
all: $(TARGETS)
%.pdf: %.md
pandoc $< -V linkcolor:black -V geometry:a4paper -V geometry:margin=1in --listings --include-in-header=../include.tex -o $@
clean:
rm -f *.pdf
This diff is collapsed.
File moved
File moved
File moved
File moved
File moved
all: metadata
metadata: all.pdf
INPUTS=metadata/BCI/site_description.md metadata/Canada/site_description.md metadata/France/site_description.md metadata/Fushan/site_description.md metadata/NSW/site_description.md metadata/NVS/site_description.md metadata/Paracou/site_description.md metadata/Spain/site_description.md metadata/Sweden/site_description.md metadata/Swiss/site_description.md metadata/US/site_description.md
${INPUTS}:
Rscript ../../knit_site_description.R
meta_data_all.pdf: ${INPUTS}
pandoc -V linkcolor:black -V geometry:a4paper -V geometry:margin=0.5in --listings --include-in-header=include.tex ${INPUTS} -o $@
clean:
find . -name '*.pdf' -delete
find . -name 'site_description.md' -delete
.PHONY: all base metadata clean
File moved
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment