help-make
[Top][All Lists]
Advanced

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

Choosing where to build depending on the target(s)


From: Mason
Subject: Choosing where to build depending on the target(s)
Date: Wed, 11 Dec 2013 16:00:24 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22.1

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.



reply via email to

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