Reputation: 28591
I have the following code in my makefile:
S_RES=$(shell cat output)
echo -e "Serial result = \t" $(S_RES)
Basically, I want to store the output of the shell command cat output
in the S_RES variable, and then echo that variable to the screen (with some explanatory text in front of it). I also want to be able to use the variable later on in my program. I thought I had followed the instructions given in various StackOverflow questions, but it doesn't seem to work.
Upvotes: 23
Views: 50101
Reputation: 71
just a side note
this evaluates on use time, this is as many times as $(A) is used
A = something
this evaluates on parse time, thus the value is evaluates once
A := something
Upvotes: 7
Reputation: 11669
If simple space instead of escape sequence \t
is allowed, and your make
is
GNU make
3.81 or higher, $(info)
is available.
For example:
$(info Serial result = $(S_RES))
If your make
's version is 3.80 or lower, $(warning)
might meet the
purpose. However, warning
prints line number etc. too.
EDIT:
For your information, the following makefile outputs abc
on my GNU make 3.81.
A := $(shell echo abc)
$(info $(A))
Upvotes: 44