Problems using make wildcard function to define class lists

David Holmes david.holmes at oracle.com
Wed Aug 15 21:18:05 PDT 2012


I'm trying to define my own include/exclude class lists based on this 
example in CreateJars.gmk:

LOCALEDATA_INCLUDE_PATTERNS := \
	sun/text/resources/*_ar* \
         ...
	sun/util/resources/*_zh*

LOCALEDATA_INCLUDES := $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
	$(foreach i,$(LOCALEDATA_INCLUDE_PATTERNS), $(wildcard 
$(JDK_OUTPUTDIR)/classes/$i)))

But I discovered that if the class file represents an inner class and so 
has $ in its name, then the value returned by the wildcard function has 
been processed as if the $XXX were a variable and so is generally 
replaced with an empty string! Eg:

Foo$bar.class -> Foo.class

This would seem to make wildcard very error prone to use as you have to 
know that there are not, and never will be, files with $ in their name.

wildcard also does not handle recursion in sub-directories.

Given the above perhaps use of wildcard for .class files should be 
replaced by $(shell find ...) ?

David



More information about the build-infra-dev mailing list