help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variable dependencies


From: Pete Johnson
Subject: Variable dependencies
Date: Fri, 30 Sep 2005 12:08:47 -0700

Hi,

I would like to be able to have additional dependencies for a pattern rule for some targets but not others.

For example, say I need to make many %.bar targets from many %.foo dependencies. However some %.bar targets have another dependency as well. These %.bar targets also match as %_suffix.bar.

Here is an attempt (although incorrect) at doing this.

%.foo:
   echo $@ > $@

%_suffix.bar: DEPS=${*:_suffix=}.foo

%.bar: %.foo ${DEPS}
   echo $^ DEPS=${DEPS}

The problem with this is DEPS is not set when make is evaluating the dependencies for the %.bar action. The only way I know to solve this is to have the %_suffix.bar have an action and have the additional dependencies.

For example

%_suffix.bar: %_suffix.foo %.foo
   echo $^ DEPS=${DEPS}

I can't do this however, because my actual actions for %.bar are very complicated.

Also, I am sure that I can do this with an eval, but I am restricted from using features beyond version 3.79 because many users will not have a current version of make.

Any help would be much appreciated.

Thanks,

-Pete





reply via email to

[Prev in Thread] Current Thread [Next in Thread]