-
-
Save njtierney/8809d71c057bda6655f620f20a1e4c8e to your computer and use it in GitHub Desktop.
Basic makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# Makefile | |
# Copyright Brian A. Fannin 2015 | |
#################### | |
RDIR = . | |
DATA_DIR = $(RDIR)/data | |
GATHER_DIR = $(DATA_DIR)/gather | |
GATHER_SOURCE = $(wildcard $(GATHER_DIR)/*.Rmd) | |
GATHER_OUT = $(GATHER_SOURCE:.Rmd=.docx) | |
PROCESS_DIR = $(DATA_DIR)/process | |
PROCESS_SOURCE = $(wildcard $(PROCESS_DIR)/*.Rmd) | |
PROCESS_OUT = $(PROCESS_SOURCE:.Rmd=.docx) | |
ANALYSIS_DIR = $(RDIR)/analysis | |
ANALYSIS_SOURCE = $(wildcard $(ANALYSIS_DIR)/*.Rmd) | |
ANALYSIS_OUT = $(ANALYSIS_SOURCE:.Rmd=.docx) | |
PRESENTATION_DIR = $(RDIR)/presentation | |
PRESENTATION_SOURCE = $(wildcard $(PRESENTATION_DIR)/*.Rmd) | |
PRESENTATION_OUT = $(PRESENTATION_SOURCE:.Rmd=.html) | |
KNIT = Rscript -e "require(rmarkdown); render('$<')" | |
all: $(GATHER_OUT) $(PROCESS_OUT) $(ANALYSIS_OUT) $(PRESENTATION_OUT) | |
######################### | |
## Gather | |
$(GATHER_DIR)/%.docx:$(GATHER_DIR)/%.Rmd | |
$(KNIT) | |
######################### | |
# Process | |
$(PROCESS_DIR)/%.docx:$(PROCESS_DIR)/%.Rmd $(GATHER_OUT) | |
$(KNIT) | |
######################### | |
# Analyze | |
$(ANALYSIS_DIR)/%.docx:$(ANALYSIS_DIR)/%.Rmd $(PROCESS_OUT) | |
$(KNIT) | |
######################### | |
# Present | |
$(PRESENTATION_DIR)/%.docx:$(PRESENTATION_DIR)/%.Rmd $(ANALYSIS_OUT) | |
$(KNIT) | |
clean: | |
rm -fv $(GATHER_OUT) | |
rm -fv $(PROCESS_OUT) | |
rm -fv $(ANALYSIS_OUT) | |
rm -fv $(PRESENTATION_OUT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment