help-make
[Top][All Lists]
Advanced

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

Re: problem building multiple targets


From: Galen Seitz
Subject: Re: problem building multiple targets
Date: Wed, 12 Nov 2008 15:15:50 -0800
User-agent: Thunderbird 2.0.0.17 (X11/20081001)

Martin d Anjou wrote:
 _ARCH := 2801 28015
OBJDIR := $(_ARCH:%=_%)
$(OBJDIR):
    address@hidden -d $@ ] || mkdir -p $@
    address@hidden(MAKETARGET)

The rule runs only once. If you want to build two targets, this is not the way to do it. Try this instead (I have grossly simpified it):

_ARCH := 2801 28015
OBJDIR := $(_ARCH:%=_%)
_%:
        echo Hi
all: $(OBJDIR)

Martin

Thanks for the feedback. Unfortunately I wasn't able to make your suggestion work. However I did manage to come up with a solution once I saw this line in the manual: "If the first rule has multiple targets, only the first target is taken as the default." Obviously this is why I was only getting one arch build when I invoked make without an explicit goal. By simply adding an 'all' target ahead of the $(OBJDIR) target, I get the desired behavior. The relevant section now looks like this:

.PHONY: all
all: $(OBJDIR)

.PHONY: $(OBJDIR)
$(OBJDIR):
        address@hidden -d $@ ] || mkdir -p $@
        address@hidden(MAKETARGET)

Makefile : ;
%.mk :: ;

% :: $(OBJDIR) ; :


Thanks again for your help.
galen

--
Galen Seitz
address@hidden




reply via email to

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