getdep.pl
上传用户:xinjie
上传日期:2021-05-30
资源大小:491k
文件大小:3k
- #! /usr/bin/env perl
- #############################################################################
- #
- # G E T D E P
- #
- # GENERAL DESCRIPTION
- # Process the output of the C preprocessor into a nice list of dependencies.
- # The -M option on tcc works poorly, and can't handle an assembly file.
- # The first argument is the name of our object file.
- # The second object is the name of our source (needed for <stdin>
- # replacement).
- #
- # INVOCATION
- # perl getdep.pl file.o file.c
- #
- # Copyright (c) 1998, 1999 by QUALCOMM Incorporated. All Rights Reserved.
- #############################################################################
- #
- # EDIT HISTORY FOR FILE
- #
- # $Header: L:/src/asw/MSM5100/vcs/getdep.plv 1.2 16 Jul 2001 16:48:56 karthick $
- #
- # when who what, where, why
- # -------- --- --------------------------------------------------------
- # 07/13/01 jmk Modified #line pattern matching string to accept leading
- # whitespace as well
- # 02/21/00 mt Changes for GNU make - put source as first dependency.
- # 09/15/00 mt Change algorithm to remove dependencies on files that
- # are not in the directory. Previous algorithm did not
- # always remove them. Also, we now only want to remove
- # dependencies that are .h files. This is because for
- # internal RAM builds we have dependencies that are
- # source files located in TARGETDIR.
- # 06/20/00 jcw Changed TARGET to TARGETDIR since they can be different
- # in MSM5000 builds
- # 10/13/98 dlb Initial version.
- #
- #############################################################################
- die "Usage: perl getdep.pl file.o file.cn"
- unless $#ARGV == 1;
- $object = $ARGV[0];
- $source = $ARGV[1];
- $source =~ s///\/g;
- # The object is probably of the form 'XXnnnnname.o'. Fix this to be
- # '$(TARGETDIR)name.o'.
- $object =~ s/^[A-Z0-9a-z]+\/$(TARGETDIR)\/;
- print "# Autogenerated dependency file via getdep.pl and preprocessor outputnn";
- print "$object: $sourcen";
- %deps = ();
- while (<STDIN>) {
- next unless (/^s*#lines+d+s+"(.*)"/);
- # Fix up a few names.
- $name = $1;
- $name =~ s/<stdin>/$source/;
- $name =~ s///\/g;
- print "$object: $namen" if $name =~ m/\/ && $name ne $source;
-
- #if ($name !~ /$source/ ) { print STDERR "$object: $namen"; }
- #$deps{$name} = 1 if $name !~ /$source/;
- }
- ###########################################################################
- # End of Perl script.
- ###########################################################################