bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wildcard function returns nothing when filename contains '_' or '['


From: Paul Smith
Subject: Re: wildcard function returns nothing when filename contains '_' or '[' characters
Date: Sun, 23 Oct 2011 14:56:06 -0400

On Sun, 2011-10-23 at 19:21 +0200, earlgrey wrote:
> __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard
> $(MODVERDIR)/*.mod)))
> 
> with MODVERDIR=fglrx-11.06[Driver 8.861]

There's no problem with underscores.

The problem with [] is that these are special to the shell's globbing
capability, just like "*" is a special character.  Ditto for the
whitespace.  Run "man 7 glob" for details.

If you try this from the shell:

        echo fglrx-11.06[Driver 8.861]/*.mod

you will not get back what you want either.  You have to escape special
characters:

        MODVERDIR = fglrx-11.06\[Driver\ 8.861\]

then it will work.

I should point out that (a) GNU make doesn't support spaces in targets
in general, so the whitespace will continue to be a problem for you
going forward, and (b) if you insist on using shell-special characters
like [] in your filenames you'll have to be very careful about how you
write your shell commands in recipes, to quote all the filenames that
might contain these characters.

My advice: don't use these kinds of pathnames.  You can make it work but
the ongoing effort will be significant.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]