0az
0az

Reputation: 360

Make: Target-specific variable assignment in function

Is it possible do the following in one $(call ...) inside a prerequisite list?

  1. Assign an argument to a (private/non-inheriting) variable.
  2. Add the argument to the target list.

That is, the following should assign the string value to the variable $(var), while adding value as a prerequisite for the target foo.

foo: $(call assign-value-to-var,value)
    # Do stuff

Upvotes: 0

Views: 63

Answers (1)

Matt
Matt

Reputation: 15091

Yeah, why not?

assign-value-to-var=$(eval foo: private var:=$1)$1

foo: $(call assign-value-to-var,value)
    # Do stuff

Upvotes: 1

Related Questions