I\'m trying to assign the output of this command ( that is in my makefile ) to the makefile HEADER var like in this following line of code:
HEADER = $(shell
You will need to double-escape the $
character within the shell command:
HEADER = $(shell for file in `find . -name *.h`;do echo $$file; done)
The problem here is that make will try to expand $f
as a variable, and since it doesn't find anything, it simply replaces it with "". That leaves your shell command with nothing but echo ile
, which it faithfully does.
Adding $$
tells make to place a single $
at that position, which results in the shell command looking exactly the way you want it to.
Why not simply do
HEADER = $(shell find . -name '*.h')
The makefile tutorial suggested to use wildcard
to get list of files in a directory. In your case, it means this :
HEADERS=$(wildcard *.h)