| 227 |
dpurdie |
1 |
# -*- mode: perl; tabs: 8; indent-width: 4; show-tabs: yes; -*-
|
|
|
2 |
#
|
|
|
3 |
# Module name : djgpp
|
|
|
4 |
# Module type : Makefile system
|
|
|
5 |
# Compiler(s) : ANSI C
|
|
|
6 |
# Environment(s): DJGPP/EOS2
|
|
|
7 |
#
|
|
|
8 |
# Description:
|
|
|
9 |
# DJGPP C/C++ toolset using GO32 and MASM
|
|
|
10 |
#
|
|
|
11 |
# Version Who Date Description
|
|
|
12 |
# 1.0 APY 01/02/00 Created
|
|
|
13 |
#
|
|
|
14 |
# $Name: $
|
|
|
15 |
# $Source: /cvsroot/etm/devl/CFG/TOOLSET/DJGPP,v $
|
|
|
16 |
# $Revision: 1.2 $ $Date: 2004/05/06 09:06:44 $ $State: Exp $
|
|
|
17 |
# $Author: ayoung $ $Locker: $
|
|
|
18 |
#............................................................................#
|
|
|
19 |
|
|
|
20 |
##############################################################################
|
|
|
21 |
# ToolsetInit()
|
|
|
22 |
# Runtime initialisation
|
|
|
23 |
#
|
|
|
24 |
##############################################################################
|
|
|
25 |
|
|
|
26 |
ToolsetInit();
|
|
|
27 |
|
|
|
28 |
sub ToolsetInit
|
|
|
29 |
{
|
|
|
30 |
#.. standard.rul requirements
|
| 261 |
dpurdie |
31 |
$s = 'asm';
|
|
|
32 |
$o = 'o';
|
|
|
33 |
$a = 'a';
|
| 227 |
dpurdie |
34 |
$exe = ".exe";
|
|
|
35 |
|
|
|
36 |
#.. define DJGPP environment
|
|
|
37 |
Init( "djgpp" );
|
|
|
38 |
ToolsetDefines( "djgpp.def" );
|
|
|
39 |
ToolsetRules( "djgpp.rul" );
|
|
|
40 |
ToolsetRules( "standard.rul" );
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
###############################################################################
|
|
|
45 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
46 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
47 |
# required to compile the source file 'source' to 'obj'
|
|
|
48 |
#
|
|
|
49 |
###############################################################################
|
|
|
50 |
|
|
|
51 |
sub ToolsetCC
|
|
|
52 |
{
|
|
|
53 |
MakePrint( "\n\t\$(CC)\n" );
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
###############################################################################
|
|
|
57 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
58 |
# This subroutine takes the user options and builds the
|
|
|
59 |
# rule(s) required to build the dependencies for the source
|
|
|
60 |
# files 'sources' to 'depend'.
|
|
|
61 |
#
|
|
|
62 |
###############################################################################
|
|
|
63 |
|
|
|
64 |
sub ToolsetCCDepend
|
|
|
65 |
{
|
|
|
66 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
###############################################################################
|
|
|
71 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
72 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
73 |
# required to compile the source file 'source' to 'obj'
|
|
|
74 |
#
|
|
|
75 |
###############################################################################
|
|
|
76 |
|
|
|
77 |
sub ToolsetCXX
|
|
|
78 |
{
|
|
|
79 |
MakePrint( "\n\t\$(CXX)\n" );
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
###############################################################################
|
|
|
83 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
84 |
# This subroutine takes the user options and builds the
|
|
|
85 |
# rule(s) required to build the dependencies for the source
|
|
|
86 |
# files 'sources' to 'depend'.
|
|
|
87 |
#
|
|
|
88 |
###############################################################################
|
|
|
89 |
|
|
|
90 |
sub ToolsetCXXDepend
|
|
|
91 |
{
|
| 287 |
dpurdie |
92 |
ToolsetCCDepend();
|
| 227 |
dpurdie |
93 |
}
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
###############################################################################
|
|
|
97 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
98 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
99 |
# required to compile the source file 'source' to 'obj'
|
|
|
100 |
#
|
|
|
101 |
###############################################################################
|
|
|
102 |
|
|
|
103 |
sub ToolsetAS
|
|
|
104 |
{
|
|
|
105 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
sub ToolsetASDepend
|
|
|
109 |
{
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
###############################################################################
|
|
|
114 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
115 |
# This subroutine takes the user options and builds the rules
|
|
|
116 |
# required to build the library 'name'.
|
|
|
117 |
#
|
|
|
118 |
# Arguments:
|
|
|
119 |
# --Eos2[=prefix] Local EOS configuration (defaults to platform)
|
|
|
120 |
# --Isp=name ISP module
|
|
|
121 |
#
|
|
|
122 |
# Output:
|
|
|
123 |
# [ $(BINDIR)/name$.${a}: .... ]
|
|
|
124 |
# $(AR)
|
|
|
125 |
#
|
|
|
126 |
# name_ld += ... Linker command file
|
|
|
127 |
# :
|
|
|
128 |
#
|
|
|
129 |
# name_dp += ... Dependency list
|
|
|
130 |
# :
|
|
|
131 |
#
|
|
|
132 |
###############################################################################
|
|
|
133 |
|
|
|
134 |
sub ToolsetAR
|
|
|
135 |
{
|
|
|
136 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
137 |
my( $amx );
|
|
|
138 |
|
|
|
139 |
local( $name_ld );
|
|
|
140 |
|
|
|
141 |
#.. Parse arguments
|
|
|
142 |
#
|
|
|
143 |
$eos = 0; # options
|
|
|
144 |
foreach $_ ( @$pArgs ) {
|
|
|
145 |
if (/^--Amx$/) { # Local AMX config
|
|
|
146 |
Error( "AR: --Amx support not available\n" );
|
|
|
147 |
} elsif (/^--Amx=(.*)/) { # Specific AMX config
|
|
|
148 |
Error( "AR: --Amx support not available\n" );
|
|
|
149 |
} elsif (/^--Insight$/) { # Enable insight
|
|
|
150 |
Error( "AR: --Insight support not available\n" );
|
|
|
151 |
} elsif (/^--Insight=(.*)/) { # Specific insight
|
|
|
152 |
Error( "AR: --Insight support not available\n" );
|
|
|
153 |
|
|
|
154 |
} elsif (/^--Eos2$/) { # Local EOS config
|
|
|
155 |
$eos = "\$(SCM_PLATFORM)";
|
|
|
156 |
} elsif (/^--Eos2=(.*)/) { # Specific EOS config
|
|
|
157 |
$eos = "$1";
|
|
|
158 |
|
|
|
159 |
} elsif (/^--Isp=(.*)/) { # ISP module
|
|
|
160 |
Eos2LibISP( $name, "$1" );
|
|
|
161 |
|
|
|
162 |
} else {
|
|
|
163 |
Message( "AR: unknown option $_ -- ignored\n" );
|
|
|
164 |
}
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
#.. Target
|
|
|
168 |
#
|
|
|
169 |
MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", "\\\n\t\t", "", @$pObjs );
|
|
|
170 |
|
|
|
171 |
#.. Build library with EOS2 configuration
|
|
|
172 |
#
|
|
|
173 |
if ( $eos ) {
|
|
|
174 |
Eos2Lib( $name, $eos );
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
#.. Build library rule (just append to standard rule)
|
|
|
178 |
#
|
|
|
179 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
###############################################################################
|
|
|
184 |
# ToolsetLD( $name, \@args, \@objs, \@libraries )
|
|
|
185 |
# This subroutine takes the user options and builds the rules
|
|
|
186 |
# required to link the program 'name'.
|
|
|
187 |
#
|
|
|
188 |
# Arguments:
|
|
|
189 |
# --Eos EOS application
|
|
|
190 |
# --Eosx Extended EOS application
|
|
|
191 |
# --Eos[=prefix] EOS application, plus configuration
|
|
|
192 |
# --Eosx[=prefix] Extended EOS application, plus configuration
|
|
|
193 |
# --NetUdp Networking with UDP support
|
|
|
194 |
# --NetTcp Networking with TCP support
|
|
|
195 |
# --Isp=name ISP module
|
|
|
196 |
# --Coff COFF format (default)
|
|
|
197 |
# --Insight[=prefix] n/a
|
|
|
198 |
# --Amx[=prefix] n/a
|
|
|
199 |
# --Insight[=prefix] n/a
|
|
|
200 |
# --Rel n/a
|
|
|
201 |
# --Abs n/a
|
|
|
202 |
#
|
|
|
203 |
# Output:
|
|
|
204 |
# $(BINDIR)/name.exe:
|
|
|
205 |
# $(BINDIR)/name.dep
|
|
|
206 |
# $(LD)
|
|
|
207 |
#
|
|
|
208 |
# $(BINDIR)/name.dep: $(SCM_PLATFORM).mk
|
|
|
209 |
# $(LDDEPEND)
|
|
|
210 |
#
|
| 261 |
dpurdie |
211 |
# ifeq "$(IFLAG)" "3"
|
| 227 |
dpurdie |
212 |
# -include "$(BINDIR)/name.dep"
|
|
|
213 |
# endif
|
|
|
214 |
#
|
|
|
215 |
# name_ld += ...
|
|
|
216 |
# :
|
|
|
217 |
#
|
|
|
218 |
###############################################################################
|
|
|
219 |
|
|
|
220 |
sub ToolsetLD
|
|
|
221 |
{
|
|
|
222 |
my( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
223 |
my( $flags, $eos );
|
|
|
224 |
local( $varname );
|
|
|
225 |
|
|
|
226 |
#.. Parse arguments
|
|
|
227 |
#
|
|
|
228 |
$eos = $flags = 0; # options
|
|
|
229 |
foreach $_ ( @$pArgs )
|
|
|
230 |
{
|
|
|
231 |
#.. EOS
|
|
|
232 |
#
|
|
|
233 |
if (/--Eos$/) { # EOS standard
|
|
|
234 |
$flags = $flags | $EOS_LNK;
|
|
|
235 |
} elsif (/^--Eos=(.*)$/) { # plus config
|
|
|
236 |
$flags = $flags | $EOS_LNK;
|
|
|
237 |
$eos = "\$(SCM_PLATFORM)";
|
|
|
238 |
} elsif (/^--Eosx$/) { # EOS extended
|
|
|
239 |
$flags = $flags | $EOS_LNK | $EOS_EXT;
|
|
|
240 |
} elsif (/^--Eosx=(.*)$/) { # plus config
|
|
|
241 |
$flags = $flags | $EOS_LNK | $EOS_EXT;
|
|
|
242 |
$eos = "\$(SCM_PLATFORM)";
|
|
|
243 |
|
|
|
244 |
} elsif (/^--Isp=(.*)/) { # ISP module
|
|
|
245 |
AmxLinkISP( $name, "$1", $pObjs, $pLibs );
|
|
|
246 |
|
|
|
247 |
} elsif (/^--Kdb/) { # Kernel debugger
|
|
|
248 |
$flags = $flags | $EOS_KDB;
|
|
|
249 |
|
|
|
250 |
#.. Networking
|
|
|
251 |
#
|
|
|
252 |
} elsif (/^--NetUdp$/) {
|
|
|
253 |
$flags = $flags | $NET_UDP;
|
|
|
254 |
} elsif (/^--NetTcp$/) {
|
|
|
255 |
$flags = $flags | $NET_TCP;
|
|
|
256 |
|
|
|
257 |
#.. Compat stuff
|
|
|
258 |
#
|
|
|
259 |
} elsif (/^--Amx/) { # Local AMX config
|
|
|
260 |
Error( "LD: --Amx support not available\n" );
|
|
|
261 |
} elsif (/^--Insight/) { # Enable insight
|
|
|
262 |
Error( "LD: --Insight support not available\n" );
|
|
|
263 |
|
|
|
264 |
#.. Target specific
|
|
|
265 |
#
|
|
|
266 |
} elsif (/^--Rom=(.*)/) { # ROM image
|
|
|
267 |
Message( "LD: not suitable under WC386 '$_' -- ignored\n" );
|
|
|
268 |
} elsif (/^--Bin=(.*)/) { # Download image
|
|
|
269 |
Message( "LD: not suitable under WC386 '$_' -- ignored\n" );
|
|
|
270 |
} elsif (/^--Abs/) { # Absolute image
|
|
|
271 |
Message( "LD: not suitable under WC386 '$_' -- ignored\n" );
|
|
|
272 |
|
|
|
273 |
#.. Toolset specific
|
|
|
274 |
#
|
|
|
275 |
|
|
|
276 |
#.. Default, ignore
|
|
|
277 |
#
|
|
|
278 |
} else {
|
|
|
279 |
Message( "LD: unknown option $_ -- ignored\n" );
|
|
|
280 |
}
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
#.. Command file EOS dependencies
|
|
|
284 |
#
|
|
|
285 |
# Library search order,
|
|
|
286 |
# Application
|
|
|
287 |
# EOS
|
|
|
288 |
# EOS/RTX
|
|
|
289 |
# Toolset
|
|
|
290 |
#
|
|
|
291 |
if ( $flags ) {
|
|
|
292 |
EosLink( $name, $flags, $pObjs, $pLibs );
|
|
|
293 |
if ( $eos ) {
|
|
|
294 |
Eos2LinkCfg( $name, $eos, $pObjs, $pLibs );
|
|
|
295 |
} else {
|
|
|
296 |
Eos2LinkStd( $name, $pObjs, $pLibs );
|
|
|
297 |
}
|
|
|
298 |
} elsif ( $eos ) {
|
|
|
299 |
Eos2LinkCfg( $name, $eos, $pObjs, $pLibs );
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
#.. Cleanup rules
|
|
|
303 |
#
|
| 261 |
dpurdie |
304 |
ToolsetGenerate( "\$(BINDIR)/${name}.ld" );
|
|
|
305 |
ToolsetGenerate( "\$(BINDIR)/${name}.dep" );
|
|
|
306 |
ToolsetGenerate( "\$(BINDIR)/${name}.map" );
|
| 227 |
dpurdie |
307 |
|
|
|
308 |
#.. Linker command file
|
|
|
309 |
#
|
|
|
310 |
# Now the fun part... piecing together a variable $(name_ld)
|
|
|
311 |
# which ends up in the command file.
|
|
|
312 |
#
|
|
|
313 |
MakePrint( "\\\n\t\t\$(BINDIR)/${name}.dep\n" .
|
|
|
314 |
"\t\$(LD)\n\n" );
|
|
|
315 |
|
|
|
316 |
MakePrint( "\$(BINDIR)/${name}.dep:\t\$(SCM_PLATFORM).mk\n".
|
|
|
317 |
"\t\$(LDDEPEND)\n\n" );
|
|
|
318 |
|
| 261 |
dpurdie |
319 |
MakePrint( "ifeq \"\$(IFLAG)\" \"3\"\n" .
|
| 227 |
dpurdie |
320 |
"-include\t\$(BINDIR)/${name}.dep\n" .
|
|
|
321 |
"endif\n\n" );
|
|
|
322 |
|
|
|
323 |
$varname = "${name}_ld";
|
|
|
324 |
sub VarCmd { # with line feed ...
|
| 261 |
dpurdie |
325 |
MakeQuote ("$varname += @_\\n\n");
|
| 227 |
dpurdie |
326 |
}
|
|
|
327 |
sub VarCmd2 { # without line feed ...
|
| 261 |
dpurdie |
328 |
MakeQuote ("$varname += @_\n");
|
| 227 |
dpurdie |
329 |
}
|
|
|
330 |
sub VarPrt {
|
| 261 |
dpurdie |
331 |
MakePrint ("@_\n");
|
| 227 |
dpurdie |
332 |
}
|
|
|
333 |
|
|
|
334 |
foreach $i ( @$pObjs ) {
|
|
|
335 |
VarCmd( "\$(strip $i).${o}" );
|
|
|
336 |
}
|
|
|
337 |
foreach $i ( @$pLibs ) {
|
|
|
338 |
VarCmd( "@(vpath,$i.${a},DJGPP_LIB)" );
|
|
|
339 |
}
|
|
|
340 |
|
|
|
341 |
if ($flags || $eos) {
|
|
|
342 |
} else {
|
|
|
343 |
}
|
|
|
344 |
|
|
|
345 |
VarCmd( "-o \$(BINDIR)/${name}${exe}" );
|
|
|
346 |
VarPrt( "" );
|
|
|
347 |
|
|
|
348 |
#.. Dependency link,
|
|
|
349 |
#
|
|
|
350 |
# Now piece together a variable $(name_dp) which ends up in
|
|
|
351 |
# the command file building the application dependency list.
|
|
|
352 |
#
|
|
|
353 |
$varname = "${name}_dp";
|
|
|
354 |
|
|
|
355 |
foreach $i ( @$pLibs ) {
|
|
|
356 |
VarCmd("\$(BINDIR)/${name}${exe}: @(vpath,$i.${a},DJGPP_LIB)" );
|
|
|
357 |
}
|
|
|
358 |
}
|
|
|
359 |
|
|
|
360 |
#.. Successful termination
|
|
|
361 |
1;
|
|
|
362 |
|