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
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to