Skip to content
Advertisement

How can i get second variable in gnu make targets

Currently i have this

test.%:
        echo $*

I want to do something like

test.%.%:
        echo $1 && echo $2

Is it possible to fo like that

Advertisement

Answer

You can only have one wildcard per pattern, but you can further process the pattern to extract the information you want. For your example above, this would work:

test.%:
    echo $(basename $*) && echo $(subst .,,$(suffix $*))
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement