help-make
[Top][All Lists]
Advanced

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

Re: Help-make Digest, Vol 210, Issue 1


From: David Deutsch
Subject: Re: Help-make Digest, Vol 210, Issue 1
Date: Thu, 18 Jun 2020 09:01:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

Try to conceptualize it like this:

When make (re-)builds a target, it tries to do the minimal necessary
amount of work to do that. If a target has prerequisites that are far
older than the current version of the target, make will not try to
rebuild them because it assumes they have not changed.

>From that follows that once make has built a prerequisite, it assumes
that it is the freshest copy possible and will not try to rebuild it
(why would it! It's brand new!). Through simple mechanics like that,
make establishes the most effective graph to build what you want it to
build.


You seem to assume that it takes the list of prerequisites as a fixed
number of steps to go through before building the target. That is not
what is happening.

If your build tree relies on this assumption than you need to fix up
your build tree to… not do that.


The key to being happy with make is to realize that it is the underlying
model is probably right and you're not talking to it correctly. Iterate
through your options a few times until you find something that does.
Once you have done that, be thankful to make for forcing you to express
what it is you wanted to do in a cleaner way.

Since your questions so far have been rather basic, I would highly
recommend reading the make manual very closely. Even just the first 20
or so pages are an extremely dense trove of information. Studying them
will help you come up with better questions ;-)

- David


On 18/06/2020 07:12, Budi wrote:
> Why in a single `make` prerequisite consist of many targets names, if
> there's one target being listed more than once, the first only will
> get processed while the next is to be ignored/skipped, how to have
> that repeated target name in that prerequisite all are to be processed
> ?
>
> On 6/18/20, Budi <budikusasi@gmail.com> wrote:
>> How do we have 'make' to echo just like Bash but is done in place of
>> prerequisite so it must be really 'make' command not shell
>>
>> On 6/17/20, Budi <budikusasi@gmail.com> wrote:
>>> David Deutsch, you are BRILLIANT !!
>>>
>>> SOLVED !
>>> Thanks billions for crystal clear explanation !
>>>
>>> On 6/16/20, help-make-request@gnu.org <help-make-request@gnu.org> wrote:
>>>> Send Help-make mailing list submissions to
>>>>    help-make@gnu.org
>>>>
>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>>    https://lists.gnu.org/mailman/listinfo/help-make
>>>> or, via email, send a message with subject or body 'help' to
>>>>    help-make-request@gnu.org
>>>>
>>>> You can reach the person managing the list at
>>>>    help-make-owner@gnu.org
>>>>
>>>> When replying, please edit your Subject line so it is more specific
>>>> than "Re: Contents of Help-make digest..."
>>>>
>>>>
>>>> Today's Topics:
>>>>
>>>>    1.  (Budi)
>>>>    2. Re: (Budi)
>>>>    3. Re: (Philip Guenther)
>>>>    4. Re: (Budi)
>>>>    5. Re: (David Deutsch)
>>>>
>>>>
>>>> ----------------------------------------------------------------------
>>>>
>>>> Message: 1
>>>> Date: Tue, 16 Jun 2020 06:53:26 +0700
>>>> From: Budi <budikusasi@gmail.com>
>>>> To: help-make@gnu.org
>>>> Message-ID:
>>>>    <CAH0GyZB8JJSBeOOY04QTyWuuWeYdTB0JUo7gL1ts00rPOcWg5w@mail.gmail.com>
>>>> Content-Type: text/plain; charset="UTF-8"
>>>>
>>>> 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?
>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> Message: 2
>>>> Date: Tue, 16 Jun 2020 08:38:47 +0700
>>>> From: Budi <budikusasi@gmail.com>
>>>> To: help-make@gnu.org
>>>> Subject: Re:
>>>> Message-ID:
>>>>    <CAH0GyZBWPsVEa03nEr+aROXwZPDk3XQJ8CqbmkBdJ29jkjki0w@mail.gmail.com>
>>>> Content-Type: text/plain; charset="UTF-8"
>>>>
>>>> why as I tried to do 'include' command in a recipe it gave :
>>>> make[1]: include: Command not found
>>>> make[1]: *** [Makefile:537: .depend] Error 127
>>>>
>>>> How to do it such, must not be in global (the same scope of target)
>>>>
>>>> On 6/16/20, 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?
>>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> Message: 3
>>>> Date: Mon, 15 Jun 2020 18:26:52 -0900
>>>> From: Philip Guenther <guenther@gmail.com>
>>>> To: Budi <budikusasi@gmail.com>
>>>> Cc: make-help mailing list <help-make@gnu.org>
>>>> Subject: Re:
>>>> Message-ID:
>>>>    <CAKKmsNh_sFLeVVmga9+S+qEGiiwrArLrU_G8YNfGckNR+XcfWA@mail.gmail.com>
>>>> Content-Type: text/plain; charset="UTF-8"
>>>>
>>>> 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?
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> Message: 4
>>>> Date: Tue, 16 Jun 2020 11:00:05 +0700
>>>> From: Budi <budikusasi@gmail.com>
>>>> To: Philip Guenther <guenther@gmail.com>
>>>> Cc: make-help mailing list <help-make@gnu.org>
>>>> Subject: Re:
>>>> Message-ID:
>>>>    <CAH0GyZDHH1DM9gXnE0wBH20d4odwN0rpL-NrDbDZUYF=BxTKCw@mail.gmail.com>
>>>> Content-Type: text/plain; charset="UTF-8"
>>>>
>>>> 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?
>>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> Message: 5
>>>> Date: Tue, 16 Jun 2020 09:00:12 +0200
>>>> From: David Deutsch <skore@valanx.org>
>>>> To: make-help mailing list <help-make@gnu.org>
>>>> Subject: Re:
>>>> Message-ID: <d155c95d-4609-e51b-40ad-aab4e2b3aec6@valanx.org>
>>>> Content-Type: text/plain; charset=utf-8
>>>>
>>>> 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?
>>>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> Subject: Digest Footer
>>>>
>>>> _______________________________________________
>>>> Help-make mailing list
>>>> Help-make@gnu.org
>>>> https://lists.gnu.org/mailman/listinfo/help-make
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> End of Help-make Digest, Vol 210, Issue 1
>>>> *****************************************
>>>>



reply via email to

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