
# Figure out dependencies for lmbench src.
#
# Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com).
# Copyright (c) 1994 Larry McVoy.  GPLed software.
# $Id: s.depend 1.3 97/02/12 18:15:05-08:00 lm $
eval 'exec perl -Ssw $0 "$@"'
	if 0;

open(M, "Makefile");
while(<M>) {
	push(@Makefile, $_);
	last if /^..MAKEDEPEND/;
}
close(M);
open(G, "gcc -MM *.c | grep -v mhz.c | grep -v lat_ctx.c|");
while (<G>) {
	chop;
	split(/:/);
	$_[0] =~ s/\.o\s*$//;
	push(@Makefile, "\$O/$_[0]: $_[1] \$O/lmbench.a\n");
	push(@Makefile, "\t\$(COMPILE) -o \$O/$_[0] $_[0].c \$O/lmbench.a \$(LDLIBS)\n\n");
}
system "mv Makefile Makefile.old";
open(M, ">Makefile");
print M @Makefile;
close(M);
exit 0;
