From 3f145a4fe37099c55c7596e93a4cfd850662f88a Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 6 Dec 2024 14:24:49 +0100 Subject: Makefile: refactor generators to be PWD-independent We have multiple scripts that generate headers from other data. All of these scripts have the assumption built-in that they are executed in the current source directory, which makes them a bit unwieldy to use during out-of-tree builds. Refactor them to instead take the source directory as well as the output file as arguments. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- generate-hooklist.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'generate-hooklist.sh') diff --git a/generate-hooklist.sh b/generate-hooklist.sh index 2f9f54eb54..e22068c2fa 100755 --- a/generate-hooklist.sh +++ b/generate-hooklist.sh @@ -2,6 +2,17 @@ # # Usage: ./generate-hooklist.sh >hook-list.h +SOURCE_DIR="$1" +OUTPUT="$2" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo >&2 "USAGE: $0 " + exit 1 +fi + +{ + cat <"$OUTPUT" -- cgit v1.3