help-make
[Top][All Lists]
Advanced

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

Re: details required on wildcard function


From: bhaskar . g
Subject: Re: details required on wildcard function
Date: Tue, 26 Feb 2002 16:03:57 +0100

Hi Paul,

I find this peculiar thing happening in gmake. As per your mail the env 
variable should not expanded. But what happens here is
the following:

address@hidden 331> cat makefile
LISTROOT_FILENAME = /home/bhaskar/test.txt
REQFILE_LST := $(shell cat $(LISTROOT_FILENAME))
REQFILES := $(strip $(REQFILE_LST))
LIST_OF_FILES   := $(foreach file, $(REQFILES), $(wildcard $(file)))

default:
        @echo $(LISTROOT_FILENAME)
        @echo $(REQFILES)
        @echo $(LIST_OF_FILES)

address@hidden 332> echo $_ROOT
/usr
address@hidden 333> cat test.txt
/home/bhaskar $_ROOT /tmp

You can see the output of the REQFILES has been expanded to /usr. The list 
REQFILES contains /usr init but this
is not transferred onto the wildcard function. I am wondering if the list has 
the expanded list in it should not matter.

Please correct if I am wrong here.

address@hidden 334> gmake
/home/bhaskar/test.txt
/home/bhaskar /usr /tmp
/home/bhaskar /tmp
address@hidden 335>

regards
bhaskar



                                                                                
                                       
                    "Paul D.                                                    
                                       
                    Smith"                  To:  Bhaskar 
G/BTC/SC/address@hidden                                        
                    <address@hidden           cc:  address@hidden               
                                      
                    rg>                     Subject:  Re: details required on 
wildcard function                        
                    Sent by:                                                    
                                       
                    help-make-adm           Classification:                     
                                       
                    address@hidden                                              
                                           
                                                                                
                                       
                                                                                
                                       
                    25-02-2002                                                  
                                       
                    18:52                                                       
                                       
                    Please                                                      
                                       
                    respond to                                                  
                                       
                    "Paul D.                                                    
                                       
                    Smith"                                                      
                                       
                                                                                
                                       
                                                                                
                                       




%% Regarding details required on wildcard function; you wrote:

  bg> I am trying to get a list of files required, from a file which
  bg> contains the root location of the required files. The contents of
  bg> file can be any thing

  bg> 1. absolute location
  bg> 2. An env variable pointing to the absolute location.

  bg> When I try to use wildcard function, wildcard gives only the files
  bg> present in the root location whose absolute location is given, but
  bg> doesnot list the files at root location obtained from the
  bg> environment variable.

Definitely.  And why should it?

The wildcard function is a builtin function in GNU make (using the GNU C
runtime globbing functions directly).  Make does not invoke a shell or
anything to handle wildcarding.

So, the shell does not expand your environment variables; instead if you
had a filename like $ROOT/foodir make looks for path with the literal
string '$ROOT/foodir', not whatever $ROOT expands to.

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

_______________________________________________
Help-make mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-make







reply via email to

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