[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:
From: |
David Deutsch |
Subject: |
Re: |
Date: |
Tue, 16 Jun 2020 09:00:12 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 |
As a rule of thumb: Anything that you indent (the "recipe") as part of a
target is going to be executed in the shell.
What you did in your example is like typing "include makefile_a" in your
terminal, which fails as bash doesn't know what to do with it.
Conversely, "include" is a make directive that needs to sit outside of a
target.
If you want to conditionally include a makefile only when a certain
target is being built, you can try:
ifeq ($(MAKECMDGOALS),a)
include makefile_a
endif
This finds out if the current goal (as in: if you typed 'make a' into
your shell) is 'a' and then includes 'makefile_a'.
Do note that this only works for the target you supply - 'MAKECMDGOALS'
does not reflect the target make is building at the time, but only the
one you supplied as a goal.
-David
On 16/06/2020 06:00, Budi wrote:
> a:
> include makefile_a
>
> Fail as said.
>
> On 6/16/20, Philip Guenther <guenther@gmail.com> wrote:
>> On Mon, Jun 15, 2020 at 5:16 PM Budi <budikusasi@gmail.com> wrote:
>>
>>> How can we have make's 'include' command in makefile not to precede
>>> the first/default target in the actual processes?
>>> I found it always processed the earliest, how to solve this?
>>>
>> Can you describe the problem you're trying to solve, and then describe what
>> you're doing that works and contrast it to what doesn't work but that you
>> would like to work?
>>
- [no subject], Budi, 2020/06/15
- Re:, Budi, 2020/06/15
- Re:, Philip Guenther, 2020/06/15
- Re:, Kaz Kylheku (gmake), 2020/06/16
- Re:, Budi, 2020/06/16
- Re:, Kaz Kylheku (gmake), 2020/06/16