On Mon, 2008-07-07 at 12:36 -0700, EricDeb wrote:
> Makefile1 (for project A):
> VERSIONNAMES = VERSIONA VERSIONB
> VERSIONA = foo
> VERSIONB = bar
> make Makefile2
> 
> Makefile1 (for project B):
> VERSIONNAMES = VERSIONA
> VERSIONA = ugh
> make Makefile2
> 
> Makefile2:
> reportversions :
>         ???? Help!
> 
> The goal would be for the user to type:
>    make reportversions

It's always better to include actual examples and snippets rather than
"psuedo-code"; most of the time many of the important bits are in the
parts of the psuedo-code not included.

First, I don't know what "make Makefile2" is supposed to be but it
doesn't make any sense.  Maybe you meant "make -f Makefile2"?  If you're
really invoking a sub-make you should always use the variable form
$(MAKE), not "make".

Second, although you don't show it I'm assuming that you're "export"ing
VERSIONNAMES and VERSIONA/VERSIONB etc.  If you don't do that, then when
you run "$(MAKE) -f Makefile2" the sub-make won't be able to see any of
the values of any of the variables.  Maybe you wanted to use "include
Makefile2" instead?

Third, you could write "reportversions" like this:

        reportversions:
                @$(foreach V,$(VERSIONNAMES),echo '$V = $($V)';)

But, there are still many other things that could be causing problems
which we can't detect from your example above.



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to