📄 getdep.pl
字号:
#! /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.c\n"
unless $#ARGV == 1;
$object = $ARGV[0];
$source = $ARGV[1];
$source =~ s/\//\\/g;
# The object is probably of the form 'XXnnnn\name.o'. Fix this to be
# '$(TARGETDIR)\name.o'.
$object =~ s/^[A-Z0-9a-z]+\\/\$\(TARGETDIR\)\\/;
print "# Autogenerated dependency file via getdep.pl and preprocessor output\n\n";
print "$object: $source\n";
%deps = ();
while (<STDIN>) {
next unless (/^\s*\#line\s+\d+\s+\"(.*)\"/);
# Fix up a few names.
$name = $1;
$name =~ s/\<stdin\>/$source/;
$name =~ s/\//\\/g;
print "$object: $name\n" if $name =~ m/\\/ && $name ne $source;
#if ($name !~ /$source/ ) { print STDERR "$object: $name\n"; }
#$deps{$name} = 1 if $name !~ /$source/;
}
###########################################################################
# End of Perl script.
###########################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -