Thread (14 messages) 14 messages, 1 author, 2021-03-29

[PATCH] Makefile: generate 'git' as 'cc [...] -o git+ && mv git+ git'

flat view
STALE2020d

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-03-07 13:21:07
Subsystem: kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers: Nathan Chancellor, Nicolas Schier, Linus Torvalds

Change the compilation of the main 'git' binary to not have the CC
clobber 'git' in-place. This means that e.g. running the test suite
in-place and recompiling won't fail whatever tests happen to be
running for the duration of the binary being regenerated.

This is not a complete solution, in particular I'm not doing this for
any of the git-* binaries, so it's effectively only for
SKIP_DASHED_BUILT_INS=Y.

I think that's fine for a small best-effort solution to this, even
those who rely on dashed binaries for something are likely mostly
using 'git' for whatever scripts they have running out of their
git.git checkout.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index dfb0f1000fa..c5c754a9a12 100644
--- a/Makefile
+++ b/Makefile
@@ -2159,8 +2159,9 @@ git.sp git.s git.o: EXTRA_CPPFLAGS = \
 	'-DGIT_INFO_PATH="$(infodir_relative_SQ)"'
 
 git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
-	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
-		$(filter %.o,$^) $(LIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@+ $(ALL_LDFLAGS) \
+		$(filter %.o,$^) $(LIBS) && \
+	mv $@+ $@
 
 help.sp help.s help.o: command-list.h
 
-- 
2.31.0.rc0.126.g04f22c5b82
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help