Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assign or declare variable in target specific?

How to assign or declare variable in target specific?

Here i had try this example.

foo = welcome

all: foo = hello
    echo $(foo)

But i get commands commence before first target. Stop.

like image 787
vinoth kumar Avatar asked Mar 13 '26 13:03

vinoth kumar


1 Answers

You can't have a target-specific assignment and a rule definition at the same time. You have to separate them:

all: foo = hello
all:
         echo $(foo)

Your version creates a target all which has three prerequisites: foo, =, and hello.

like image 133
MadScientist Avatar answered Mar 17 '26 05:03

MadScientist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!