From e4b9236dbe4b518af1377845707ec9662a17447f Mon Sep 17 00:00:00 2001 From: Michele Guerini Rocco Date: Mon, 22 Apr 2024 14:07:35 +0200 Subject: [PATCH] depend: remove script Using the libgray approach the script is not needed anymore. Instead of collecting all indirect dependencies of an object (essentially redoing the work of the linker), we just link libgray. This causes slightly more recompilations, but it's a lot simpler. --- depend | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100755 depend diff --git a/depend b/depend deleted file mode 100755 index 2b2de5e..0000000 --- a/depend +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# Compute the dependencies (direct and transitive) of an object -# This is used to collect all objects needed to link a program. - -# Bail out when .d files are missing -test -f "${1%.o}.d" || exit 1 - -# Check whether $1 contains substring $2 -contains(){ test "${1#*$2}" != "$1"; } - -# Walk the dependency graph (consisting of the set of all .d files) -# and output the visited nodes (objects). -walk_dag(){ - while read -r line; do - # skip the first line (file own name) - contains "$line" ': ' && continue - # only look up object files - contains "$line" '.o ' || continue - line="${line% \\}" - contains "$visited" "$line" && continue - visited="$line:$visited" - printf '%s ' "$line" - # whether the node is a leaf - test "$(wc -l < "${line%.o}.d")" -gt 1 && walk_dag < "${line%.o}.d" - done -} - -printf '%s ' "$1" # the object itself -walk_dag < "${1%.o}.d"