My project's directory structure is as follows:
My Makefile looks like this:
dir1_contents := $(wildcard dir1/*)
dir3_contents := $(wildcard dir3/*)
all: clean_dir1 clean_dir3
clean_dir1:
echo 'dir1_contents = $(dir1_contents)'
clean_dir3:
echo 'dir3_contents = $(dir3_contents)'
When I run make, this is what I get:
$ pwd
make-test
$ make -s
dir1_contents = dir1/dir2 dir1/file2.junk dir1/file3.junk
dir3_contents = dir3/file4.junk
I want to get the contents of dir1
in dir1_contents
. But I want to exclude file3.junk
from that list. How can I do it?
Perhaps I should use grep -v
? But I'm not sure that's the best way. Is there a built-in GNUMake function I can use here?