OK, I guess I have to answer my own question. The only way I can figure
out how to do this is with recursion.
Here is a solution...
%.foo:
echo $@ > $@
stall_eval = 1
ifeq (${stall_eval},)
else
%_suffix.bar: DEPS=$*.foo
%_suffix.bar:
${MAKE} -f test.mk $@ DEPS=${DEPS} stall_eval=
endif
%.bar: %.foo ${DEPS}
echo $^ DEPS=${DEPS} > $@
So, the first pass sets the DEPS variable, and the recursive pass then
has the DEPS variable defined and can use it for dependencies.
Does anyone know of another solution?
Thanks,
-Pete
Pete Johnson wrote:
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
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make