I'm completely stumped on how to do this in a Makefile
Let's say I have a target. Inside the target I have a loop. How do i change a variable to keep track of the iterations?
For example:
COUNTER = 0
target:
(loop){
COUNTER++
echo COUNTER
}
I know that variables in Makefiles are only expanded, and I'm not sure if they can be permanently changed, but there has to be a way to do this, right? :(
Here are some sources that are asking similar questions. It seems like those examples only change the variable temporarily:
- How do I perform arithmetic in a makefile?
- How to do arithmetic operation in makefile?
- Doing simple math in Makefile
Maybe I have to use the eval
function somehow?
Maybe I have to append onto a Makefile string a character each time and then use something in the shell to count the characters?