[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Choosing where to build depending on the target(s)
From: |
Mark Galeck |
Subject: |
Re: Choosing where to build depending on the target(s) |
Date: |
Wed, 11 Dec 2013 07:40:30 -0800 |
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
...
On Wed, Dec 11, 2013 at 7:00 AM, Mason <address@hidden> wrote:
> Hello,
>
> I'm trying to write a makefile that decides where to place the
> result based on what target was requested (simple enough, right?)
> (Also when multiple targets are requested.)
>
> This is what I tried, which fails:
>
> CC = mips-linux-gnu-gcc
> APP = ../../rootfs$(DDI_SUFFIX)/partition/APP_HBBTV
>
> .SUFFIXES:
>
> DEFINES = [snip]
> INCLUDES = [snip]
> CPPFLAGS = $(addprefix -D, $(DEFINES)) $(addprefix -I, $(INCLUDES))
> CFLAGS = -Wall -EL -Os
> LDLIBS = $(addprefix -l, m rt)
> LDFLAGS = -L $(APP)/lib
>
> help:
> @echo VALID TARGETS: owb mwb
>
> owb: foo
> mwb: foo
> mwb: DDI_SUFFIX = _mwb
>
> foo: $(APP)/decrypt
>
> $(APP)/decrypt: decrypt.c
> $(LINK.c) $^ $(LDLIBS) -o $@
> mips-linux-gnu-strip $@
>
>
> AFAIU, the $(APP)/decrypt is computed right away, in the first pass,
> so even if the target is mwb, APP doesn't get the DDI_SUFFIX.
>
> What is the correct way to do this?
>
> I want to be able to write make owb mwb
> and have make generate the two binaries
> in there respective directories.
>
> --
> Regards.
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make
>