help-make
[Top][All Lists]
Advanced

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

Re: Choosing where to build depending on the target(s)


From: Etan Reisner
Subject: Re: Choosing where to build depending on the target(s)
Date: Thu, 12 Dec 2013 11:17:44 -0500

You can get the variables to be available to prerequistes with
SECONDARY_EXPANSION. Which would mean you would need to nest your
targets one extra level deep I believe but might get you what you want
otherwise.

I don't believe you can get them available to targets though (as that
would require multiple passes.

Though, I suppose, if you wrote your target in a separate makefile you
could set the variable each way and include the file multiple times
and that would give you the different targets you wanted (same idea as
the foreach loop that Mark suggested).

    -Etan

On Thu, Dec 12, 2013 at 10:56 AM, Mason <address@hidden> wrote:
> Mark Galeck wrote:
>
>> The target-specific variables are only in effect in recipes, not in
>> prerequisites and other targets, so the above won't work.
>>
>> You have to hack your own "target-specific" variable name, depending on the
>> target, like this:
>>
>> mwb_DDI_SUFFIX := _mwb
>>
>> $(foreach goal, owb mwb, $(eval $(goal):
>> ../../rootfs$($(goal)_DDI_SUFFIX)/partition/APP_HBBTV))
>>
>> %/decrypt: decrypt.c
>
> I ended up giving up begin able to build the two targets in a single
> invocation of make. So I went with:
>
> CC  = mips-linux-gnu-gcc
>
> ifeq "$(MAKECMDGOALS)" "mwb"
>   DDI_SUFFIX = _mwb
> endif
> APP = ../../rootfs$(DDI_SUFFIX)/partition/APP_HBBTV
>
> .SUFFIXES:
>
> help:
>         @echo VALID TARGETS: owb mwb
>
> owb: $(APP)/decrypt
> mwb: $(APP)/decrypt
>
> $(APP)/decrypt: decrypt.c
>         $(LINK.c) $^ $(LDLIBS) -o $@
>         mips-linux-gnu-strip $@
>
>
>
> While I was looking for a better solution, I came across several
> of Paul's articles, which I'll post here, for my reference.
>
> http://mad-scientist.net/make/rules.html
> http://mad-scientist.net/make/vpath.html
> http://mad-scientist.net/make/multi-arch.html
>
> --
> Regards.
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make



reply via email to

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