help-make
[Top][All Lists]
Advanced

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

Re: Stop reading Makefile command?


From: Cristian Morales Vega
Subject: Re: Stop reading Makefile command?
Date: Fri, 18 Dec 2015 09:16:44 +0000

I ended up just calling only N-1 submakes, and making the main make
take care of one of the DEVICES. Breaks a bit the parallel jobs, but I
can live with that.

On 17 December 2015 at 21:35, Cristian Morales Vega
<address@hidden> wrote:
> On 17 December 2015 at 17:45, Paul Smith <address@hidden> wrote:
>> On Thu, 2015-12-17 at 12:41 -0500, Paul Smith wrote:
>>> On Thu, 2015-12-17 at 15:34 +0000, Cristian Morales Vega wrote:
>>> > There is any way to say: "stop reading here, suppose this Makefile
>>> > has no more contents, end the read-in phase and start the target
>>> > -update phase"?
>>>
>>> No, that's not possible.
>>
>> Well, besides the obvious of putting the entire rest of the makefile in
>> a conditional:
>>
>>   STOP = false
>>     ...
>>   STOP = true
>>
>>   # Don't read any of the rest of the makefile if STOP is true
>>   ifeq ($(STOP),true)
>>    ...
>>   endif
>>   <EOF>
>
> I was trying to avoid that.
>
> My usercase is this: I have a few programs that I want to build for
> multiple devices. Developers of each program create a Makefile
> defining some common variables and one include, e.g.
>
> -----------
> include $(BASE_MAKEFILE)
>
> BINARIES := myprogram
> myprogram_CFLAGS := $(shell pkg-config --cflags mydependency)
> -----------
>
> Then they can run make DEVICES="<device1> <device2>" and the program
> is built for both devices.
>
> Here "pkg-config", and other things in the real system, is a script
> which depends on some variables. These variables are different for
> each <deviceX>.
>
> What I am doing is checking DEVICES in BASE_MAKEFILE. If it contains
> more than one, I call the same Makefile again N times, each time with
> a single, different, <deviceX>. At this point the original make
> invocation just needs to take care of calling the sub-makes.
>
> The problem is that *once* the myprogram_CFLAGS definition is executed
> with DEVICES set with *all* the devices. And in this case pkg-config
> fails.
>
> This can be fixed changing the Makefile to either
>
> -----------
> include $(BASE_MAKEFILE)
>
> BINARIES := myprogram
> myprogram_CFLAGS = $(shell pkg-config --cflags mydependency)
> -----------
>
> or
>
> -----------
> include $(BASE_MAKEFILE)
> ifeq ($(STOP),true)
>
> BINARIES := myprogram
> myprogram_CFLAGS := $(shell pkg-config --cflags mydependency)
>
> endif
> -----------
>
> But I was trying to let developers use ":=", and avoid asking them to
> add two more lines. For that, and avoid an error output from the
> pkg-config call, I would need to to stop the read-in phase inside
> BASE_MAKEFILE.



-- 
Cristian Morales Vega

Email address@hidden
Office +44 (0) 20 3111 4330
Web:  www.samknows.com


This email is sent for and on behalf of SamKnows Limited.

This email and any attachments are confidential, legally privileged
and protected by copyright. If you are not the intended recipient
dissemination or copying of this email is prohibited. If you have
received this in error, please notify the sender by replying by email
and then delete the email completely from your system.

SamKnows Limited, Registered Number: 06510477, Registered Office: Hill
House, 1 Little New Street, London, EC4A 3TR. Registered in England
and Wales. Trade Mark 2507103



reply via email to

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