#!/usr/bin/perl
#
#-----------------------------------------------------------------
#
# Name:	fix_deps.pl
#
# RCS:  $Id: fix_deps.pl,v 1.1 2001/08/21 18:29:03 rick Exp $
#
# Copyright (C) 2001, Agile Storage, Inc.
#
# Description:	
#
#				usage: "fix_deps 
#
# Created by:	Rick Lund
#
# Date Created:	9/20/01
#
#-----------------------------------------------------------------
#

$exe = $0;

if (@ARGV != 5)
{
	print "Invalid $exe usage\n";
	exit -1;
}

$orig_target_obj = shift;
$new_target_obj = shift;
$new_target_dep = shift;
$iname = shift;
$oname = shift;

#print "fix_deps: $orig_target_obj, $new_target_obj, $new_target_dep, $iname, $oname\n";

open IFILE, "<$iname"
		or die "Cannot open input file: $!";

open OFILE, ">$oname"
		or die "Cannot create output file: $!";

while (<IFILE>)
{
	@words = split;

	if (/^$orig_target_obj/) {
		shift @words;
		print OFILE "$new_target_obj $new_target_dep : @words\n";
	}
	else {
		print OFILE $_;
	}
}

