ILostMySpoon
ILostMySpoon

Reputation: 2409

Filter wildcards not behaving the same way or as intended

I am attempting to get the following filter statement to work correctly, however, it does not. exportedLibaries contains the relative path to the files from where make it being executed from (i.e. export/*/*/*/filename)

dev := $(filter HelloWorld%, $(exportedLibraries))

I use a similar filter for my unit tests and it works wonderfully (with the relative path being the same):

unitTests := $(filter %_Test, $(exportedUnitTests))

This however works...

dev := $(filter $(wildcard export/**/**/**/HelloWorld*), $(exportedLibraries))

What am I doing wrong?

Upvotes: 0

Views: 50

Answers (1)

Vroomfondel
Vroomfondel

Reputation: 2898

$(notdir) is what you want in this case:

exportedLibraries := export/foo/helloworld.lib export/bar/HelloWorld.lib export/baz/HelloWorldTwo.lib

dev := $(foreach lib,$(exportedLibraries),$(if $(filter HelloWorld%,$(notdir $(lib))),$(lib)))

$(info $(dev))

You could $(strip) the result of the $(foreach) to get rid of surplus spaces in the result.

Upvotes: 2

Related Questions