| 315 |
dpurdie |
1 |
#
|
|
|
2 |
# Module name : VISUALBASIC
|
|
|
3 |
# Module type : Makefile system
|
|
|
4 |
# Environment(s): WIN32
|
|
|
5 |
#
|
|
|
6 |
# Description:
|
|
|
7 |
# Visual BAsic 6 for WIN32
|
|
|
8 |
#............................................................................#
|
|
|
9 |
|
|
|
10 |
use strict;
|
|
|
11 |
use warnings;
|
|
|
12 |
|
|
|
13 |
################################################################################
|
|
|
14 |
# Globals
|
|
|
15 |
#
|
|
|
16 |
my $toolset_version;
|
|
|
17 |
my $toolset_name = "VisualBasic";
|
|
|
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( "${toolset_name}(@::ScmToolsetArgs)" );
|
|
|
33 |
|
|
|
34 |
foreach $_ ( @::ScmToolsetArgs ) {
|
|
|
35 |
if (/^--Version=(.*)/) { # MS SDK Version
|
|
|
36 |
$toolset_version = $1;
|
|
|
37 |
|
|
|
38 |
} else {
|
|
|
39 |
Message( "${toolset_name} toolset: unknown option $_ -- ignored\n" );
|
|
|
40 |
}
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
#.. Parse arguments (platform arguments)
|
|
|
44 |
#
|
|
|
45 |
Debug( "${toolset_name}(@::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( "${toolset_name} toolset: unknown platform argument $_ -- ignored\n" );
|
|
|
55 |
}
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
#.. Validate SDK version
|
|
|
59 |
# Currently only one is supported
|
|
|
60 |
# 1) Visual Basic 6
|
|
|
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 |
|
|
|
78 |
#.. define Borland C/C++ environment
|
|
|
79 |
Init( "visualbasic" );
|
|
|
80 |
ToolsetDefines( "visualbasic.def" );
|
|
|
81 |
ToolsetRules( "visualbasic.rul" );
|
|
|
82 |
# ToolsetRules( "standard.rul" );
|
|
|
83 |
|
|
|
84 |
#.. define PCLint envrionment
|
|
|
85 |
# ToolsetRequire( "pclint" ); # using pclint
|
|
|
86 |
# PlatformDefine ("LINT_COFILE\t= co-msc60.lnt");
|
|
|
87 |
# PlatformDefine ("LINT_PRJ_FILE\t=lint.borland");
|
|
|
88 |
|
|
|
89 |
#.. Cleanup rules
|
|
|
90 |
# None at the moment as we only build projects
|
|
|
91 |
#
|
|
|
92 |
return 1;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
########################################################################
|
|
|
96 |
#
|
|
|
97 |
# Generate a project from the provided project file
|
|
|
98 |
#
|
|
|
99 |
# Arguments : $name - Base name of the project
|
|
|
100 |
# $solution - Path to the project file
|
|
|
101 |
# $pArgs - Project specific options
|
|
|
102 |
#
|
|
|
103 |
# Process a Visual Basic Project file by:
|
|
|
104 |
# 1) Invoke VB6.exe on a .vbg or .vbp
|
|
|
105 |
#
|
|
|
106 |
########################################################################
|
|
|
107 |
|
|
|
108 |
my $project_defines_done = 0;
|
|
|
109 |
sub ToolsetPROJECT
|
|
|
110 |
{
|
|
|
111 |
my( $name, $solution ,$pArgs ) = @_;
|
|
|
112 |
my @cleanfiles;
|
|
|
113 |
my $cname = $name;
|
|
|
114 |
$cname =~ s~\..+$~~;
|
|
|
115 |
my $basedir = StripFileExt( $solution ) || '.';
|
|
|
116 |
my $builddir = '$(BINDIR)';
|
|
|
117 |
my $logfile = "$cname\$(GBE_TYPE).log";
|
|
|
118 |
my $solution_path = $solution;
|
|
|
119 |
|
|
|
120 |
#
|
|
|
121 |
# Process options
|
|
|
122 |
#
|
|
|
123 |
foreach ( @$pArgs ) {
|
|
|
124 |
if ( m~^--CleanDir=(.+)~ ) {
|
|
|
125 |
my $path = ($basedir) ? "$basedir/$1" : $1;
|
|
|
126 |
push @cleanfiles, "$path/*";
|
|
|
127 |
|
|
|
128 |
} elsif ( m~^--CleanFiles=(.+)~ ) {
|
|
|
129 |
my $path = ($basedir) ? "$basedir/$1" : $1;
|
|
|
130 |
push @cleanfiles, $path;
|
|
|
131 |
|
|
|
132 |
} else {
|
|
|
133 |
Message( "${toolset_name} PROJECT: unknown option $_ -- ignored\n" );
|
|
|
134 |
}
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
my ($io) = ToolsetPrinter::New();
|
|
|
138 |
|
|
|
139 |
#
|
|
|
140 |
# One time only definitions
|
|
|
141 |
#
|
|
|
142 |
unless( $project_defines_done )
|
|
|
143 |
{
|
|
|
144 |
$project_defines_done = 1;
|
|
|
145 |
$io->PrtLn( "ifeq \"\$(GBE_MAKE_TYPE)\" \"D\"");
|
|
|
146 |
$io->PrtLn( "\$(info [VB6] (E) Visual Basic Projects do not build for debug)");
|
|
|
147 |
$io->PrtLn( "\$(info [VB6] (E) The project setting are used and should be set to release)");
|
|
|
148 |
$io->PrtLn( "\$(error Cannot build for Debug)");
|
|
|
149 |
$io->PrtLn( "endif");
|
|
|
150 |
$io->Newline();
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
#
|
|
|
154 |
# Generate the recipe to create the project
|
|
|
155 |
# Use the set_WIN32.sh file to extend the DLL search path
|
|
|
156 |
#
|
|
|
157 |
$io->Label( "Build project", $name );
|
|
|
158 |
$io->PrtLn( "Project_$name: $solution_path \$(INTERFACEDIR)/set_$::ScmPlatform.sh" );
|
|
|
159 |
$io->PrtLn( "\t\$(call MakeProject,$name,$basedir,$builddir,$logfile)" );
|
|
|
160 |
$io->Newline();
|
|
|
161 |
|
|
|
162 |
#
|
|
|
163 |
# Generate the recipe to clean the project
|
|
|
164 |
# Delete the contents of the listed files and directories
|
|
|
165 |
# Delete the log file
|
|
|
166 |
# Delete the build output directory
|
|
|
167 |
#
|
|
|
168 |
$io->Label( "Clean project", $name );
|
|
|
169 |
$io->PrtLn( "ProjectClean_$name: $solution_path" );
|
|
|
170 |
push @cleanfiles, $logfile, "$builddir/*";
|
|
|
171 |
$io->Prt( "\t-\$(XX_PRE)\$(GBE_PERL) -Mjats_runtime -e rm_f -- ");
|
|
|
172 |
$io->Prt( " \\\n\t\t\"$_\"" ) foreach ( @cleanfiles );
|
|
|
173 |
$io->Newline();
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
#.. Successful termination
|
|
|
178 |
1;
|
|
|
179 |
|