sbsv1/abld/makmake/makdeps.pm
author Zheng Shen <zheng.shen@nokia.com>
Mon, 30 Aug 2010 15:04:06 +0800
changeset 631 9435b9008a58
parent 599 fa7a3cc6effd
permissions -rw-r--r--
ROM Tools 13.1.0.1 Bug468 initialized static data built into a static library does not get initialized correctly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Module which wraps the dependency information provided the preprocessor when invoked with certain switches
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# so that dependency information rather than preprocessing information is produced.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
package Makdeps;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
	Deps_InitL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
	Deps_SetVerbose
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
	Deps_SetUserHdrsOnly
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
	Deps_SetNoDependencies
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
	Deps_SetSysIncPaths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
	Deps_SetUserIncPaths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
	Deps_SetPlatMacros
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
	Deps_SetStdIncSysIncPaths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
	Deps_GenDependsL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
	Deps_SetPrefixFile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
	Deps_GetNoDependencies
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
	Deps_SetNoDependenciesStatus
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
	Deps_GetOSVariantFile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
	Deps_SetOSVariantFile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
use Checkgcc;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
use Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
use Preprocessor;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
my $ChopSysDecoyPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
my $EPOCIncPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
my @StdPaths;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
my %Mode;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
my @PlatMacros;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
my $SysDecoyPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
my @SysFlags;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
my @SysPaths;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
my @UserFlags;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
my @UserPaths;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
my $PrefixFileOption = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
my $VariantFile=&main::VariantFile();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
# special variable used in pattern-matching - special characters nullified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
my $S_SysDecoyPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
BEGIN {	# NB don't initialise essential items to be provided later by calling module, then will cause errors with undef
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
	$Mode{'Verbose'}=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
	$Mode{'UserHdrsOnly'}=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
	$Mode{'NoDependencies'}=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
	@PlatMacros=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
	# note -MG option assumes missing user headers live in 1st userincpath and missing sys headers in 1st sysdir
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
	@SysPaths=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
	@UserPaths=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
	@StdPaths=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
	@SysFlags=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
	@UserFlags=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
	# Use random number to ensure DecoyPath is unique (ish)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
	srand();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	my $randnum=int(rand(100));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
	if (defined $ENV{PBUILDPID}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
		$SysDecoyPath=&Path_WorkPath."TEMPMAK$ENV{PBUILDPID}SYSDECOY$randnum\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
	} else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
		$SysDecoyPath=&Path_WorkPath."TEMPMAKSYSDECOY$randnum\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
	$S_SysDecoyPath=quotemeta($SysDecoyPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
	$ChopSysDecoyPath=&Path_Chop($SysDecoyPath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
sub Deps_InitL ($@) {	# abs Generated Hdr dir, StdIncsysdir (with drive letter if required)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
# set up a decoy system include path, and set which path will contain generated headers, eg .RSG files, and which
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
# paths are the standard system include paths for the compiler used - eg \MSDEV\INCLUDE
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
	($EPOCIncPath,@StdPaths)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
# remove the decoy directory then try to make it again - if it contains files rmdir won't work, so mkdir won't
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
# work and the user will have to sort it out.  If it doesn't contain files and has been left lying around
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
# because someone has killed the program half-way through, then rmdir will remove it and mkdir will work OK
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
	rmdir $ChopSysDecoyPath if -d $ChopSysDecoyPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
	mkdir $ChopSysDecoyPath,2 or die "ERROR: Can't make temp dir \"$ChopSysDecoyPath\"\nIf it already exists, please remove it\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
sub Deps_SetVerbose {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
	$Mode{'Verbose'}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
sub Deps_SetUserHdrsOnly {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
# allow calling program to dictate that only listings of user headers, not system headers, be produced
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
	$Mode{'UserHdrsOnly'}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
sub Deps_SetNoDependencies {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
# Ensure that we do not create a list of dependencies.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
	$Mode{'NoDependencies'}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
sub Deps_GetNoDependencies {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
# Get the status of NoDependencies.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
	return $Mode{'NoDependencies'};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
sub Deps_SetNoDependenciesStatus($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
# Ensure that we do not create a list of dependencies.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
	$Mode{'NoDependencies'}=shift;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
sub Deps_GetOSVariantFile() {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
# Return the variant .hrh file currently defined
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
	return $VariantFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
sub Deps_SetOSVariantFile($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
# Override the variant .hrh file currently defined
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
	$VariantFile=shift;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
sub Deps_SetSysIncPaths (@) {	# takes list abs paths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
# set the system include paths where we'll look for system included files, and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
# for user included files if these are not found in the user include directories
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
	return unless @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
	@SysPaths=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
	@SysFlags=&Path_Chop(@SysPaths); # newer gcc doesn't like trailing backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
	@SysFlags=&Path_PrefixWithDriveAndQuote(@SysFlags);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
	my $Flag;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
	foreach $Flag (@SysFlags) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
		$Flag=~s/^(.*)$/-I $1/o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
sub Deps_SetUserIncPaths (@) {	# takes list of abs paths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
# set the user include paths to find user included files in
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
	return unless @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
	@UserPaths=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
	@UserFlags=&Path_Chop(@UserPaths); # newer gcc doesn't like trailing backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
	@UserFlags=&Path_PrefixWithDriveAndQuote(@UserFlags);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
	my $Flag;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
	foreach $Flag (@UserFlags) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
		$Flag=~s/^(.*)$/-I $1/o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
sub Deps_SetPlatMacros (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
# set the macros to be defined by the preprocessor
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
	return unless @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
	@PlatMacros=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
	my $Flag;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
	foreach $Flag (@PlatMacros) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
		if($Flag =~ m/\\\"/) { 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
			$Flag =~ s/\\\"/\"/g ; 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
		$Flag=~s/^(.*)$/-D$1/o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
sub Deps_SetPrefixFile($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
    my ($file) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
    $PrefixFileOption = " -include $file ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
sub Deps_GenDependsL ($@) {	# takes abs source filepath and list of Build Macros
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
	if ( $Mode{'NoDependencies'} ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
		# no need build a dependency list.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
		return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
#	Set any more macros the preprocessor needs to be defined for the source file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
#	to be preprocessed.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
#	Call preprocessor and produce the dependency listing.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
	my ($Src,@BldMacros)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
	if (not -e $Src) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
		warn "WARNING: \"",$Src,"\" not found!\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
		return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
# 	Always put the source path at the head of the user path list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
#	and take it out at the end of this function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
	unshift @UserPaths, &Path_Split('Path', lc $Src);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
	my $ChopSysDecoyPath=&Path_Chop($SysDecoyPath); # newer gcc doesn't like trailing backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
	my $MacroFlag;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
	foreach $MacroFlag (@BldMacros) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
		$MacroFlag=~s/^(.*)$/-D$1/o;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
	undef $MacroFlag;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
	my $ChopSrcPath=&Path_Chop(&Path_Split('Path',$Src)); # newer gcc doesn't like trailing backslash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
	my $ProductVariantFlag = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
	if($VariantFile){
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
	    $ProductVariantFlag  = "-include " . &Path_PrefixWithDriveAndQuote($VariantFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
	my $VariantIncludePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
	if (defined &main::PMPrefixFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
	$VariantIncludePath = &main::PMPrefixFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
	$VariantIncludePath =~ s/"//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
	$VariantIncludePath = Path_Split("path", $VariantIncludePath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
	$VariantIncludePath = Path_Chop($VariantIncludePath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
	$VariantIncludePath = Path_PrefixWithDriveAndQuote($VariantIncludePath);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
	my $CPPCommand;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
 	my $exe = &PreprocessorToUseExe();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
	$CPPCommand = "$exe -undef -M -MG -nostdinc $PrefixFileOption";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
	$CPPCommand .= " -I $VariantIncludePath" if $VariantIncludePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
	$CPPCommand .= " -I ".&Path_PrefixWithDriveAndQuote($ChopSrcPath)." @UserFlags -I- -I ".&Path_PrefixWithDriveAndQuote($ChopSysDecoyPath)." @SysFlags @PlatMacros @BldMacros $ProductVariantFlag ".&Path_PrefixWithDriveAndQuote($Src);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
	if ($Mode{'Verbose'}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
		print "$CPPCommand\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
 	open CPPPIPE,"$CPPCommand |" or die "ERROR: Can't invoke $exe.EXE\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
	# XYZ.CPP.o: \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
	#  ..\..\..\base\bafl\src\xyz.cpp \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
	#  ..\..\..\EPOC32\INCLUDE\E32DES16.H ..\..\..\EPOC32\INCLUDE\E32STD.INL \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
	#  ..\..\..\EPOC32\INCLUDE\E32BASE.INL \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
	#  ..\..\..\base\bafl\inc\bautil.h \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
	#  ..\..\..\awkward\ name\bafl\inc\bautil.h \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
	#  ..\..\..\lastthing.h
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
	my @RTWDepList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
	while (<CPPPIPE>) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
		s/ \\$//oi;	# remove trailing continuation character
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
		s/\\ /;/go;	# convert embedded spaces (\<space>) into semicolon which can't occur in filenames
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
		# avoid the target of the rule by requiring whitespace in front of each element
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
		while (/\s(\S+)/go) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
			my $dep = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
			$dep =~ s/;/ /go;	# spaces were turned into semicolon, so convert back again here
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
			$dep =~ s-/-\\-go;	# replace forward slashes with backward slashes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
			$dep =~ s/^.\://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
			$dep =~ s/\s+$//; 	# remove trailing spaces
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
			push @RTWDepList,$dep;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
	close CPPPIPE or die "ERROR: $exe.EXE failure\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
	# drop the first dependent, which is the source file itself
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
	shift @RTWDepList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
# make all paths absolute
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
	my @DepList=&Path_AbsToWork(@RTWDepList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
	undef @RTWDepList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
# test the dependencies
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
	eval { @DepList=&TestDepends($Src,@DepList); };
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
	die $@ if $@;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
	my @SortedDepList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
# get just those headers found in the user include path if user headers only specified
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
	if (not $Mode{'UserHdrsOnly'}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
		@SortedDepList=sort @DepList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
	else {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
		my @UserDepList=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
		my $Dep;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
		my $UserPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
		DEPLOOP: foreach $Dep (@DepList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
			foreach $UserPath (@UserPaths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
				if ($UserPath eq &Path_Split('Path',$Dep)) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
					push @UserDepList, $Dep;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
					next DEPLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
		@SortedDepList=sort @UserDepList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
# take the source path out of the user path list
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
	shift @UserPaths;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
	@SortedDepList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
sub TestDepends (@) { # takes source list of absolute dependencies - called by GenDepends
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
# check that the dependencies exist or are to be generated later, because gcc with the -MG switch
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
# will assume that missing system headers live in the first system include path specified (the decoy
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
# directory in our case), and the missing user headers live in the current working directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
	my ($Src,@DepList)=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
	my @BadSysList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
	my @BadUserList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
	my $Dep;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
	my @GoodList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
	my $SrcPath=&Path_Split('Path', $Src);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
	my $Path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
	my $File;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
	DEPLOOP: foreach $Dep (@DepList) { # system dependencies not found
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
		$Path=&Path_Split('Path', lc $Dep);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
		if ($Dep=~/^$S_SysDecoyPath(.*)$/o) { # allow things like "#include <sys\stats.h>"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
# any files listed as existing in the system decoy directory will be missing system include files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
			$File=$1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
# change any missing generated header entries so that they are thought to be in $EPOCIncPath, where they will be generated to
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
			if ($File=~/\.(RSG|MBG)$/oi) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
				push @GoodList, "$EPOCIncPath$File";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
				next DEPLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
# remove missing system include files from the list if they actually exist in standard directories - since the makefiles can't handle
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
# files which may be on a different drive - we don't mind this because if we're using MSVC then we can assume
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
# the MSVC include files will exist
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
			my $LR;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
			foreach $LR (@StdPaths) {	# tackle MSDEV include dir on diff drive
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
				if (-e "$LR$File") {	# don't put MSDEV includes in dep list - drive letter would end up in makefile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
					next DEPLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
# put any other missing system files on the bad list after checking that they really don't exist on the system paths
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
# at this point in time.  This check is applied in an attempt to avoid sporadic warnings in the build where system
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
# headers have been listed in the system decoy directory, and hence flagged as missing, when they do seem to have
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
# been present at this time post-build...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
			foreach $Path (@SysPaths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
				if (-e "$Path$File") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
					next DEPLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
			push @BadSysList, $File;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
			next DEPLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
# preprocessor lists any missing user headers as existing in the current directory,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
# and, if no userinclude paths are specified,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
# searches to path containing the source file for user headers by default
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
		if ($Path eq lc &Path_WorkPath) { # possible missing user headers
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
			$File=&Path_Split('File',$Dep);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
			# does the userinclude path contain the current working directory?
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
			my $LoopPath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
			my $WorkPathInUserPaths=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
			foreach $LoopPath (@UserPaths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
				if ( (lc $LoopPath) eq (lc &Path_WorkPath) ) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
					$WorkPathInUserPaths=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
					next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
			if ($WorkPathInUserPaths) { # the user include path contains the current working directory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
				if (-e $Dep) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
					push @GoodList,$Dep;	# file found in specified userinclude path, OK
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
					next DEPLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
			push @BadUserList, $File;	# file not found in specified userinclude path, bad
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
			next DEPLOOP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
		push @GoodList, $Dep;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
	my $Bad;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
	if (@BadSysList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
		warn	"\nWARNING: Can't find following headers in System Include Path\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
		foreach $Bad (@BadSysList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
			print STDERR " <$Bad>";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
		print STDERR "\n(Sys Inc Paths";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
		foreach $Path (@SysPaths,@StdPaths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
			print STDERR " \"$Path\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
		warn
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
			")\nDependency list for \"$Src\" may be incomplete\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
			"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
		;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
	if (@BadUserList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
		warn "\nWARNING: Can't find following headers in User or System Include Paths\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
		my $GenHdr=0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
		foreach $Bad (@BadUserList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
			print STDERR " \"$Bad\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
			if ($File=~/\.(RSG|MBG)$/o) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
				$GenHdr=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
		print STDERR "\n(User Inc Paths";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
		foreach $Path (@UserPaths) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
			print STDERR " \"$Path\"";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
		warn
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
			")\nDependency list for \"$Src\" may be incomplete\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
			"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
		;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
		if ($GenHdr) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
			warn
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
				"Note that generated headers should be system-included with angle brackets <>\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
				"\n"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
			;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
	@GoodList;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
END {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
	# remove the dependency decoy directories
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
	if (-d "$ChopSysDecoyPath") {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
		rmdir "$ChopSysDecoyPath" or warn "Please remove temp dir \"$ChopSysDecoyPath\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
1;