I have a variable stoppoint defined in my makefile.
I want to set this variable using the output of awk from withing my Makefile.
I want to see if the second argument is main or not
I have tried:
stoppoint = $(awk '$$2 ~ /main/ {print $$1}' file)
stoppoint = "$(awk '$$2 ~ /main/ {print $$1}' file)"
stoppoint = 'awk '$$2 ~ /main/ {print $$1}' file'
awk '$$2 ~ /main/ {print $$1}' file > stoppoint
awk '$$2 ~ /main/ {print $$1}' file > $(stoppoint)
However, I am unable to set this variable.
Kindly tell me how one can set a variable using awk inside a Makefile
PS: On command line, the awk command gives me the output I desire…
Thanks,
Tejas
The solution is simple:
Makefile assumed the format
target: dependencies followed on the next line by actions after a
TABIn the above case, we cannot set a variable in the next line after a
TABbecause it assumes it to be an action. Just remove theTABand set it.That would solve the issue