git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] Makefile: make the "sparse" target non-.PHONY

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Sep 24, 2021, 16:38 UTC
Message-ID
<7673e7aa-9737-a9eb-74ff-e11f071356e2@ramsayjones.plus.com>
In-Reply-To
<87a6k24vdc.fsf@evledraar.gmail.com>
On 24/09/2021 02:16, Ævar Arnfjörð Bjarmason wrote:
Show 108 quoted lines
> 
> On Fri, Sep 24 2021, Ramsay Jones wrote:
> 
>> On 23/09/2021 18:39, Junio C Hamano wrote:
>>> Jeff King <peff@peff.net> writes:
>>>
>>>> On Thu, Sep 23, 2021 at 02:07:16AM +0200, Ævar Arnfjörð Bjarmason wrote:
>>>>
>>>>> We ensure that the recursive dependencies are correct by depending on
>>>>> the *.o file, which in turn will have correct dependencies by either
>>>>> depending on all header files, or under
>>>>> "COMPUTE_HEADER_DEPENDENCIES=yes" the headers it needs.
>>>>>
>>>>> This means that a plain "make sparse" is much slower, as we'll now
>>>>> need to make the *.o files just to create the *.sp files, but
>>>>> incrementally creating the *.sp files is *much* faster and less
>>>>> verbose, it thus becomes viable to run "sparse" along with "all" as
>>>>> e.g. "git rebase --exec 'make all sparse'".
>>>>
>>>> OK. I think this solves the dependency issues sufficiently. It is a
>>>> tradeoff that you must do the normal build in order to do the sparse
>>>> check now. That is certainly fine for my workflow (I am building Git all
>>>> the time, and only occasionally run "make sparse"). I don't know if
>>>> others would like it less (e.g., if Ramsay is frequently running sparse
>>>> checks without having just built).
>>>>
>>>> (I'd say "I do not care that much either way", but then I do not care
>>>> all that much either way about incremental sparse checks either, so I'm
>>>> not sure my opinion really matters).
>>>
>>> My build procedure runs "make sparse" before the primary build,
>>> simply because the former tends to be much faster to fail when there
>>> is an issue in the code.  I can understand that depending on .o is a
>>> cheap way to piggyback on the dependencies it has, but my latency
>>> will get much slower if this goes in _and_ I keep trying to pick up
>>> potentially problematic patches from the list.
>>
>>
>> I always run 'make sparse -k >sp-out 2>&1' after having done the main
>> build, so that is not an issue for me. Note that I always send all
>> output from each build step (for master, next and seen) to a series of
>> (branch keyed) files, so that I can easily diff from branch to branch.
>> Also, as above, I use '-k' on the 'sparse' and 'hdr-check' targets to
>> collect all errors/warnings in one go.
>>
>> So, this evening, with the v2 version of Ævar's patch having landed in
>> the 'seen' branch, we see this (abridged) diff between next and seen:
>>
>>   $ diff nsp-out ssp-out
>>   77a78
>>   >     SP hook.c
>>   289a291
>>   >     SP builtin/hook.c
>>   417a420
>>   >     SP t/helper/test-reftable.c
>>   449a453,478
>>   >     SP reftable/basics.c
>> ...
>>   >     SP reftable/tree_test.c
>>   452a482,483
>>   >     CC contrib/scalar/scalar.o
>>   >     SP contrib/scalar/scalar.c
>>   $ 
>>
>> So, this almost looks normal, except for the 'CC' line! Having discovered
>> some leftover cruft from old builds yesterday:
>>
>>   $ git ls-files | grep contrib/scalar
>>   contrib/scalar/.gitignore
>>   contrib/scalar/Makefile
>>   contrib/scalar/scalar.c
>>   contrib/scalar/scalar.txt
>>   contrib/scalar/t/Makefile
>>   contrib/scalar/t/t9099-scalar.sh
>>   $ ls contrib/scalar
>>   Makefile  scalar.c  scalar.o  scalar.sp  scalar.txt  t/
>>   $ rm contrib/scalar/scalar.{o,sp}
>>   $ make
>>       SUBDIR git-gui
>>       SUBDIR gitk-git
>>       SUBDIR templates
>>   $ make sparse
>>       CC contrib/scalar/scalar.o
>>       SP contrib/scalar/scalar.c
>>   $ 
>>
>> Hmm, interesting, but not relevant here. So, lets play a bit:
>>
>>   $ make sparse  
>>   $ make git.sp
>>   $ make git.sp
>>   $ touch git.sp
>>   $ make git.sp
>>   $ touch git.c
>>   $ make git.sp
>>       CC git.o
>>       SP git.c
>>   $ touch git.o
>>   $ make git.sp
>>       SP git.c
>>   $ 
>>
>> Hmm, so I think it is working as designed. However, I find it to be
>> more than a little irritating (curmudgeon alert!).
> 
> Specifically that there's now "SP" lines in the output, that *.sp files
> are created at all, that they're created where they are, or some
> combination of those thigs?
Heh, just ignore me.

Although I haven't done much testing, I believe your patch correctly implements what you intended.

ATB, Ramsay Jones

Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 22 of 28 in “Makefile: make "sparse" and "hdr-check" non-.PHONY”
  1. 0/3 Makefile: make "sparse" and "hdr-check" non-.PHONYÆvar Arnfjörð Bjarmason, Sep 21, 2021
  2. 1/3 Makefile: make the "sparse" target non-.PHONYÆvar Arnfjörð Bjarmason, Sep 21, 2021
  3. Jeff KingSep 22, 2021
  4. 2/3 Makefile: do one append in %.hcc ruleÆvar Arnfjörð Bjarmason, Sep 21, 2021
  5. 3/3 Makefile: make the "hdr-check" target non-.PHONYÆvar Arnfjörð Bjarmason, Sep 21, 2021
  6. Jeff KingSep 22, 2021
  7. Ramsay JonesSep 22, 2021
  8. Jeff KingSep 22, 2021
  9. Ramsay JonesSep 22, 2021
  10. Junio C HamanoSep 22, 2021
  11. Ævar Arnfjörð BjarmasonSep 23, 2021
  12. Junio C HamanoSep 23, 2021
  13. Ævar Arnfjörð BjarmasonSep 23, 2021
  14. Junio C HamanoSep 22, 2021
  15. Makefile: make the "sparse" target non-.PHONYÆvar Arnfjörð Bjarmason, Sep 23, 2021
  16. Jeff KingSep 23, 2021
  17. Ævar Arnfjörð BjarmasonSep 23, 2021
  18. Jeff KingSep 23, 2021
  19. Junio C HamanoSep 23, 2021
  20. Ramsay JonesSep 23, 2021
  21. Ævar Arnfjörð BjarmasonSep 24, 2021
  22. Ramsay JonesSep 24, 2021
  23. Ævar Arnfjörð BjarmasonSep 24, 2021
  24. Junio C HamanoSep 24, 2021
  25. Makefile: add a non-.PHONY "sparse-incr" targetÆvar Arnfjörð Bjarmason, Sep 28, 2021
  26. Makefile: add a non-.PHONY "sparse-incr" targetÆvar Arnfjörð Bjarmason, Sep 28, 2021
  27. Junio C HamanoSep 28, 2021
  28. Ævar Arnfjörð BjarmasonSep 28, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.