make.star¶
Read and set variables in Makefiles, such as GO_VERSION ?= 1.22.
Edits are line-based and keep the assignment operator (=, :=, ::=,
?=, +=), any export or override prefix, and trailing comments.
| Function | What it does |
|---|---|
makefiles |
Lists the repo's Makefiles. |
get_var |
Reads the value of the first assignment to a variable. |
set_var |
Sets every assignment to a variable, in every Makefile that has one. |
makefiles¶
Lists the repo's Makefiles.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The sorted paths of every Makefile, GNUmakefile, makefile and *.mk file outside vendor and node_modules.
Example
get_var¶
Reads the value of the first assignment to a variable.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
path |
The Makefile to read. |
name |
The variable name. |
Returns: The value as written, or None when the file doesn't assign it.
Example
set_var¶
Sets every assignment to a variable, in every Makefile that has one.
Makefiles that don't assign the variable are left alone. Appends
(+=) are left alone too, since they add to a value rather than set it.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
name |
The variable name. |
value |
The new value, as it should appear after the operator. |
files |
The Makefiles to edit; every Makefile by default. |
Returns: The list of paths that changed.
Example
Used in: make-go-version