38529ea03a
Change xidepend to create a variable containing all the XIncluded sources, which can be used as a dependency, rather than writing the dependency target itself. Future work: Makefile.dep should depend on xidepend, but xidepend should not be passed to itself. 2015-06-12 Jon Turney <jon.turney@dronecode.org.uk> * xidepend: Write a Makefile fragment defining variables containing all the XIncluded sources, rather than a dependency on those sources. * Makefile.in: Use that variable to express the dependency. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
36 lines
896 B
Bash
Executable File
36 lines
896 B
Bash
Executable File
#!/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
|
|
f=`basename "$f"`
|
|
if fgrep -q 'xi:include' "$f"
|
|
then
|
|
# This file uses XIncludes. Let's chase its deps recursively.
|
|
base=`basename "$f" .xml`
|
|
if [ $subproc -eq 0 ] ; then echo -n "${base}_SOURCES=${f}" ; fi
|
|
|
|
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
|