Issue for The Wildcard Function (Section 4.2.3)
Closed this issue · 1 comments
andrewhit commented
I got the opposite result, "wrong" can be printed while "objects" can't be printed.
zhuangyan@n25-146-090:~/coding/c/blah$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
zhuangyan@n25-146-090:~/coding/c/blah$ cat Makefile
wrong = *.o # Wrong
objects := $(wildcard *.c) # Right
some_binary:
touch f1.c
touch f2.c
echo $(objects)
echo $(wrong)
clean:
rm -f *.c
zhuangyan@n25-146-090:~/coding/c/blah$ make
touch f1.c
touch f2.c
echo
echo *.o
*.o
theicfire commented
This output is correct! echo *.o
is not what you want -- you want nothing to be printed because searching for files that end in .o
don't yield any files, if there are no matching files. I've revamped some of the wildcard examples that hopefully describe this better