Description Usage Arguments Details Value Author(s) See Also Examples
In the (GNU) make
jargon, rule is a sequence of commands to build a result. In this package, rule
should be understood similarly: It is a command or a sequence of command that optionally produces some
files and depends on some other files (such as data files, scripts) or other rules. Moreover, a rule
contain a command for cleanup, i.e. for removal of generated files.
1 2 3 |
job |
A list of rules (i.e. of instances of the S3 class |
fileName |
A file to write to. If |
makeScript |
A name of the file that calls this function (in order to generate
the |
vars |
A named character vector of shell variables that will be declared in the resulting Makefile
(additionally to |
all |
|
tasks |
|
clean |
|
makefile |
|
The makefile()
function takes a list of rules (see rule()
) and generates a Makefile
from them.
Additionally, all
and clean
rules are optionally generated too, which can be executed from shell
by issuing make all
or make clean
command, respectively, in order to build everything or erase all
generated files.
If there is a need to group some rules into a group, it can be done either via dependencies or by using
the task
mechanism. Each rule may get assigned one or more tasks (see task
in rule()
). Each
task is then created as a standalone rule depending on assigned rules. That way, executing make task_name
will build all rules with assigned task task_name
. By default, all rules are assigned to task all
,
which allows make all
to build everything.
If fileName
is NULL
, the function returns a character vector with the contents of the
Makefile. Instead, the content is written to the given fileName
.
Michal Burda
1 2 3 4 5 6 7 8 9 10 11 12 | # create some jobs
job <- list(
rRule('dataset.rds', 'preprocess.R', 'dataset.csv'),
markdownRule('report.pdf', 'report.Rmd', 'dataset.rds'),
markdownRule('details.pdf', 'details.Rmd', 'dataset.rds'))
# generate Makefile (output as a character vector)
makefile(job)
# generate to file
tmp <- tempdir()
makefile(job, file.path(tmp, "Makefile"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.