mdepend.pl

来自「在高通的手机平台下,一个下载手机.bin文件到手机的flash中的工具,包含PC」· PL 代码 · 共 95 行

PL
95
字号
#! /usr/bin/env perl

#############################################################################
#
#                            M D E P E N D
#
# GENERAL DESCRIPTION
#   Merge dependencies generated by getdep.pl into the real makefile.
#
#   The makefile is searched for a line beginning with
#    # DO NOT EDIT BELOW THIS LINE
#   All lines below this line are removed and the dependencies are
#   placed at this point.
#
# INVOCATION
#   perl mdepend.pl target.mak TARGET ["object list"]
#
# Copyright (c) 1998 - 2002 by QUALCOMM Incorporated.  All Rights Reserved.
#############################################################################
#
#                        EDIT HISTORY FOR FILE
#
# $PVCSPath:  L:/src/asw/MSM6050/vcs/mdepend.plv   1.0   23 Oct 2001 15:28:10   donb  $
# $Header: //depot/asic/msm6050/tools/uuidgen/mdepend.pl#2 $ $DateTime: 2002/07/05 11:55:40 $ $Author: ropalsky $
#
# when       who     what, where, why
# --------   ---     --------------------------------------------------------
# 07/05/02    ro     Use optional command line list of objects to copy only
#                    dependencies of objects used in the makefile.
# 10/13/98   dlb     Initial version.
#
#############################################################################

die "Usage: perl mdepend.pl target.mak TARGET\n"
    unless $#ARGV >= 1;

$makefile = $ARGV[0];
$target   = $ARGV[1];

my $objects;
my %dependency_list;

# Convert a string containing space-separated object file names
# to a table of dependency file names
if ($ARGV[2] ne undef) {
  $objects = $ARGV[2];
  $objects =~ s/\.o/\.dep/g;
  foreach (split(/ /,$objects)) {
    $dependency_list{$_} = 1;
  }
}  

############################################################
# Begin by copying the normal part of the makefile.
############################################################

$found_line = 0;

open (IN, "<$makefile") || die "Can't read makefile\n";
while (<IN>) {
  if (/^\# DO NOT EDIT BELOW THIS LINE/) {
    print;
    $found_line = 1;
    last;
  }
  print;
}
close (IN);

die "No '# DO NOT EDIT BELOW THIS LINE' found in makefile\n"
    unless $found_line;

############################################################
# Now merge in the dependencies.
############################################################

for $name (<$target/*.dep>) {

  # Check object if the object list was provided  
  next if (($ARGV[2] ne undef) && ($dependency_list{$name} eq undef));
  
  open (IN, "<$name") || die "Can't read file: $name";
  print "\n";
  while (<IN>) {
    print;
  }
  close IN;
}

print "\n# End of auto generated dependencies.\n";

###########################################################################
# End of Perl script.
###########################################################################

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?