I have a problem where I want to create a variable that looks like this,
INCDIRS = -I dir0 -I dir1 -Idir2 -I dir3 ... -I dirN
where dir1, … , dirN are the names of all the subdirectories some base directory, base_dir.
How would I go about building up this variable? Originally, I thought I could do the following,
INCDIRS = $(shell for x in `find base_dir -type -d -print`; do echo -I $x; done;)
but this just results in
INCDIRS = -I -I -I -I ... -I
If anyone could explain how to do this, or explain why my original command got the output that it did, I would greatly appreciate it. Thanks!
You have two errors in your
INCDIRSassignment. One is in thefindcommand. It should befind -type d -print(or justfind -type d; the-printis superfluous here). The other error the use of$x. You need to escape the$with another$: