From 3b1583274c3951d0ba95e7b5cdf5e14bca5961db Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Wed, 26 Oct 2005 21:13:16 +0000 Subject: [PATCH] Initial version. --- configure/tools/makeDbDepends.pl | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 configure/tools/makeDbDepends.pl diff --git a/configure/tools/makeDbDepends.pl b/configure/tools/makeDbDepends.pl new file mode 100644 index 000000000..729814326 --- /dev/null +++ b/configure/tools/makeDbDepends.pl @@ -0,0 +1,33 @@ +eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- + if $running_under_some_shell; # makeDbDepends.pl + +# Called from within RULES.Db in the Db directories. +# Searches .substitutions and .template files (from the command line) for +# "file xxx {" entries to create a DEPENDS file +# and +# 'include "xxx"' entries to create a DEPENDS file + + +$target = $ARGV[0]; +shift @ARGV; + + +foreach $file (@ARGV) { + open(IN, "<$file") or die "Cannot open $file: $!"; + @infile = ; + close IN or die "Cannot close $file: $!"; + + @depends = grep { s/^\s*file\s*(.*)\s*\{.*$/\1/ } @infile; + chomp @depends; + + if (@depends) { + print "$target: @depends\n"; + } + + @depends2 = grep { s/^\s*include\s*\"\s*(.*)\s*\".*$/\1/ } @infile; + chomp @depends2; + + if (@depends2) { + print "$target: @depends2\n"; + } +}