Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
235 dpurdie 1
#
2
# Module name   : BORLAND
3
# Module type   : Makefile system
4
# Compiler(s)   : ANSI C
5
# Environment(s): WIN32
6
#
7
# Description:
8
#       Borland C/C++ Builder for WIN32
9
#............................................................................#
10
 
11
use strict;
12
use warnings;
13
 
14
################################################################################
15
#   Globals
16
#
17
my $toolset_version;
18
 
19
##############################################################################
20
#   ToolsetInit()
21
#       Runtime initialisation
22
#
23
##############################################################################
24
 
25
ToolsetInit();
26
 
27
sub ToolsetInit
28
{
29
 
30
#.. Parse arguments (Toolset arguments)
31
#
32
    Debug( "Borland(@::ScmToolsetArgs)" );
33
 
34
    foreach $_ ( @::ScmToolsetArgs ) {
35
        if (/^--Version=(.*)/) {                # MS SDK Version
36
            $toolset_version = $1;
37
 
38
        } else {
39
            Message( "Borland toolset: unknown option $_ -- ignored\n" );
40
        }
41
    }
42
 
43
#.. Parse arguments (platform arguments)
44
#
45
    Debug( "Borland(@::ScmPlatformArgs)" );
46
 
47
    foreach $_ ( @::ScmPlatformArgs ) {
48
        if (/^--product=(.*)/) {                # GBE product
49
 
50
        } elsif (/^--Version=(.*)/) {           # MS SDK Version
51
            $toolset_version = $1;
52
 
53
        } else {
54
            Message( "Borland toolset: unknown platform argument $_ -- ignored\n" );
55
        }
56
    }
57
 
58
#.. Validate SDK version
59
#   Currently only one is supported
60
#       1) Borland C++ Builder 6 installed
61
#
62
    Error( "Unknown version: $toolset_version" ) if ( defined $toolset_version );
63
 
64
 
65
#.. Standard.rul requirements
66
#
67
    $::s = 'asm';
68
    $::o = 'obj';
69
    $::a = 'lib';
70
    $::so = 'dll';
71
    $::exe = '.exe';
72
 
73
#.. Toolset configuration
74
#
75
    $::ScmToolsetVersion = "1.0.0";             # our version
76
    $::ScmToolsetGenerate = 0;                  # generate optional
77
    $::ScmToolsetIFLAG3 = 1;                    # supports IFLAG3
78
 
79
#.. define Borland C/C++ environment
80
    Init( "borlandc" );
81
    ToolsetDefines( "borland.def" );
82
    ToolsetRequire( "exctags" );                # and Exuberant Ctags
83
    ToolsetRules( "borland.rul" );
84
    ToolsetRules( "standard.rul" );
85
 
86
#.. define PCLint envrionment
87
#    ToolsetRequire( "pclint" );                 # using pclint
88
#    PlatformDefine ("LINT_COFILE\t= co-msc60.lnt");
89
#    PlatformDefine ("LINT_PRJ_FILE\t=lint.borland");
90
 
91
#.. Cleanup rules
92
#   None at the moment as we only build projects
93
#
94
    return 1;
95
}
96
 
97
########################################################################
98
#
99
#   Generate a project from the provided project file
100
#
101
#   Arguments   : $name             - Base name of the project
102
#                 $solution         - Path to the project file
103
#                 $pArgs            - Project specific options
104
#
105
#   Process a Borland Project file by:
106
#       1) Convert .bpr to a Borland .mak file
107
#       2) Invoke Borland make on the .mak file
108
#          Must change to the directory of the target project
109
#          Need to create "ilink32.cfg" in the project directory
110
#          to set the '/Lib/Release'
111
#
112
########################################################################
113
 
114
my $project_defines_done = 0;
115
sub ToolsetPROJECT
116
{
117
    my( $name, $solution ,$pArgs ) = @_;
118
    my @cleanfiles;
119
    my $cname = $name;
120
    $cname =~ s~\..+$~~;
121
    my $logfile = "$cname\$(GBE_TYPE).log";
122
    my $makefile = "$cname.jats.mak";
123
    my $basedir = StripFileExt( $solution ) || '.';
124
 
125
    #
126
    #   Some existing projects are in directories that have a 'space'
127
    #   Fix this by creating a path that uses a '?' wildcard instead of
128
    #   a space.
129
    #
130
    my $solution_path = $solution;
131
    $solution_path =~ s~ ~\?~g;
132
 
133
    #
134
    #   Process options
135
    #
136
    foreach ( @$pArgs ) {
137
        if ( m~^--CleanDir=(.+)~ ) {
138
            my $path = ($basedir) ? "$basedir/$1" : $1;
139
            push @cleanfiles, "$path/*";
140
 
141
        } elsif ( m~^--CleanFiles=(.+)~ ) {
142
            my $path = ($basedir) ? "$basedir/$1" : $1;
143
            push @cleanfiles, $path;
144
 
145
        } else {
146
            Message( "bcb PROJECT: unknown option $_ -- ignored\n" );
147
        }
148
    }
149
 
150
    my ($io) = ToolsetPrinter::New();
151
 
152
    #
153
    #   One time only definitions
154
    #
155
    unless( $project_defines_done )
156
    {
157
        $project_defines_done = 1;
158
        $io->PrtLn( "ifeq \"\$(DEBUG)\" \"1\"");
159
        $io->PrtLn( "\techo Borland Builder Projects do not build for debug");
160
        $io->PrtLn( "\techo The project setting are used and should for release");
161
        $io->PrtLn( "\techo exit 1");
162
        $io->PrtLn( "endif");
163
        $io->Newline();
164
    }
165
 
166
    #
167
    #   Generate the recipe to create the project
168
    #   Use the set_WIN32.sh file to extend the DLL search path
169
    #
170
    $io->Label( "Build project", $name );
171
    $io->PrtLn( "Project_$name: $solution_path \$(INTERFACEDIR)/set_$::ScmPlatform.sh" );
172
    $io->PrtLn( "\t\$(call MakeProject,$name,$basedir,$makefile,$logfile)" );
173
    $io->Newline();
174
 
175
    #
176
    #   Generate the recipe to clean the project
177
    #       Delete the contents of the listed files and directories
178
    #       Delete the log file
179
    #       Delete the generated makefile
180
    #       Delete the generated ilink32.cfg file
181
    #
182
    $io->Label( "Clean project", $name );
183
    $io->PrtLn( "ProjectClean_$name: $solution_path" );
184
    push @cleanfiles, $logfile, $makefile, "$basedir/ilink32.cfg";
185
    $io->Prt( "\t-\$(XX_PRE)\$(GBE_PERL) -Mjats_runtime -e rm_f -- ");
186
    $io->Prt( " \\\n\t\t\"$_\"" ) foreach ( @cleanfiles );
187
    $io->Newline();
188
}
189
 
190
 
191
#.. Successful termination
192
1;
193