Skip to content

Commit 7c81295

Browse files
avargitster
authored andcommitted
Makefile: don't perform "mv $@+ $@" dance for $(GENERATED_H)
Change the "cmd.sh > $@+ && mv $@+ $@" pattern used for generating the config-list.h and command-list.h to just "cmd.sh >$@". This was needed as a guard to ensure that we don't have an empty file if the script failed, but since 7b76d6b (Makefile: add and use the ".DELETE_ON_ERROR" flag, 2021-06-29) GNU make ensures that doesn't happen. There's still a lot of other places in the Makefile where we needlessly use this pattern, but I'm just changing these because I'm about to add a new $(GENERATED_H) target, let's have them all look and act the same way. Even with ".DELETE_ON_ERROR" there is still a point to using the "mv $@+ $@" pattern in some cases, e.g. to ensure that you have a working binary during recompilation (see [1] for the start of a long discussion about that), but that doesn't apply here. Nothing external uses $(GENERATED_H) directly, it's only ever used in the context of the Makefile's own dependency (re-)generation. 1. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7c3c0a9 commit 7c81295

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,15 +2231,14 @@ $(BUILT_INS): git$X
22312231
config-list.h: generate-configlist.sh
22322232

22332233
config-list.h: Documentation/*config.txt Documentation/config/*.txt
2234-
$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
2235-
>$@+ && mv $@+ $@
2234+
$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
22362235

22372236
command-list.h: generate-cmdlist.sh command-list.txt
22382237

22392238
command-list.h: $(wildcard Documentation/git*.txt)
22402239
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
22412240
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
2242-
command-list.txt >$@+ && mv $@+ $@
2241+
command-list.txt >$@
22432242

22442243
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
22452244
$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\

0 commit comments

Comments
 (0)