-
-
Save rkrug/075117265cb271a06c7b810c56a26a18 to your computer and use it in GitHub Desktop.
Basic makefile
This file contains 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 | |
# Forked from https://gist.github.com/PirateGrunt/e8ec52fe412f5069f2a0#file-makefile | |
#################### | |
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