summaryrefslogtreecommitdiff
path: root/scripts/build/run-if-changed.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/run-if-changed.sh')
-rwxr-xr-xscripts/build/run-if-changed.sh45
1 files changed, 0 insertions, 45 deletions
diff --git a/scripts/build/run-if-changed.sh b/scripts/build/run-if-changed.sh
deleted file mode 100755
index 6cdc7c4..0000000
--- a/scripts/build/run-if-changed.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-set -eu
-
-cmdfile=$1
-output=$2
-description=$3
-shift 3
-
-rebuild=false
-if [ ! -e "$output" ] || [ ! -e "$cmdfile" ]; then
- rebuild=true
-fi
-
-while [ "$#" -gt 0 ] && [ "$1" != "--" ]; do
- prerequisite=$1
- shift
- if [ "$prerequisite" != FORCE ] && [ -e "$prerequisite" ] && \
- [ "$prerequisite" -nt "$output" ]; then
- rebuild=true
- fi
-done
-
-[ "$#" -gt 0 ] || { echo "run-if-changed: missing --" >&2; exit 2; }
-shift
-
-signature=$(printf '%s\0' "$@" | cksum)
-old_signature=
-if [ -e "$cmdfile" ]; then
- old_signature=$(cat "$cmdfile")
-fi
-if [ "$signature" != "$old_signature" ]; then
- rebuild=true
-fi
-
-if [ "$rebuild" = true ]; then
- printf ' %s\n' "$description"
- mkdir -p "$(dirname "$output")" "$(dirname "$cmdfile")"
- "$@"
- tmp="$cmdfile.tmp.$$"
- printf '%s\n' "$signature" > "$tmp"
- mv -f "$tmp" "$cmdfile"
-fi
-