Eliminate the copy/pasting among the three rules generating the bin-wrappers/% files by refactoring them into a template. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- Makefile | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 96de9e55864..533858ca481 100644 --- a/Makefile +++ b/Makefile @@ -3071,23 +3071,18 @@ sed \ chmod +x $@ endef -BW_BINDIR_PROGRAMS_NEED_X = $(BINDIR_PROGRAMS_NEED_X:%=bin-wrappers/%) -BIN_WRAPPERS += $(BW_BINDIR_PROGRAMS_NEED_X) -$(BW_BINDIR_PROGRAMS_NEED_X): wrap-for-bin.sh - $(call mkdir_p_parent_template) - $(QUIET_GEN)$(call cmd_munge_bin_wrappers_script,$(@F),,$X) - -BW_BINDIR_PROGRAMS_NO_X = $(BINDIR_PROGRAMS_NO_X:%=bin-wrappers/%) -BIN_WRAPPERS += $(BW_BINDIR_PROGRAMS_NO_X) -$(BW_BINDIR_PROGRAMS_NO_X): wrap-for-bin.sh - $(call mkdir_p_parent_template) - $(QUIET_GEN)$(call cmd_munge_bin_wrappers_script,$(@F)) +define bin_wrappers_template +BW_$(1) = $$($(1):%=bin-wrappers/%) +BIN_WRAPPERS += $$(BW_$(1)) +all:: $$(BW_$(1)) +$$(BW_$(1)): wrap-for-bin.sh + $$(call mkdir_p_parent_template) + $$(QUIET_GEN)$$(call cmd_munge_bin_wrappers_script,$(2),$(3)) +endef -BW_TEST_PROGRAMS_NEED_X = $(TEST_PROGRAMS_NEED_X:%=bin-wrappers/%) -BIN_WRAPPERS += $(BW_TEST_PROGRAMS_NEED_X) -$(BW_TEST_PROGRAMS_NEED_X): wrap-for-bin.sh - $(call mkdir_p_parent_template) - $(QUIET_GEN)$(call cmd_munge_bin_wrappers_script,$(@F),t/helper/,$X) +$(eval $(call bin_wrappers_template,BINDIR_PROGRAMS_NEED_X,'$$(@F)',,$$X)) +$(eval $(call bin_wrappers_template,BINDIR_PROGRAMS_NO_X,'$$(@F)')) +$(eval $(call bin_wrappers_template,TEST_PROGRAMS_NEED_X,'$$(@F)',t/helper/,$$X)) all:: $(BIN_WRAPPERS) -- 2.37.3.1426.g360dd7cf8ca