I want to generate a file at execution of recipe time that lists every word of a variable in a seperate line of the file. Here is the start of the rule. Every word in $(OBJ_LIST) should be put into make_temp. Note: $(OBJ_LIST) is a list of .o files. Note: using > for .RECIPEPREFIX.
$(MDIR)zzz.exe: $(OBJ_LIST)
> if exist make_temp del make_temp
If I put these 3 lines under this then the file will have the first 3 words in the file.
> echo $(word 1,$+) >> make_temp
> echo $(word 2,$+) >> make_temp
> echo $(word 3,$+) >> make_temp
I have tried to use foreach and eval to do this.
> $(foreach obj,$+,$(eval > echo $(obj) >> make_temp))
This comes up with the error makefile.min:473: * recipe commences before first target. Stop. This is the same error that would come up when I put a line with > on a line with no rule starting syntax before it. So it would seem that this does not continue the current recipe list which is what I want to do.
How can I make the foreach and eval continue the current recipe list and/or generate the list of files using alternative methods.
makecan do this, have you considered usingtrfor this? As in:echo $(word) | tr ' ' '\n' > make_temp. - Thor