make: Mock the Unix Make Utility

View source: R/make.R

makeR Documentation

Mock the Unix Make Utility

Description

Mock the Unix Make Utility

Usage

make(
  name,
  make_list,
  force = FALSE,
  recursive = force,
  verbose = FALSE,
  verbosity = 2,
  dry_run = FALSE,
  unconditionally = FALSE,
  stop_on_warning = FALSE
)

Arguments

name

The name or alias of a make target.

make_list

The makelist (a listed version of a Makefile).

force

Force the target to be build? See Details.

recursive

Force the target to be build recursively? See Details.

verbose

Be verbose?

verbosity

Give the level of verbosity.

dry_run

Run dry? Mock GNU make's -n option.

unconditionally

Force the target's code to be evaluated unconditionally to any prerequisites? See Details.

stop_on_warning

Throw an error and abort if a recipe throws a warning?

Details

force, recursive
Forcing a target mocks adding .PHONY to a GNU Makefile if you set recursive to FALSE. If recursive is TRUE, then the whole make chain will be forced.

unconditionally
Setting unconditionally to TRUE allows you to fool make similarily to using GNU make's –touch option.

Value

Invisibly a character vector containing the targets made during the current run.

Examples

str(make_list <- provide_make_list("minimal"))
# build all
withr::with_dir(tempdir(), print(make("all.Rout", make_list)))
# nothing to be done
withr::with_dir(tempdir(), print(make("all.Rout", make_list)))
# forcing all.Rout
withr::with_dir(tempdir(), print(make("all.Rout", make_list, force = TRUE,
                                      recursive = FALSE)))
# forcing all.Rout recursively
withr::with_dir(tempdir(), print(make("all.Rout", make_list, force = TRUE))) 

# show files
dir(tempdir(), pattern = ".*\\.Rout")

# dry run
file.remove(dir(tempdir(), pattern = ".*\\.Rout", full.names = TRUE))
withr::with_dir(tempdir(), print(make("all.Rout", make_list,
                                      dry_run = TRUE)))
dir(tempdir(), pattern = ".*\\.Rout")

# make unconditionally
dir(tempdir(), pattern = ".*\\.Rout")
withr::with_dir(tempdir(), print(make("all.Rout", make_list,
                                      unconditionally = TRUE)))
dir(tempdir(), pattern = ".*\\.Rout")


fakemake documentation built on Aug. 16, 2023, 1:09 a.m.