On Mon, Aug 04, 2008 at 02:39:36PM -0700, Rick Flower wrote:
> On Mon, August 4, 2008 9:55 am, Sam Ravnborg wrote:
> > On Mon, Aug 04, 2008 at 09:39:18AM -0700, Rick Flower wrote:
> >> Hi all...
> >>
> >> I'm trying to update a build environment that currently uses a perl
> >> script
> >> that expands certain keywords into specific command line args to GNU
> >> Make.. I'm trying to get rid of this script while keeping the same
> >> look-n-feel that people are used to.. So, below is what I'd like to be
> >> able to do but can't seem to find a way to make it work w/ Make.. Keep
> >> in
> >> mind that the sample below is simplified in nature and that we've got a
> >> handful of these sort of command aliases..
> >>
> >> old perl script:
> >> % pmake release target=sun
> >> --> expanded to the following Make command
> >> % make debug=off asserts=off target=sun
> >>
> >> what I'd like to see Make handle:
> >> % make release target=sun
> >>
> >> Unfortunately, I can't seem to find a way to get Make to convert
> >> 'release'
> >> into a set of predefined (canned) variables that then control the make
> >> operation.. I've tried using 'define' but everything enclosed in the
> >> 'define' seems to set my variables when I don't want them set.. I also
> >> toyed around with target specific variables too as that seemed close to
> >> what I was looking for -- unfortunately, it didn't seem to work for my
> >> sample test.. Any ideas on how to go about this?
> >
> > Untested but you get the idea:
> >
> > ifneq ($(filter release,$(MAKECMDGOALS)),)
> > MY_VAR := 1
> > MY_OTHER_VAR := 2
> > endif
>
> Ok -- this sample above seemed to fit what I was trying to do so I
> started playing around with it.. While it appears to work at first, I'm
> finding that code that checks if the variable was set using 'ifndef'
> afterwards is not working as expected.. Below is a sample sequence :
>
> =======================================
> ...
> foo = foo
> bar = bar
> ifneq ($(filter release,$(MAKECMDGOALS)),)
> MY_VAR := foo
> endif
> ...
> ifndef MY_VAR
> MY_VAR := bar
> endif
> ...
>
> ifeq ($(MY_VAR), $(foo))
> include Makefile-foo.mak
> endif
>
> ifeq ($(MY_VAR), $(bar))
> include Makefile-bar.mak
> endif
I played with this sample - replacing include with $(warning ...)
and it just works.
Could you please post a real example that fails
so we can try it out.
Thanks,
Sam
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make