knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 5 ) library(rmake)
This vignette covers the essential aspects of managing an rmake project, including project initialization, running the build process, cleaning up generated files, and executing builds in parallel.
For an introduction to rmake concepts and basic usage, see the Getting Started with rmake vignette. For detailed information on rule types, see the Build Rules vignette. For advanced features like tasks and templates, see the Tasks and Templates vignette.
To start maintaining an R project with rmake, create a script Makefile.R that generates the Makefile. Start from a skeleton:
library(rmake) rmakeSkeleton(".")
This creates two files:
- Makefile.R - R script with rule definitions
- Makefile - Generated Makefile
Initial Makefile.R:
library(rmake) job <- list() makefile(job, "Makefile")
Execute make from within R:
make()
Or from shell:
make
In RStudio: 1. Build > Configure Build Tools 2. Set Project build tools to Makefile 3. Use Build All command
Delete all generated files:
make("clean")
Each rule automatically adds commands to delete its target files. The Makefile itself is never deleted.
GNU Make supports parallel execution with the -j option:
make("-j8") # Run up to 8 tasks simultaneously
From shell:
make -j8
This vignette covered the basics of managing an rmake project:
rmakeSkeleton() to create initial project filesmake() from R or make from shell, or use RStudio's build toolsmake("clean") to remove generated filesmake("-j8") to run multiple targets simultaneouslyFor more information on related topics, see these vignettes:
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.