1 #============================================================================
3 #============================================================================
8 ## Wildcard [ dir : ] patterns
9 ## Create a list of files in a directory which match the pattern. You can
10 ## optionally specify a subdirectory. The files will be returned with
11 ## stripped pathnames. The difference from GLOB is that this rule respects
12 ## subdirectories which may have been entered with the SubDir rule.
15 local files dir sdir wildcards ;
17 # Is a directory given?
28 files = [ GLOB [ ConcatDirs $(SUBDIR) $(dir) ] : $(wildcards) ] ;
30 return $(files:BSR=$(sdir)) ;
33 ## Prefix list : prefix
34 ## Adds a prefix to a all elements in list.
40 if $(JAMVERSION) >= 2.5
43 ## IsElem element : list
44 ## Returns "true" if the elemnt is in the list. Otherwise nothing is
65 # jam<2.4's return statement doesn't exit the function
84 ## Filter list : filter
85 ## Returns the list without the words contained in filter.
92 if ! [ IsElem $(i) : $(>) ]
102 ## Removes duplicates in the list (this function tries to preserve the list
110 if ! [ IsElem $(i) : $(result) ]
125 result = $(i) $(result) ;
131 ## Simply returns the value of the variable with name argument.
132 ## This is useful to query on target variables:
133 ## bla = [ on TARGET GetVar CFlags ] ;
140 ## Concatenates a set of directories. This is a substitute for FDirName in
141 ## Jambase. It works also correctly for several rooted paths, where FDirName
143 ## The advantage over $(dir1)/$(dir2) is that this also works correctly if
144 ## $(dir1) or $(dir2) is not set.
148 local result = $(<[1]) ;
149 if ! $(result) { $result = "" ; }
154 # eleminate multiple slashes because jam is somewhat buggy here
155 dir1 = [ MATCH (.*[^/]?) : $(result) ] ;
156 dir2 = [ MATCH ([^/].*) : $(i) ] ;
157 if ! $(dir1) { dir1 = "" ; }
158 if $(dir1) != "" { dir1 = $(dir1)/ ; }
159 if ! $(dir2) { dir2 = "" ; }
160 result = $(dir1)$(dir2) ;
166 ## Copy target : source
167 ## Copy source file to target.