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

[PATCH v4 0/5] Makefile: "make tags" fixes & cleanup

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 4, 2021, 22:54 UTC
Message-ID
<cover-v4-0.5-00000000000-20210804T225222Z-avarab@gmail.com>
In-Reply-To
<cover-0.5-00000000000-20210721T231900Z-avarab@gmail.com>

The big win here is that none of the tags targets depend on "FORCE" anymore, so we'll only re-generate them if our sources change.

For v3, see: https://lore.kernel.org/git/cover-0.5-00000000000-20210721T231900Z-avarab@gmail.com/

This addresses the feedback about the cscope* v.s. cscope.out rule in .gitignore and "make clean", i.e. those rules are not being changed anymore. I also changed a stray cscope.out to $@ in 4/5, which was missed in v3.

Ævar Arnfjörð Bjarmason (5):
  Makefile: move ".PHONY: cscope" near its target
  Makefile: add QUIET_GEN to "cscope" target
  Makefile: don't use "FORCE" for tags targets
  Makefile: remove "cscope.out", not "cscope*" in cscope.out target
  Makefile: normalize clobbering & xargs for tags targets
 Makefile | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)
Range-diff against v3:
1:  6b4ddc126d9 = 1:  2ee725e2fba Makefile: move ".PHONY: cscope" near its target
2:  d3d5d332e92 = 2:  2122cb25633 Makefile: add QUIET_GEN to "cscope" target
3:  9dd69d68178 = 3:  8649716772b Makefile: don't use "FORCE" for tags targets
4:  f8d151f1f6a ! 4:  643c514e12a Makefile: the "cscope" target always creates a "cscope.out"
    @@ Metadata
     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## Commit message ##
    -    Makefile: the "cscope" target always creates a "cscope.out"
    +    Makefile: remove "cscope.out", not "cscope*" in cscope.out target
     
    -    In the preceding commit the "cscope" target was changed to be a phony
    -    alias for the "cscope.out" target.
    +    Before we generate a "cscope.out" file, remove that file explicitly,
    +    and not everything matching "cscope*". This doesn't change any
    +    behavior of the Makefile in practice, but makes this rule less
    +    confusing, and consistent with other similar rules.
     
         The cscope target was added in a2a9150bf06 (makefile: Add a cscope
    -    target, 2007-10-06), and has always referred to cscope* instead of to
    -    cscope.out.
    +    target, 2007-10-06). It has always referred to cscope* instead of to
    +    cscope.out in .gitignore and the "clean" target, even though we only
    +    ever generated a cscope.out file.
     
    -    As far as I can tell this ambiguity was never needed. The
    -    "-fcscope.out" (note, no whitespace) argument is enabled by default,
    -    but let's provide it explicitly for good measure.
    +    This was seemingly done to aid use-cases where someone invoked cscope
    +    with the "-q" flag, which would make it create a "cscope.in.out" and
    +    "cscope.po.out" files in addition to "cscope.out".
     
    -    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    +    But us removing those files we never generated is confusing, so let's
    +    only remove the file we need to, furthermore let's use the "-f" flag
    +    to explicitly name the cscope.out file, even though it's the default
    +    if not "-f" argument is supplied.
    +
    +    It is somewhat inconsistent to change from the glob here but not in
    +    the "clean" rule and .gitignore, an earlier version of this change
    +    updated those as well, but see [1][2] for why they were kept.
     
    - ## .gitignore ##
    -@@
    - /.vscode/
    - /tags
    - /TAGS
    --/cscope*
    -+/cscope.out
    - /compile_commands.json
    - *.hcc
    - *.obj
    +    1. https://lore.kernel.org/git/87k0lit57x.fsf@evledraar.gmail.com/
    +    2. https://lore.kernel.org/git/87im0kn983.fsf@evledraar.gmail.com/
    +
    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## Makefile ##
     @@ Makefile: tags: $(FOUND_SOURCE_FILES)
    @@ Makefile: tags: $(FOUND_SOURCE_FILES)
      cscope.out: $(FOUND_SOURCE_FILES)
     -	$(QUIET_GEN)$(RM) cscope* && \
     -	echo $(FOUND_SOURCE_FILES) | xargs cscope -b
    -+	$(QUIET_GEN)$(RM) cscope.out && \
    ++	$(QUIET_GEN)$(RM) $@ && \
     +	echo $(FOUND_SOURCE_FILES) | xargs cscope -f$@ -b
      
      .PHONY: cscope
      cscope: cscope.out
    -@@ Makefile: clean: profile-clean coverage-clean cocciclean
    - 	$(RM) $(HCC)
    - 	$(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
    - 	$(RM) -r po/build/
    --	$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
    -+	$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope.out
    - 	$(RM) -r .dist-tmp-dir .doc-tmp-dir
    - 	$(RM) $(GIT_TARNAME).tar.gz
    - 	$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
5:  f3ff76d0e98 ! 5:  1eaf3416329 Makefile: normalize clobbering & xargs for tags targets
    @@ Makefile: FIND_SOURCE_FILES = ( \
     +	mv $@+ $@
      
      cscope.out: $(FOUND_SOURCE_FILES)
    --	$(QUIET_GEN)$(RM) cscope.out && \
    +-	$(QUIET_GEN)$(RM) $@ && \
     -	echo $(FOUND_SOURCE_FILES) | xargs cscope -f$@ -b
     +	$(QUIET_GEN)$(RM) $@+ && \
     +	echo $(FOUND_SOURCE_FILES) | xargs cscope -f$@+ -b && \
-- 
2.33.0.rc0.597.gc569a812f0a
Previous: Felipe ContrerasNext: Ævar Arnfjörð Bjarmason
Message 40 of 45 in “Makefile: "make tags" fixes & cleanup”
  1. 0/3 Makefile: "make tags" fixes & cleanupÆvar Arnfjörð Bjarmason, Jun 22, 2021
  2. 1/3 Makefile: move ".PHONY: cscope" near its targetÆvar Arnfjörð Bjarmason, Jun 22, 2021
  3. 2/3 Makefile: fix "cscope" target to refer to cscope.outÆvar Arnfjörð Bjarmason, Jun 22, 2021
  4. Jeff KingJun 22, 2021
  5. Chris TorekJun 22, 2021
  6. Felipe ContrerasJun 23, 2021
  7. Felipe ContrerasJun 23, 2021
  8. Felipe ContrerasJun 23, 2021
  9. 3/3 Makefile: don't use "FORCE" for tags targetsÆvar Arnfjörð Bjarmason, Jun 22, 2021
  10. Jeff KingJun 22, 2021
  11. Felipe ContrerasJun 23, 2021
  12. Taylor BlauJun 22, 2021
  13. Junio C HamanoJun 29, 2021
  14. Ævar Arnfjörð BjarmasonJun 29, 2021
  15. 0/5 Makefile: "make tags" fixes & cleanupÆvar Arnfjörð Bjarmason, Jun 29, 2021
  16. 1/5 Makefile: move ".PHONY: cscope" near its targetÆvar Arnfjörð Bjarmason, Jun 29, 2021
  17. 2/5 Makefile: add QUIET_GEN to "cscope" targetÆvar Arnfjörð Bjarmason, Jun 29, 2021
  18. 3/5 Makefile: fix "cscope" target to refer to cscope.outÆvar Arnfjörð Bjarmason, Jun 29, 2021
  19. Jeff KingJul 1, 2021
  20. Jeff KingJul 1, 2021
  21. 4/5 Makefile: don't use "FORCE" for tags targetsÆvar Arnfjörð Bjarmason, Jun 29, 2021
  22. Ramsay JonesJun 30, 2021
  23. 5/5 Makefile: normalize clobbering & xargs for tags targetsÆvar Arnfjörð Bjarmason, Jun 29, 2021
  24. 0/5 Makefile: "make tags" fixes & cleanupÆvar Arnfjörð Bjarmason, Jul 21, 2021
  25. 1/5 Makefile: move ".PHONY: cscope" near its targetÆvar Arnfjörð Bjarmason, Jul 21, 2021
  26. 2/5 Makefile: add QUIET_GEN to "cscope" targetÆvar Arnfjörð Bjarmason, Jul 21, 2021
  27. 3/5 Makefile: don't use "FORCE" for tags targetsÆvar Arnfjörð Bjarmason, Jul 21, 2021
  28. 4/5 Makefile: the "cscope" target always creates a "cscope.out"Ævar Arnfjörð Bjarmason, Jul 21, 2021
  29. Junio C HamanoJul 22, 2021
  30. Taylor BlauJul 22, 2021
  31. Junio C HamanoJul 22, 2021
  32. Ævar Arnfjörð BjarmasonJul 22, 2021
  33. 5/5 Makefile: normalize clobbering & xargs for tags targetsÆvar Arnfjörð Bjarmason, Jul 21, 2021
  34. Jeff KingJul 23, 2021
  35. Jeff KingJul 23, 2021
  36. Jeff KingJul 23, 2021
  37. Junio C HamanoJul 23, 2021
  38. Felipe ContrerasJul 23, 2021
  39. Felipe ContrerasJul 23, 2021
  40. 0/5 Makefile: "make tags" fixes & cleanupÆvar Arnfjörð Bjarmason, Aug 4, 2021
  41. 1/5 Makefile: move ".PHONY: cscope" near its targetÆvar Arnfjörð Bjarmason, Aug 4, 2021
  42. 2/5 Makefile: add QUIET_GEN to "cscope" targetÆvar Arnfjörð Bjarmason, Aug 4, 2021
  43. 3/5 Makefile: don't use "FORCE" for tags targetsÆvar Arnfjörð Bjarmason, Aug 4, 2021
  44. 4/5 Makefile: remove "cscope.out", not "cscope*" in cscope.out targetÆvar Arnfjörð Bjarmason, Aug 4, 2021
  45. 5/5 Makefile: normalize clobbering & xargs for tags targetsÆvar Arnfjörð Bjarmason, Aug 4, 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.