The Makefile¶
The makefile module.
This module contains a series of definition that are used to represent a Makefile.
-
class
make_to_batch.makefile.Makefile¶ The representation of a Makefile.
It is composed of rules and variables. A Makefile starts with no rules and no variables.
-
__rules¶ The rules of the Makefile.
Type: Dict[str, Dict[List[str], List[str]]
-
__variables¶ The variables of the Makefile.
Type: Dict[str, Any]
-
add_rule(target: str, prerequisites: List[str], recipe: List[str]) → None¶ Add a rule to the Makefile.
Parameters: - target (str) – The new target’s name.
- prerequisites (List[str]) – The new target’s prerequisites.
- recipe (List[str]) – The new target’s recipe.
-
add_variable(name: str, value: Any) → None¶ Add a variable to the Makefile.
Parameters: - name (str) – The new variable’s name.
- value (Any) – The new variable’s value.
-
parse_file(file_content: str) → None¶ Parse an existing Makefile.
Parameters: file_content (str) – The content of an existing Makefile.
-
remove_rule(target: str) → None¶ Remove a rule from the Makefile.
If the rule is not in the Makefile, do nothing.
Parameters: target (str) – The target to be removed.
-
remove_variable(variable: str) → None¶ Remove a variable from the Makefile.
If the variable is not in the Makefile, do nothing.
Parameters: variable (str) – The variable to be removed.
-
to_batch() → str¶ Convert the Makefile to a Batch file.
Returns: The batch file’s content. Return type: str
-