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

Re: [PATCH 0/3] Makefile: make "sparse" and "hdr-check" non-.PHONY

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 23, 2021, 01:07 UTC
Message-ID
<87pmt05bww.fsf@evledraar.gmail.com>
In-Reply-To
<xmqqsfxw42c1.fsf@gitster.g>
On Wed, Sep 22 2021, Junio C Hamano wrote:
Show 19 quoted lines
> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>
>>>> At the heart of my unease is dependencies (or rather the lack) for
>>>> the 'synthetic object files' *.hco and *.sp. (Also, the addition
>>>> of even more 'shrapnel' to the build directories - I wrote a patch
>>>> to remove the useless *.hcc files just after commit b503a2d515e was
>>>> included, but didn't get around to submitting it).
>>> 
>>> I don't consider them shrapnel if they're holding useful results. :)
>>
>> Heh, yes I am a bit of a curmudgeon! :D
>
> We do not necessarily have to have these files immediately next to
> the corresponding source file.
>
> For example, we could give .shrapnel/ hierarchy to *.hco and *.sp
> files, so that for revision.c and compat/bswap.h, we'd create
> .shrapnel/revision.sp and .shrapnel/compat/bswap.hco files that will
> not be so cluttering ;-)

I've got some WIP efforts in other areas to do that for some other rules.

The problem is that you need to "mkdir .shrapnel" to create a ".shrapnel/revision.sp". So you need the ".shrapnel/revision.sp" to depend on the ".shrapnel".

Except you'll find that the naïve implementation of that fails, since any file you create will bump the mtime of the containing directory, so you'll keep re-making ".shrapnel/revision.sp" because ".shrapnel" changed, because ".shrapnel/revision.sp" changed...

This is why we have the "missing_dep_dirs" hack for "COMPUTE_HEADER_DEPENDENCIES" in the Makefile, i.e. we'll make the directory, but only if it doesn't exist, we bypass the normal "make" dependency mechanism.

Another way to deal with it is to have say a build-stuff/dropit-here/file.gen that you build from a top-leve file.c, then depend on a "build-stuff", that does a "mkdir -p build-stuff/dropit-here", I used that trick in another case where the file.gen were not nested.

But for creating subdirs etc. you'll quickly get into a lot of nastyness, which I'd prefer to just avoid here.

We already have e.g. the *.hcc files, let's leave generating these on the side somewhere to some more general topic, which could also move the *.o files out of the top-level if we're caring about the cleanliness of the top-level directory.

Previous: Junio C HamanoNext: Junio C Hamano
Message 11 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.