My directory :
$ ls *
Makefile
dir1:
file1.txt file2.txt
dir2:
file1.txt
The Makefile :
A = $(wildcard ./dir1/*)
A += $(wildcard ./dir1/*)
B = $(dirname $(A))
print-% : ; @echo $* = $($*)
Outputs of print rule :
$ make print-A
A = ./dir1/file1.txt ./dir1/file2.txt ./dir1/file1.txt ./dir1/file2.txt
$ make print-B
B =
I would like the B
variable to have the list of my sub directory relative paths (./dir1/
and ./dir2/
) why this don't work ? It is ok if there is only on file in A
.
How is the $(dirname ...)
macro defined? $(dir ...)
may do what you expect.