2013-05-24 03:02:46 +08:00
|
|
|
#!/bin/sh
|
|
|
|
if [ "$1" = "-r" ]
|
|
|
|
then
|
|
|
|
# We're being called recursively by another xidepend instance, so
|
|
|
|
# suppress outputs that only happen at the top level.
|
|
|
|
shift
|
|
|
|
subproc=1
|
|
|
|
else
|
|
|
|
subproc=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for f in "$@"
|
|
|
|
do
|
2015-06-12 17:56:55 +08:00
|
|
|
f=`basename "$f"`
|
2024-01-18 17:53:25 +08:00
|
|
|
if grep -F -q 'xi:include' "$f"
|
2013-05-24 03:02:46 +08:00
|
|
|
then
|
|
|
|
# This file uses XIncludes. Let's chase its deps recursively.
|
2013-06-04 19:50:41 +08:00
|
|
|
base=`basename "$f" .xml`
|
2015-06-12 20:30:50 +08:00
|
|
|
if [ $subproc -eq 0 ] ; then echo -n "${base}_SOURCES=${f}" ; fi
|
2013-05-24 03:02:46 +08:00
|
|
|
|
|
|
|
deps=`grep 'xi:include.*href' "$f" | cut -f2 -d\" | tr '\n' ' '`
|
|
|
|
echo -n " $deps"
|
|
|
|
for d in $deps
|
|
|
|
do
|
|
|
|
# Call ourselves recursively to continue to collect deps.
|
|
|
|
# The -r flag tells our subprocess that it is merely
|
|
|
|
# contributing to a dependency line in progress.
|
|
|
|
$0 -r $d
|
|
|
|
done
|
|
|
|
|
|
|
|
# If we're at the top recursion level, we have nothing else to
|
|
|
|
# add to this dependency line other than the newline.
|
|
|
|
if [ $subproc -eq 0 ] ; then echo ; fi
|
|
|
|
fi
|
|
|
|
done
|