sbsv1/abld/e32util/preprocessor.pm
author jjkang
Wed, 30 Jun 2010 11:35:58 +0800
changeset 607 378360dbbdba
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Merge missed changeset 11 (raptor v2.14 and helium 10.0)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2004-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
# prepocessor.pm
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# Used to allow us to access and manipulate other pre processors
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 Preprocessor;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
	PreprocessorToUseId PreprocessorToUseExe PreprocessorToUsePath 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
# Returns the preprocessor name.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
# (After checking it is valid)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
sub PreprocessorToUseId()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
    $env="0";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
    if (defined $ENV{ALT_PRE})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
	$env = $ENV{ALT_PRE};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
    if ( $env eq "1" ) # Only a value of 1 will use alternative preprocessor
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
        return "MINGW_NO_CYGWIN";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
    else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
        return "DEFAULT";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
# Returns the preprocessor exe name.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
# without the exe extension.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
sub PreprocessorToUseExe()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
    $env = &PreprocessorToUseId();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
    if ( ($env eq "DEFAULT") )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
        return "cpp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
    elsif ( $env eq "MINGW_NO_CYGWIN" )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
        return "scpp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
# Returns the full path and exe of the preprocessor relative to the 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
# gcc\bin path.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
sub PreprocessorToUsePath()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
    $env = &PreprocessorToUseId();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
    if ( ($env eq "") || ($env eq "DEFAULT") )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
        return "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
    elsif ( $env eq "MINGW_NO_CYGWIN" )
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
        return ""; # Currently same path as default (different name though !)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
    else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
    { # Nothing really to use.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
        die
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
            "Unable to find the correct pre processor\n",
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
1;