Skip to main content

export_makefile

Function export_makefile 

Source
pub fn export_makefile(
    session: &Session,
    params: Option<&[Parameter]>,
) -> String
Expand description

Export a session as a Makefile.

Generates a Makefile with:

  • Header comments (session name, date, command count)
  • Make variable declarations when parameters are provided (VAR ?= value)
  • .PHONY targets for each step
  • Tab-indented recipes with cd && command per target
  • Dollar sign escaping ($$$)
  • Annotations for failed commands

When params is Some, commands have auto-detected values replaced with $(VAR) references and variable declarations are added before targets.

Each target runs independently with its own cd because Makefile recipe lines each execute in a separate shell.

Empty sessions produce a valid Makefile with a “No commands recorded” note.