Each file in the rules directory describes makefile rule to build a target. There are three types of rules:
When a target matching one of the above rules shows up as a dependancy for another target, the rule will be copied into the makefile, and makemake will attempt to recursively satisfy all dependancies of the rule, either with other rules, with files from the files directory, or with source files.
These rule files are composed of three sections:
The following objects are defined for use in the Python code:
Name | Type | Description |
---|---|---|
base | Global | If this is a pattern rule, the target filename stripped of its extension, otherwise None. |
command(cmd) | Function | Adds the command to the list of commands for make to execute. |
dir | Global | The directory prefix to the target |
dependon(item) | Function | Adds the item (which may be a list) to the end of the dependancies list. |
glob(pattern) | Function | Returns a list of files matching the given pattern |
os | Module | Standard OS module |
re | Module | Standard regular expression module |
readlist(filename[, dirname]) | Function | Opens the file, reads its contents as a list of lines, and strips off all the trailing newlines and whitespace. If dirname is set, all files in the returned list are prefixed with that directory name. All returned filenames are normalized to remove dir/../. |
string | Module | Standard string module |
target | Global | The filename of the target of this rule. |
The following string substitutions may be used in either the dependancy line or any of the make commands following it: