OpenMake Meister

Matching on **

 

The matching pattern "**" allows more flexibility than the use of "*" and/or "?" alone because it matches to zero or more dependency directories.  The "**" indicates that the pattern matching should be recursive through multiple directories.  Consider the above example, but with the pattern ab?/**/*.java. This matches our original file abc/def/xyz.java, but would also match the following:

 

1.      abc/a.java                (no intermediate directory)

2.      abc/def/ghi/b.java    (multiple intermediate directories)

 

The "double-star" notation is very useful for matching Java package structures.  For example, consider a simplified example of a Java package:

 

com/acmepackage/online/
com/acmepackage/online/actions/
com/acmepackage/online/build/
com/acmepackage/online/data/
com/acmepackage/online/markers/
com/acmepackage/online/parsers/
com/acmepackage/online/parsers/
com/acmepackage/online/ui/
com/acmepackage/online/ui/events/
com/acmepackage/online/ui/panels/
com/acmepackage/online/ui/preferences/
com/acmepackage/online/ui/properties/
com/acmepackage/online/ui/wizards/

 

To create a Target for this package structure without the recursive wildcard (**) would require listing each of the package directories with "*/.java", for a total of 13 listed dependencies. Now we can simply create one dependency:

 

com/acmepackage/online/**/*.java

 

In addition, if the package structure changes, the file dependency listed in the Target does not need to be modified.

 

The wildcard matching uses a port of code written for the Apache Ant project (https://ant.apache.org).