Welcome to mirror list, hosted at ThFree Co, Russian Federation.

xidepend « doc « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cc04f4a121c588fb4d952a0f56c8f5ee05a57e09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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