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

Re: [PATCH v2 2/3] Makefile: define "TEST_{PROGRAM,OBJS}" variables earlier

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2022, 16:47 UTC
Message-ID
<xmqqsfjailak.fsf@gitster.g>
In-Reply-To
<patch-v2-2.3-6dcb49f25c4-20221026T143534Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 5 quoted lines
> Define the variables that make up TEST_OBJS earlier, and don't go back
> & forth in their definition. Before we'd first append $X to
> $(TEST_PROGRAMS), and then substitute $X back out of it to define
> $(TEST_OBJS). Let's instead add a new $(TEST_PROGRAM_OBJS) variable,
> which avoids this needless back & forth substitution.
Makes sense, I guess.  So TEST_OBJS is no longer used?
>  TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
> +all:: $(TEST_PROGRAMS)

This change is not necessary to achieve the stated goal of this step, though. It is one of those "while at it" distraction that consumes our already constrained reviewer bandwidth, no?

Having said that, "all::" being able to be built up with independent pieces shine here in this split from the original. It probably is easier to reason about while seeing this isolated area of Makefile what is being done to TEST_PROGRAMS.

The rest of the patch is quite straight-forward renaming of TEST_OBJS to TEST_PROGRAM_OBJS and an improvement of how the elements on the list are computed from the source-of-truth list that is TEST_PROGRAMS_NEED_X that looks correct.

> +TEST_PROGRAM_OBJS += $(patsubst %,t/helper/%.o,$(TEST_PROGRAMS_NEED_X))
> +.PRECIOUS: $(TEST_PROGRAM_OBJS)
Show 41 quoted lines
>  # List built-in command $C whose implementation cmd_$C() is not in
>  # builtin/$C.o but is linked in as part of some other command.
> @@ -2543,10 +2548,8 @@ REFTABLE_TEST_OBJS += reftable/stack_test.o
>  REFTABLE_TEST_OBJS += reftable/test_framework.o
>  REFTABLE_TEST_OBJS += reftable/tree_test.o
>  
> -TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
> -
>  .PHONY: test-objs
> -test-objs: $(TEST_OBJS)
> +test-objs: $(TEST_PROGRAM_OBJS)
>  
>  GIT_OBJS += $(LIB_OBJS)
>  GIT_OBJS += $(BUILTIN_OBJS)
> @@ -2562,7 +2565,7 @@ scalar-objs: $(SCALAR_OBJS)
>  OBJECTS += $(GIT_OBJS)
>  OBJECTS += $(SCALAR_OBJS)
>  OBJECTS += $(PROGRAM_OBJS)
> -OBJECTS += $(TEST_OBJS)
> +OBJECTS += $(TEST_PROGRAM_OBJS)
>  OBJECTS += $(XDIFF_OBJS)
>  OBJECTS += $(FUZZ_OBJS)
>  OBJECTS += $(REFTABLE_OBJS) $(REFTABLE_TEST_OBJS)
> @@ -3061,7 +3064,7 @@ endif
>  
>  test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
>  
> -all:: $(TEST_PROGRAMS) $(test_bindir_programs)
> +all:: $(test_bindir_programs)
>  
>  bin-wrappers/%: wrap-for-bin.sh
>  	$(call mkdir_p_parent_template)
> @@ -3087,8 +3090,6 @@ perf: all
>  
>  .PHONY: test perf
>  
> -.PRECIOUS: $(TEST_OBJS)
> -
>  t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
>  
>  t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(REFTABLE_TEST_LIB)
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 23 of 70 in “scalar: integrate into core Git”
  1. 0/8 scalar: integrate into core GitVictoria Dye via GitGitGadget, Aug 31, 2022
  2. 1/8 scalar: fix command documentation section headerVictoria Dye via GitGitGadget, Aug 31, 2022
  3. 3/8 git help: special-case `scalar`Johannes Schindelin via GitGitGadget, Aug 31, 2022
  4. 2/8 scalar: include in standard Git build & installationVictoria Dye via GitGitGadget, Aug 31, 2022
  5. Johannes SchindelinSep 1, 2022
  6. 0/5 Makefile: split up $(test_bindir_programs)Ævar Arnfjörð Bjarmason, Sep 1, 2022
  7. 1/5 Makefile: factor sed-powered '#!/bin/sh' munging into a variableÆvar Arnfjörð Bjarmason, Sep 1, 2022
  8. 2/5 Makefile: define "TEST_{PROGRAM,OBJS}" variables earlierÆvar Arnfjörð Bjarmason, Sep 1, 2022
  9. 3/5 Makefile: simplify $(test_bindir_programs) rule by splitting it upÆvar Arnfjörð Bjarmason, Sep 1, 2022
  10. 5/5 Makefile: fix "make clean && make bin-wrappers/$NAME" dependenciesÆvar Arnfjörð Bjarmason, Sep 1, 2022
  11. 4/5 Makefile: define bin-wrappers/% rules with a templateÆvar Arnfjörð Bjarmason, Sep 1, 2022
  12. Derrick StoleeSep 1, 2022
  13. Johannes SchindelinSep 2, 2022
  14. 0/3 Makefile: fix issues with bin-wrappers/% ruleÆvar Arnfjörð Bjarmason, Oct 26, 2022
  15. 1/3 Makefile: factor sed-powered '#!/bin/sh' munging into a variableÆvar Arnfjörð Bjarmason, Oct 26, 2022
  16. Junio C HamanoOct 26, 2022
  17. 3/3 Makefile: simplify $(test_bindir_programs) rule by splitting it upÆvar Arnfjörð Bjarmason, Oct 26, 2022
  18. Junio C HamanoOct 26, 2022
  19. Ævar Arnfjörð BjarmasonOct 26, 2022
  20. Junio C HamanoOct 26, 2022
  21. Ævar Arnfjörð BjarmasonOct 26, 2022
  22. 2/3 Makefile: define "TEST_{PROGRAM,OBJS}" variables earlierÆvar Arnfjörð Bjarmason, Oct 26, 2022
  23. Junio C HamanoOct 26, 2022
  24. Ævar Arnfjörð BjarmasonOct 26, 2022
  25. Junio C HamanoOct 26, 2022
  26. Jeff KingOct 28, 2022
  27. Ævar Arnfjörð BjarmasonOct 28, 2022
  28. 0/4 Makefile: untangle bin-wrappers/% rule complexityÆvar Arnfjörð Bjarmason, Oct 31, 2022
  29. 1/4 Makefile: factor sed-powered '#!/bin/sh' munging into a variableÆvar Arnfjörð Bjarmason, Oct 31, 2022
  30. 3/4 Makefile: rename "test_bindir_programs" variable, pre-declareÆvar Arnfjörð Bjarmason, Oct 31, 2022
  31. 2/4 Makefile: define "TEST_{PROGRAM,OBJS}" variables earlierÆvar Arnfjörð Bjarmason, Oct 31, 2022
  32. 4/4 Makefile: simplify $(test_bindir_programs) rule by splitting it upÆvar Arnfjörð Bjarmason, Oct 31, 2022
  33. Taylor BlauOct 31, 2022
  34. Ævar Arnfjörð BjarmasonNov 1, 2022
  35. 4/8 scalar: implement the `help` subcommandJohannes Schindelin via GitGitGadget, Aug 31, 2022
  36. Ævar Arnfjörð BjarmasonAug 31, 2022
  37. Victoria DyeSep 1, 2022
  38. Johannes SchindelinSep 1, 2022
  39. Johannes SchindelinSep 1, 2022
  40. 5/8 scalar-clone: add test coverageVictoria Dye via GitGitGadget, Aug 31, 2022
  41. Johannes SchindelinSep 1, 2022
  42. Victoria DyeSep 1, 2022
  43. Johannes SchindelinSep 2, 2022
  44. Junio C HamanoSep 2, 2022
  45. 7/8 t/perf: add 'GIT_PERF_USE_SCALAR' run optionVictoria Dye via GitGitGadget, Aug 31, 2022
  46. Johannes SchindelinSep 1, 2022
  47. Victoria DyeSep 2, 2022
  48. Johannes SchindelinSep 2, 2022
  49. 6/8 t/perf: add Scalar performance testsVictoria Dye via GitGitGadget, Aug 31, 2022
  50. Johannes SchindelinSep 1, 2022
  51. Victoria DyeSep 1, 2022
  52. Victoria DyeSep 1, 2022
  53. Johannes SchindelinSep 2, 2022
  54. Junio C HamanoSep 1, 2022
  55. 8/8 Documentation/technical: include Scalar technical docVictoria Dye via GitGitGadget, Aug 31, 2022
  56. Ævar Arnfjörð BjarmasonAug 31, 2022
  57. Victoria DyeAug 31, 2022
  58. Johannes SchindelinSep 1, 2022
  59. 0/9 scalar: integrate into core GitVictoria Dye via GitGitGadget, Sep 2, 2022
  60. 4/9 scalar: implement the `help` subcommandJohannes Schindelin via GitGitGadget, Sep 2, 2022
  61. 3/9 git help: special-case `scalar`Johannes Schindelin via GitGitGadget, Sep 2, 2022
  62. 1/9 scalar: fix command documentation section headerVictoria Dye via GitGitGadget, Sep 2, 2022
  63. 7/9 t/perf: add Scalar performance testsVictoria Dye via GitGitGadget, Sep 2, 2022
  64. 6/9 scalar-clone: add test coverageVictoria Dye via GitGitGadget, Sep 2, 2022
  65. 2/9 scalar: include in standard Git build & installationVictoria Dye via GitGitGadget, Sep 2, 2022
  66. 8/9 t/perf: add 'GIT_PERF_USE_SCALAR' run optionVictoria Dye via GitGitGadget, Sep 2, 2022
  67. 9/9 Documentation/technical: include Scalar technical docVictoria Dye via GitGitGadget, Sep 2, 2022
  68. 5/9 scalar: add to 'git help -a' command listVictoria Dye via GitGitGadget, Sep 2, 2022
  69. Johannes SchindelinSep 5, 2022
  70. Derrick StoleeSep 8, 2022

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.