| 227 |
dpurdie |
1 |
# -*- mode: perl; indent-width: 4; show-tabs: yes; -*-
|
|
|
2 |
#
|
|
|
3 |
# Module name : PD386
|
|
|
4 |
# Module type : Makefile system
|
|
|
5 |
# Compiler(s) : ANSI C
|
|
|
6 |
# Environment(s): AMX/EOS
|
|
|
7 |
#
|
|
|
8 |
# ! WARNING - do not detab !
|
|
|
9 |
#
|
|
|
10 |
# Description:
|
|
|
11 |
# Paradigm C/C++ toolset
|
|
|
12 |
#
|
|
|
13 |
# Version Who Date Description
|
|
|
14 |
# 1.0 APY 20/02/02 Created (from WatcomC)
|
|
|
15 |
# APY 26/02/02 Build system +v2 support.
|
|
|
16 |
# - prefixed 'exp' with '.' and
|
|
|
17 |
# remove '.' from $(exe) references.
|
|
|
18 |
# - reconstructed isp creation
|
|
|
19 |
# - replaced ToolsetProg() with ToolsetGenerate().
|
|
|
20 |
# - ToolsetCC and ToolsetCXX switch processing
|
|
|
21 |
# 30/04/02 --Isp must allow mutliple specifications.
|
|
|
22 |
# 17/07/02 - c0t32
|
|
|
23 |
# 16/04/04 - GBE_TARGET, replaced with GBE_PLATFORM
|
|
|
24 |
#
|
|
|
25 |
# $Source: /cvsroot/etm/devl/CFG/TOOLSET/PD386,v $
|
|
|
26 |
# $Revision: 1.2 $ $Date: 2004/04/23 05:47:03 $ $State: Exp $
|
|
|
27 |
# $Author: ayoung $ $Locker: $
|
|
|
28 |
#............................................................................#
|
|
|
29 |
|
|
|
30 |
##############################################################################
|
|
|
31 |
# ToolsetInit()
|
|
|
32 |
# Runtime initialisation
|
|
|
33 |
#
|
|
|
34 |
##############################################################################
|
|
|
35 |
|
|
|
36 |
ToolsetInit();
|
|
|
37 |
|
|
|
38 |
sub ToolsetInit
|
|
|
39 |
{
|
|
|
40 |
#.. standard.rul requirements
|
| 261 |
dpurdie |
41 |
$s = 'asm';
|
|
|
42 |
$o = 'obj';
|
|
|
43 |
$a = 'lib';
|
| 227 |
dpurdie |
44 |
$rom = ".rom"; # inter-immediate link stage image
|
|
|
45 |
$bin = ".bin"; # binary (BOOTBIOS) image
|
|
|
46 |
$axe = ".axe"; # debug image
|
|
|
47 |
|
|
|
48 |
#.. define environment
|
|
|
49 |
Init( "paradigm" );
|
|
|
50 |
ToolsetDefines( "pd386.def" );
|
|
|
51 |
ToolsetRules( "pd386.rul" );
|
|
|
52 |
ToolsetRules( "standard.rul" );
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
###############################################################################
|
|
|
56 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
57 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
58 |
# required to compile the source file 'source' to 'obj'
|
|
|
59 |
#
|
|
|
60 |
###############################################################################
|
|
|
61 |
|
|
|
62 |
sub ToolsetCC
|
|
|
63 |
{
|
|
|
64 |
my( $source, $obj, $pArgs ) = @_;
|
|
|
65 |
|
|
|
66 |
Debug( "CC: $source -> $obj" );
|
|
|
67 |
foreach ( @$pArgs ) {
|
|
|
68 |
Debug( "option: $_" );
|
|
|
69 |
if ( /--Shared$/ ) { # Building a 'shared' object
|
|
|
70 |
$cflags = "$cflags \$(SHCFLAGS)";
|
|
|
71 |
Debug( "CC: as shared object" );
|
|
|
72 |
|
|
|
73 |
} else { # unknown option
|
|
|
74 |
Message( "CC: unknown option $_ -- ignored\n" );
|
|
|
75 |
}
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
MakePrint( "\n\t\$(CC)\n" );
|
|
|
79 |
MakePrint( "\$(OBJDIR)/$i.${o}:\tCFLAGS +=$cflags\n" )
|
|
|
80 |
if ( $cflags );
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
###############################################################################
|
|
|
84 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
85 |
# This subroutine takes the user options and builds the
|
|
|
86 |
# rule(s) required to build the dependencies for the source
|
|
|
87 |
# files 'sources' to 'depend'.
|
|
|
88 |
#
|
|
|
89 |
###############################################################################
|
|
|
90 |
|
|
|
91 |
sub ToolsetCCDepend
|
|
|
92 |
{
|
|
|
93 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
###############################################################################
|
|
|
98 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
99 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
100 |
# required to compile the source file 'source' to 'obj'
|
|
|
101 |
#
|
|
|
102 |
###############################################################################
|
|
|
103 |
|
|
|
104 |
sub ToolsetCXX
|
|
|
105 |
{
|
|
|
106 |
my( $source, $obj, $pArgs ) = @_;
|
|
|
107 |
my( $cflags ) = "";
|
|
|
108 |
|
|
|
109 |
Debug( "CCX: $source -> $obj" );
|
|
|
110 |
foreach ( @$pArgs ) {
|
|
|
111 |
Debug( "option: $_" );
|
|
|
112 |
if ( /--Shared$/ ) { # Building a 'shared' object
|
|
|
113 |
$cflags = "$cflags \$(SHCXXFLAGS)";
|
|
|
114 |
Debug( "CCX: as shared object" );
|
|
|
115 |
|
|
|
116 |
} else {
|
|
|
117 |
Message( "CCX: unknown option $_ -- ignored\n" );
|
|
|
118 |
}
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
MakePrint( "\n\t\$(CXX)\n" );
|
|
|
122 |
MakePrint( "\$(OBJDIR)/$i.${o}:\tCXXFLAGS +=$cflags\n" )
|
|
|
123 |
if ( $cflags );
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
###############################################################################
|
|
|
128 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
129 |
# This subroutine takes the user options and builds the
|
|
|
130 |
# rule(s) required to build the dependencies for the source
|
|
|
131 |
# files 'sources' to 'depend'.
|
|
|
132 |
#
|
|
|
133 |
###############################################################################
|
|
|
134 |
|
|
|
135 |
sub ToolsetCXXDepend
|
|
|
136 |
{
|
| 287 |
dpurdie |
137 |
ToolsetCCDepend();
|
| 227 |
dpurdie |
138 |
}
|
|
|
139 |
|
|
|
140 |
###############################################################################
|
|
|
141 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
142 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
143 |
# required to compile the source file 'source' to 'obj'
|
|
|
144 |
#
|
|
|
145 |
# Output:
|
|
|
146 |
# [ $(OBJDIR)/name$.${o}: source-file ]
|
|
|
147 |
# $(AS)
|
|
|
148 |
#
|
|
|
149 |
###############################################################################
|
|
|
150 |
|
|
|
151 |
sub ToolsetAS
|
|
|
152 |
{
|
|
|
153 |
my( $source, $obj, $pArgs ) = @_;
|
|
|
154 |
|
|
|
155 |
Debug( "AS: $source -> $obj" );
|
|
|
156 |
foreach ( @$pArgs ) {
|
|
|
157 |
Debug( "option: $_" );
|
|
|
158 |
Message( "AS: unknown option $_ -- ignored\n" );
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
#.. Cleanup rules
|
|
|
162 |
# name.lst Generated 'list/xref' file.
|
|
|
163 |
#
|
|
|
164 |
ToolsetGenerate( "\$(OBJDIR)/${obj}.lst" );
|
|
|
165 |
|
|
|
166 |
#.. Build rule (just append to standard rule)
|
|
|
167 |
#
|
|
|
168 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
sub ToolsetASDepend
|
|
|
172 |
{
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
###############################################################################
|
|
|
177 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
178 |
# This subroutine takes the user options and builds the rules
|
|
|
179 |
# required to build the library 'name'.
|
|
|
180 |
#
|
|
|
181 |
# Arguments:
|
|
|
182 |
# --Amx[=prefix] local AMX configuration (defaults to platform)
|
|
|
183 |
# --Isp=name ISP module
|
|
|
184 |
#
|
|
|
185 |
# Output:
|
|
|
186 |
# [ $(BINDIR)/name$.${a}: .... ]
|
|
|
187 |
# $(AR)
|
|
|
188 |
#
|
|
|
189 |
# name_ld += ... Linker command file
|
|
|
190 |
# :
|
|
|
191 |
#
|
|
|
192 |
# name_dp += ... Dependency list
|
|
|
193 |
# :
|
|
|
194 |
#
|
|
|
195 |
###############################################################################
|
|
|
196 |
|
|
|
197 |
sub ToolsetAR
|
|
|
198 |
{
|
|
|
199 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
200 |
my( $amx, @isp, $insight );
|
|
|
201 |
|
|
|
202 |
local( $name_ld );
|
|
|
203 |
|
|
|
204 |
#.. Parse arguments
|
|
|
205 |
#
|
|
|
206 |
$amx = $insight = 0; # options
|
|
|
207 |
foreach $_ ( @$pArgs ) {
|
|
|
208 |
if (/^--Amx$/) { # Local AMX config
|
|
|
209 |
$amx = "\$(SCM_PLATFORM)";
|
|
|
210 |
} elsif (/^--Amx=(.*)/) { # Specific AMX config
|
|
|
211 |
$amx = "$1";
|
|
|
212 |
|
|
|
213 |
} elsif (/^--Isp=(.*)/) { # ISP module
|
|
|
214 |
push( @isp, "$1" );
|
|
|
215 |
|
|
|
216 |
} elsif (/^--Insight$/) { # Enable insight
|
|
|
217 |
$insight = 1;
|
|
|
218 |
} elsif (/^--Insight=(.*)/) { # Specific insight
|
|
|
219 |
$insight = "$1";
|
|
|
220 |
|
|
|
221 |
} else {
|
|
|
222 |
Message( "AR: unknown option $_ -- ignored\n" );
|
|
|
223 |
}
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
#.. Cleanup rules
|
|
|
227 |
#
|
|
|
228 |
# library.lst Generated 'list' file.
|
|
|
229 |
#
|
|
|
230 |
ToolsetGenerate( "\$(LIBDIR)/${name}\$(SCM_TYPE).lst" );
|
|
|
231 |
|
|
|
232 |
#.. Standard library builds, plus AMX configuration
|
|
|
233 |
#
|
|
|
234 |
MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t",
|
|
|
235 |
"", "\\\n\t\t", ".${o} ", @$pObjs );
|
|
|
236 |
|
|
|
237 |
foreach (@isp) {
|
|
|
238 |
AmxLibISP( $name, $_ );
|
|
|
239 |
}
|
|
|
240 |
AmxLib( $name, $amx, $insight )
|
|
|
241 |
if ( $amx );
|
|
|
242 |
|
|
|
243 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
###############################################################################
|
|
|
248 |
# ToolsetLD( $name, \@args, \@objs, \@libraries )
|
|
|
249 |
# This subroutine takes the user options and builds the rules
|
|
|
250 |
# required to link the program 'name'.
|
|
|
251 |
#
|
|
|
252 |
# Arguments:
|
|
|
253 |
# --Eos EOS application
|
|
|
254 |
# --Eosx Extended EOS application
|
|
|
255 |
# --NetUdp Networking with UDP support
|
|
|
256 |
# --NetTcp Networking with TCP support
|
|
|
257 |
# --Amx[=prefix] Local AMX configuration (defaults to platform)
|
|
|
258 |
# --Isp=name ISP module
|
|
|
259 |
# --Insight[=prefix] Enable insight (default to platform.icf)
|
|
|
260 |
# --Stack=#[k] Stack size
|
|
|
261 |
#
|
|
|
262 |
# Linker specific:
|
|
|
263 |
# --Exe
|
|
|
264 |
# --Bin Download image
|
|
|
265 |
# --Axe Absolute image (PDREMOTE)
|
|
|
266 |
# --Axe=monitor Axe with using explicit monitor
|
|
|
267 |
# --Section=... Linker sector order directives
|
|
|
268 |
#
|
|
|
269 |
# Output:
|
|
|
270 |
# $(BINDIR)/name.exe: << Generated by makelib
|
|
|
271 |
# $(BINDIR)/name.dep \
|
|
|
272 |
# $(BINDIR)/name.[axe|bin]
|
|
|
273 |
#
|
|
|
274 |
# $(BINDIR)/name.dep: $(SCM_PLATFORM).mk
|
|
|
275 |
# $(LDDEPEND)
|
|
|
276 |
#
|
| 261 |
dpurdie |
277 |
# ifeq "$(IFLAG)" "3"
|
| 227 |
dpurdie |
278 |
# -include "$(BINDIR)/name.dep"
|
|
|
279 |
# endif
|
|
|
280 |
#
|
|
|
281 |
# $(BINDIR)/name.[axe|bin]
|
|
|
282 |
# objs ...
|
|
|
283 |
# {$(LDAXE)|$(LDBIN)}
|
|
|
284 |
#
|
|
|
285 |
# name_ld += ...
|
|
|
286 |
# :
|
|
|
287 |
#
|
|
|
288 |
###############################################################################
|
|
|
289 |
|
|
|
290 |
sub ToolsetLD
|
|
|
291 |
{
|
|
|
292 |
my( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
293 |
my( $linker, $flags, $amx, $insight, $type, $idx );
|
|
|
294 |
my( $cond );
|
|
|
295 |
local( $varname );
|
|
|
296 |
|
|
|
297 |
#.. Parse arguments
|
|
|
298 |
#
|
|
|
299 |
$stack = 0;
|
|
|
300 |
$amx = $flags = $insight = 0; # Options
|
|
|
301 |
|
|
|
302 |
$type = ${axe};
|
|
|
303 |
$section = "\$(GBE_PLATFORM).loc";
|
|
|
304 |
$monitor = "\$(paradigm)/pdremote.rom/pdrem32";
|
|
|
305 |
$bootcode = "\$(paradigm)/bin/biosboot.exe";
|
|
|
306 |
|
|
|
307 |
foreach $_ ( @$pArgs )
|
|
|
308 |
{
|
|
|
309 |
#.. EOS
|
|
|
310 |
#
|
|
|
311 |
if (/--Eos$/) { # EOS standard
|
|
|
312 |
$flags = $flags | $EOS_LNK;
|
|
|
313 |
} elsif (/^--Eosx$/) { # EOS extended
|
|
|
314 |
$flags = $flags | $EOS_LNK | $EOS_EXT;
|
|
|
315 |
|
|
|
316 |
#.. Networking
|
|
|
317 |
#
|
|
|
318 |
} elsif (/^--NetUdp$/) {
|
|
|
319 |
$flags = $flags | $NET_UDP;
|
|
|
320 |
} elsif (/^--NetTcp$/) {
|
|
|
321 |
$flags = $flags | $NET_TCP;
|
|
|
322 |
|
|
|
323 |
#.. AMX
|
|
|
324 |
#
|
|
|
325 |
} elsif (/^--Amx$/) { # Local AMX config
|
|
|
326 |
$amx = "\$(SCM_PLATFORM)";
|
|
|
327 |
} elsif (/^--Amx=(.*)/) { # Specific AMX config
|
|
|
328 |
$amx = "$1";
|
|
|
329 |
|
|
|
330 |
} elsif (/^--Isp=(.*)/) { # ISP module
|
|
|
331 |
AmxLinkISP( $name, "$1", $pObjs, $pLibs );
|
|
|
332 |
|
|
|
333 |
} elsif (/^--Insight$/) { # Enable insight
|
|
|
334 |
$insight = "\$(SCM_PLATFORM)";
|
|
|
335 |
} elsif (/^--Insight=(.*)/) { # Specific insight
|
|
|
336 |
$insight = "$1";
|
|
|
337 |
|
|
|
338 |
#.. Target specific
|
|
|
339 |
#
|
|
|
340 |
} elsif (/^--Rom=/) { # ROM image
|
|
|
341 |
Message( "LD: linker option '$_' not supported -- ignored\n" );
|
|
|
342 |
|
|
|
343 |
} elsif (/^--Bin/) { # Download image
|
|
|
344 |
$type = ${bin};
|
|
|
345 |
|
|
|
346 |
} elsif (/^--Axe/ || /^--Abs/) { # PD. PDMONITOR image
|
|
|
347 |
$type = ${axe};
|
|
|
348 |
|
|
|
349 |
} elsif (/^--Axe=(.*)/) { # PD, explicited PDMONITOR image
|
|
|
350 |
$type = ${axe};
|
|
|
351 |
$monitor = "$1";
|
|
|
352 |
|
|
|
353 |
} elsif (/^--Biosboot=(.*)/) { # PD, explicited BIOSBOOT image
|
|
|
354 |
$type = ${bin};
|
|
|
355 |
$bootcode = "$1";
|
|
|
356 |
|
|
|
357 |
} elsif (/^--Section=(.*)/) { # LOCATE32 section config
|
|
|
358 |
$section = "$1";
|
|
|
359 |
|
|
|
360 |
} elsif (/^--Kdb/) { # Kernel debugger
|
|
|
361 |
$flags = $flags | $EOS_KDB;
|
|
|
362 |
|
|
|
363 |
#.. Toolset specific
|
|
|
364 |
#
|
|
|
365 |
} elsif (/^--Stack=(.*)/) { # stack size
|
|
|
366 |
$stack = "$1";
|
|
|
367 |
|
|
|
368 |
} else {
|
|
|
369 |
Message( "LD: unknown option $_ -- ignored\n" );
|
|
|
370 |
}
|
|
|
371 |
}
|
|
|
372 |
|
|
|
373 |
#.. Command file, EOS and/or AMX dependencies
|
|
|
374 |
#
|
|
|
375 |
# Library search order,
|
|
|
376 |
# Application
|
|
|
377 |
# EOS
|
|
|
378 |
# AMX
|
|
|
379 |
# Toolset (TNT/WATCOM)
|
|
|
380 |
#
|
|
|
381 |
if ( $flags ) {
|
|
|
382 |
EosLink( $name, $flags, $pObjs, $pLibs );
|
|
|
383 |
if ( $amx ) {
|
|
|
384 |
AmxLinkCfg( $name, $amx, $insight, $pObjs, $pLibs );
|
|
|
385 |
} else {
|
|
|
386 |
AmxLinkStd( $name, $pObjs, $pLibs );
|
|
|
387 |
}
|
|
|
388 |
} elsif ( $amx ) {
|
|
|
389 |
AmxLinkCfg( $name, $amx, $insight, $pObjs, $pLibs );
|
|
|
390 |
}
|
|
|
391 |
|
|
|
392 |
push( @$pLibs, "\$(paradigm)/lib/noeh32" ); # toolset libraries
|
|
|
393 |
push( @$pLibs, "\$(paradigm)/lib/embed32" );
|
|
|
394 |
push( @$pLibs, "\$(paradigm)/lib/cw32" );
|
|
|
395 |
|
|
|
396 |
#.. Cleanup rules (generic)
|
|
|
397 |
#
|
|
|
398 |
ToolsetGenerate( "\$(BINDIR)/${name}.ld" );
|
|
|
399 |
ToolsetGenerate( "\$(BINDIR)/${name}.dep" );
|
|
|
400 |
ToolsetGenerate( "\$(BINDIR)/${name}.map" );
|
|
|
401 |
|
|
|
402 |
#.. Linker command file
|
|
|
403 |
#
|
|
|
404 |
# PLINK32 objfiles, exefile, mapfile, libfiles, deffile, resfiles
|
|
|
405 |
# @xxxx indicates use response file xxxx
|
|
|
406 |
# -m Map file with publics -x No map
|
|
|
407 |
# -s Detailed segment map -L Specify library search paths
|
|
|
408 |
# -M Map with mangled names -j Specify object search paths
|
|
|
409 |
# -c Case sensitive link -v Full symbolic debug information
|
|
|
410 |
# -Enn Max number of errors -n No default libraries
|
|
|
411 |
# -P- Disable code packing -H:xxxx Specify app heap reserve size
|
|
|
412 |
# -B:xxxx Specify image base addr -Hc:xxxx Specify app heap commit size
|
|
|
413 |
# -wxxx Warning control -S:xxxx Specify app stack reserve size
|
|
|
414 |
# -Txx Specify output file type -Sc:xxxx Specify app stack commit size
|
|
|
415 |
# -Tpx PE image -Af:nnnn Specify file alignment
|
|
|
416 |
# (x: e=EXE, d=DLL) -Ao:nnnn Specify object alignment
|
|
|
417 |
# -ax Specify application type -o Import by ordinals
|
|
|
418 |
# -ap Windowing Compatible -Vd.d Specify Windows version
|
|
|
419 |
# -aa Uses Windowing API -r Verbose link
|
|
|
420 |
#
|
|
|
421 |
# Now the fun part... piecing together a variable $(name_ld)
|
|
|
422 |
# which ends up in the command file.
|
|
|
423 |
#
|
|
|
424 |
# Outputs:
|
|
|
425 |
# name.rom/
|
|
|
426 |
# name.exe these files represent the link stage of the development,
|
|
|
427 |
# where all of the objects are linked together.
|
|
|
428 |
#
|
|
|
429 |
# name.map Linker map
|
|
|
430 |
#
|
|
|
431 |
# name.axe Absolute image
|
|
|
432 |
#
|
|
|
433 |
# name.rtb RtTarget binary file
|
|
|
434 |
#
|
|
|
435 |
# name.loc Locator map
|
|
|
436 |
#
|
|
|
437 |
$varname = "${name}_ld";
|
|
|
438 |
sub LdCmd { # with line feed ...
|
| 261 |
dpurdie |
439 |
MakeQuote ("$varname +=@_\\n\n");
|
| 227 |
dpurdie |
440 |
}
|
|
|
441 |
sub LdTxt { # without line feed ...
|
| 261 |
dpurdie |
442 |
MakeQuote ("$varname +=@_\n");
|
| 227 |
dpurdie |
443 |
}
|
|
|
444 |
sub LdPrt {
|
| 261 |
dpurdie |
445 |
MakeQuote ("@_");
|
| 227 |
dpurdie |
446 |
}
|
|
|
447 |
|
|
|
448 |
if ( $type eq ${axe} || $type eq ${bin} )
|
|
|
449 |
{
|
|
|
450 |
# Additional generated images
|
|
|
451 |
ToolsetGenerate( "\$(BINDIR)/${name}${type}" );
|
|
|
452 |
ToolsetGenerate( "\$(BINDIR)/${name}.exe" );
|
|
|
453 |
ToolsetGenerate( "\$(BINDIR)/${name}.loc" );
|
|
|
454 |
ToolsetGenerate( "\$(BINDIR)/${name}.rtb" );
|
|
|
455 |
|
|
|
456 |
# Rules
|
|
|
457 |
MakePrint( " \\\n\t\t\$(BINDIR)/${name}.dep" );
|
|
|
458 |
MakePrint( " \\\n\t\t\$(BINDIR)/${name}${type}" );
|
|
|
459 |
MakePrint( " \n\n" );
|
|
|
460 |
|
|
|
461 |
MakePrint( "\$(BINDIR)/${name}.dep:\t\$(SCM_PLATFORM).mk\n".
|
|
|
462 |
"\t\$(LDDEPEND)\n\n" );
|
|
|
463 |
|
| 261 |
dpurdie |
464 |
MakePrint( "ifeq \"\$(IFLAG)\" \"3\"\n" .
|
| 227 |
dpurdie |
465 |
"-include\t\$(BINDIR)/${name}.dep\n" .
|
|
|
466 |
"endif\n\n" );
|
|
|
467 |
|
|
|
468 |
# Linker
|
|
|
469 |
MakePrint( "\$(BINDIR)/${name}${rom}:\t\$(BINDIR)/${name}.dep" );
|
|
|
470 |
foreach $i ( @$pObjs ) {
|
|
|
471 |
MakePrint( " \\\n\t\t$i.${o}" );
|
|
|
472 |
}
|
|
|
473 |
MakePrint( "\n\t\$(LD)\n\n" );
|
|
|
474 |
|
|
|
475 |
# Locate32
|
|
|
476 |
# If building a bin,
|
|
|
477 |
# name.axe, deleted, image can not be loaded.
|
|
|
478 |
# name.rtb, renamed to 'name.bin'.
|
|
|
479 |
#
|
|
|
480 |
MakePrint( "\$(BINDIR)/${name}${type}:\tLOCATEOPT=-D__PDREMOTE__=".
|
|
|
481 |
"\$(subst /,\\\\,$monitor)\n" )
|
|
|
482 |
if ( $type eq ${axe});
|
|
|
483 |
MakePrint( "\$(BINDIR)/${name}${type}:\tLOCATEOPT=-D__PDBOOTCODE__=".
|
|
|
484 |
"\$(subst /,\\\\,$bootcode)\n" )
|
|
|
485 |
if ( $type eq ${bin});
|
|
|
486 |
MakePrint( "\$(BINDIR)/${name}${type}:\tLOCATECFG=$section\n" );
|
|
|
487 |
MakePrint( "\$(BINDIR)/${name}${type}:\t\$(BINDIR)/${name}${rom}\n" );
|
|
|
488 |
MakePrint( "\t\$(LD2)\n" );
|
|
|
489 |
if ( $type eq ${bin} )
|
|
|
490 |
{
|
|
|
491 |
MakePrint( "\t@\$(rm) -f \$(BINDIR)/${name}${axe}\n");
|
|
|
492 |
MakePrint( "\t@\$(rm) -f \$(BINDIR)/${name}${bin}\n");
|
|
|
493 |
MakePrint( "\t@\$(mv) \$(BINDIR)/${name}.rtb \$(BINDIR)/${name}${bin}\n");
|
|
|
494 |
}
|
|
|
495 |
MakePrint( "\n" );
|
|
|
496 |
|
|
|
497 |
# Piece together a variable $(name_ld) which ends up
|
|
|
498 |
# in the PLINK32 command file. Note the order of arguments
|
|
|
499 |
# is criticial and must be seperated by a comma(,) with
|
|
|
500 |
# plus(+) used for line continuation.
|
|
|
501 |
#
|
|
|
502 |
$varname = "${name}_ld";
|
|
|
503 |
|
|
|
504 |
# Objects,
|
|
|
505 |
# .. startup code
|
|
|
506 |
# C0T32: C run time library entry point for "tiny" NT apps.
|
|
|
507 |
# C0X32: C run time library entry point for NT apps.
|
|
|
508 |
#
|
|
|
509 |
if (($flags & $EOS_LNK) || $amx) {
|
|
|
510 |
LdTxt( "\$(subst /,\\\\,\$(paradigm)/lib/c0t32).${o}" );
|
|
|
511 |
} else {
|
|
|
512 |
LdTxt( "\$(subst /,\\\\,\$(paradigm)/lib/c0x32).${o}" );
|
|
|
513 |
}
|
|
|
514 |
|
|
|
515 |
# .. users objects
|
|
|
516 |
foreach $i ( @$pObjs ) {
|
|
|
517 |
LdTxt( "+\\n\$(subst /,\\\\,\$(strip $i)).${o}" )
|
|
|
518 |
}
|
|
|
519 |
LdCmd( "" );
|
|
|
520 |
|
|
|
521 |
# Output files
|
|
|
522 |
LdCmd( "\$(subst /,\\\\,\$(BINDIR)/${name}${rom})" );
|
|
|
523 |
LdCmd( "\$(subst /,\\\\,\$(BINDIR)/${name}.map)" );
|
|
|
524 |
|
|
|
525 |
# Libraries
|
|
|
526 |
foreach $_ ( @$pLibs ) {
|
|
|
527 |
if (/^--ifdef=(.*)/) { # .. conditionals
|
|
|
528 |
$cond = "$1";
|
|
|
529 |
LdPrt( "ifdef $cond\n" );
|
|
|
530 |
next;
|
|
|
531 |
} elsif (/^--ifndef=(.*)/) {
|
|
|
532 |
$cond = "$1";
|
|
|
533 |
LdPrt( "ifndef $cond\n" );
|
|
|
534 |
next;
|
|
|
535 |
} elsif (/^--*/) { # .. unknown
|
|
|
536 |
Message( "LD: unknown lib option $_ -- ignored\n" );
|
|
|
537 |
next;
|
|
|
538 |
}
|
|
|
539 |
|
|
|
540 |
# ... entry
|
|
|
541 |
# Note the line continuation !
|
|
|
542 |
LdCmd("\@(dosify,@(vpath2,$_.${a},PD386_LIB)) +");
|
|
|
543 |
|
|
|
544 |
if ($cond) { # .. end condition
|
|
|
545 |
LdPrt("endif\t# $cond\n");
|
|
|
546 |
$cond = "";
|
|
|
547 |
}
|
|
|
548 |
}
|
|
|
549 |
MakePrint( "\n" ); # .. terminate library list
|
|
|
550 |
|
|
|
551 |
# Now Piece together a variable $(name_dp) which ends up in the
|
|
|
552 |
# command file building the application dependency list. Note
|
|
|
553 |
# the dependency are on the 'rom' image not the 'exe'.
|
|
|
554 |
#
|
|
|
555 |
$varname = "${name}_dp";
|
|
|
556 |
|
|
|
557 |
$cond = "";
|
|
|
558 |
foreach $_ ( @$pLibs ) {
|
|
|
559 |
if (/^--ifdef=(.*)/) { # .. conditionals
|
|
|
560 |
$cond = "$1";
|
|
|
561 |
LdPrt( "ifdef $cond\n" );
|
|
|
562 |
next;
|
|
|
563 |
} elsif (/^--ifndef=(.*)/) {
|
|
|
564 |
$cond = "$1";
|
|
|
565 |
LdPrt( "ifndef $cond\n" );
|
|
|
566 |
next;
|
|
|
567 |
} elsif (/^--*/) { # .. unknown
|
|
|
568 |
Message( "LD: unknown lib option $_ -- ignored\n" );
|
|
|
569 |
next;
|
|
|
570 |
}
|
|
|
571 |
|
|
|
572 |
# ... entry
|
|
|
573 |
LdCmd("\$(BINDIR)/${name}${rom}:\t@(vpath2,$_.${a},PD386_LIB)" );
|
|
|
574 |
|
|
|
575 |
if ($cond) { # .. end condition
|
|
|
576 |
LdPrt("endif\t# $cond\n");
|
|
|
577 |
$cond = "";
|
|
|
578 |
}
|
|
|
579 |
}
|
|
|
580 |
}
|
|
|
581 |
else # "rom"
|
|
|
582 |
{
|
|
|
583 |
}
|
|
|
584 |
}
|
|
|
585 |
|
|
|
586 |
#.. Successful termination
|
|
|
587 |
1;
|
|
|
588 |
|