aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2021-07-21 23:54:35 +0100
committerTomasz Kramkowski <tk@the-tk.com>2021-07-21 23:54:35 +0100
commit7911c0536c03bca81304521bf7594366a6449044 (patch)
tree6af427fbfa193cec8001e6dec0a08662aa2eb0d9
parent7ba7bf2962dccd55a17d3ff92e098968226fbba3 (diff)
downloadpack-7911c0536c03bca81304521bf7594366a6449044.tar.gz
pack-7911c0536c03bca81304521bf7594366a6449044.tar.xz
pack-7911c0536c03bca81304521bf7594366a6449044.zip
default.o.do: Remove the need for a temporary depfile
By making .compile print dependencies on stdout, the need for a temporary depfile is now gone as the dependencies can be piped straight into parse-depfile.
-rwxr-xr-x.compile.do2
-rwxr-xr-xdefault.o.do8
2 files changed, 4 insertions, 6 deletions
diff --git a/.compile.do b/.compile.do
index 6634b55..3f48dc4 100755
--- a/.compile.do
+++ b/.compile.do
@@ -4,5 +4,5 @@ redo-ifchange .vars.rc
exec >"$3"
echo "# generated by $0"
declare -p CC CFLAGS CPPFLAGS
-echo '"$CC" -MMD -MF "$depfile" "${CFLAGS[@]}" "${CPPFLAGS[@]}" -c -o "$3" "${1%.o}.c"'
+echo '"$CC" -MMD -MF - "${CFLAGS[@]}" "${CPPFLAGS[@]}" -c -o "$3" "${1%.o}.c"'
if command -v redo-stamp &>/dev/null; then redo-stamp <"$3"; fi
diff --git a/default.o.do b/default.o.do
index c7e415b..a2a5e38 100755
--- a/default.o.do
+++ b/default.o.do
@@ -1,8 +1,6 @@
#!/bin/bash -e
+redo-ifchg-pipe() { tr '\n' '\0' | xargs -r0 redo-ifchange; }
src=${1%.o}.c
redo-ifchange .compile .parse-depfile "$src"
-sed -n 's|.*@BUILD_DEP \(.*\)|\1|p' "$src" | tr '\n' '\0' | xargs -r0 redo-ifchange
-depfile=$(mktemp)
-. ./.compile
-./.parse-depfile "$depfile" | tr '\n' '\0' | xargs -r0 redo-ifchange
-rm "$depfile"
+sed -n 's|.*@BUILD_DEP \(.*\)|\1|p' "$src" | redo-ifchg-pipe
+. ./.compile | ./.parse-depfile | redo-ifchg-pipe