Makefile: allow "bin-wrappers/" directory to exist
The "bin-wrappers/" directory gets created by our build system and is populated with one script for each of our binaries. There isn't anything inherently wrong with the current layout, but it is somewhat hard to adapt for out-of-tree build systems. Adapt the layout such that our "bin-wrappers/" directory always exists and contains our "wrap-for-bin.sh" script to make things a little bit easier for subsequent steps. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Dec 6, 2024 at 14:24 UTC
95bcd6f0b709ec6e761270732946651757cc11c3
6 files changed
+16
-8
.gitignore
-1
@@ -12,7 +12,6 @@
12
/GIT-TEST-SUITES
13
/GIT-USER-AGENT
14
/GIT-VERSION-FILE
15
-/bin-wrappers/
15
/git
16
/git-add
17
/git-am
Documentation/CodingGuidelines
+1
-1
@@ -583,7 +583,7 @@ For C programs:
583
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
584
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
585
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
586
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
586
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
587
588
- The primary data structure that a subsystem 'S' deals with is called
589
`struct S`. Functions that operate on `struct S` are named
Makefile
+3
-3
@@ -3202,8 +3202,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
3202
3203
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
3204
3205
-bin-wrappers/%: wrap-for-bin.sh
3206
- $(call mkdir_p_parent_template)
3205
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
3206
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
3207
-e 's|@BUILD_DIR@|$(shell pwd)|' \
3208
-e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
@@ -3700,7 +3699,8 @@ clean: profile-clean coverage-clean cocciclean
3699
$(RM) $(SP_OBJ)
3700
$(RM) $(HCC)
3701
$(RM) version-def.h
3703
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
3702
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
3703
+ $(RM) $(test_bindir_programs)
3704
$(RM) -r po/build/
3705
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
3706
$(RM) -r .dist-tmp-dir .doc-tmp-dir
bin-wrappers/.gitignore
new
+9
@@ -0,0 +1,9 @@
1
+/git
2
+/git-cvsserver
3
+/git-receive-pack
4
+/git-shell
5
+/git-upload-archive
6
+/git-upload-pack
7
+/scalar
8
+/test-fake-ssh
9
+/test-tool
bin-wrappers/wrap-for-bin.sh
renamed
contrib/buildsystems/CMakeLists.txt
+3
-3
@@ -1095,20 +1095,20 @@ set(wrapper_test_scripts
1095
1096
1097
foreach(script ${wrapper_scripts})
1098
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
1098
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
1099
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
1100
string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}")
1101
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
1102
endforeach()
1103
1104
foreach(script ${wrapper_test_scripts})
1105
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
1105
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
1106
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
1107
string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
1108
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
1109
endforeach()
1110
1111
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
1111
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
1112
string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
1113
string(REPLACE "@PROG@" "git-cvsserver" content "${content}")
1114
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})