cmcginty
cmcginty

Reputation: 116958

How do you declare custom variable inside of make target?

How do you define dynamic variables in a makefile target? For example:

all:
    VAR := $@
    @echo $(VAR)

Upvotes: 7

Views: 3861

Answers (1)

cmcginty
cmcginty

Reputation: 116958

I realize this is the correct way:

all: VAR = $@
all:
    @echo $(VAR)

Upvotes: 11

Related Questions