Subversion Repositories DevTools

Rev

Rev 5709 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
#..
6177 dpurdie 2
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
227 dpurdie 3
#
4
# Module name   : m16c
5
# Module type   : Makefile system
6
# Compiler(s)   : None
7
# Environment(s): All
8
#
9
# Description:
10
#       This file provides Toolset initialisation and plugin functions
11
#       to makelib.pl2
12
#
13
# Contents:
14
#
15
#............................................................................#
16
 
17
use strict;
18
 
19
our $s;
20
our $o;
21
our $so;
22
our $exe;
23
 
24
our @ScmToolsetArgs;
25
our @ScmPlatformArgs;
26
our $ScmToolsetVersion;
27
our $ScmToolsetGenerate;
28
our $ScmToolsetProgDependancies;
29
our %ScmCompilerOpts;
30
our %SRCS;
31
our $ScmBuildVersion;
32
our @PROGS;
33
 
34
##############################################################################
35
#   ToolsetInit()
36
#       Runtime initialisation
37
#
38
##############################################################################
39
 
40
ToolsetInit();
41
 
42
sub ToolsetInit
43
{
44
    my( @args ) = @ScmToolsetArgs;             # Toolset arguments
45
    my( $version, $product );
46
 
47
#.. Parse arguments
48
#
49
    Debug( "m16c(@args)\n" );
50
 
51
    foreach $_ ( @args ) {
52
        Message( "m16c: unknown toolset argument $_ -- ignored\n" );
53
    }
54
 
55
#.. Parse Platform Arguments
56
#
261 dpurdie 57
    @args = @ScmPlatformArgs;                   # Platform arguments
227 dpurdie 58
    foreach $_ ( @args ) {
59
        if (/^--product=(.*)/) {                # GBE product
60
            $product = $1;
61
        } else {
62
            Message( "m16c: unknown platform argument $_ -- ignored\n" );
63
        }
64
    }
65
 
66
#.. Standard.rul requirements
67
#
68
    $s =   'asm';           # Assembler source file
69
    $o =   'R30';           # Object files
70
    $a =   'lib';           # Library file
71
    $so =  undef;           # Shared library (not supported)
72
    $exe = '.bin';          # Program File (also .thx)
73
 
74
#.. Toolset configuration
75
#
76
    $ScmToolsetVersion = "1.0.0";               # our version
77
    $ScmToolsetGenerate = 0;                    # generate optional
78
    $ScmToolsetProgDependancies = 0;            # handle Prog dependancies myself
79
 
80
#.. Define the environment
81
#
82
    #
83
    #   Define initialisation targets
84
    #   These will be used to ensure that correct versions of the toolset are present
85
    #
86
    Init( "m16c" );
87
 
88
    ToolsetDefine ( "#################################################" );
89
    ToolsetDefine ( "# Mitsubishi m16c compiler" );
90
    ToolsetDefine ( "#" );
91
 
92
    ToolsetDefines( "m16c.def" );
93
    ToolsetRules  ( "m16c.rul" );
94
    ToolsetRules  ( "standard.rul" );
95
 
96
    #
97
    #   Other toolsets used
98
    #
99
#    PlatformDefine ("LINT_COFILE\t= m16c.lnt");
100
#    PlatformDefine ("LINT_PRJ_FILE\t=lint.m16c");
101
#    ToolsetRequire( "pclint" );                 # using pclint
102
 
103
 
104
#.. Extend the CompilerOption directive
105
#   Create a standard data structure
106
#   This is a hash of hashes
107
#       The first hash is keyed by CompileOption keyword
108
#       The second hash contains pairs of values to set or remove
109
#
110
    %::ScmToolsetCompilerOptions =
111
    (
112
    );
113
 
114
#
115
#   Allow .THX files to be process as 'cc' source files
116
#   Indicate that JATS is to generate objects for these files
117
#
118
AddSourceType ('.thx', '.cc' );
119
 
120
 
121
#
122
#   Install defaults
123
#    $ScmCompilerOpts{'xxxxx'} = "yyyyy";
124
#
125
 
126
}
127
 
128
##############################################################################
129
#   ToolsetPreprocess()
130
#       Process collected data before the makefile is generated
131
#       This, optional, routine is called from within MakefileGenerate()
132
#       It allows the toolset to massage any of the collected data before
133
#       the makefile is created
134
#
135
##############################################################################
136
 
137
sub ToolsetPreprocess
138
{
139
    #
140
    #   If the user has specified a Prog or Shared library, then the
141
    #   tools within this file will need to be able to access
142
    #   a few external resouces. These will be provided by packages
143
    #   that should exist
144
    #
145
    #
146
    if ( $#::TESTPROGS >= 0 || $#::PROGS >= 0 || $#::SHLIBS >= 0)
147
    {
148
        my %need = ( "fontconv.exe"     => "TOOL_FONTCONV",
149
                     "modcrc.exe"       => "TOOL_MODCRC",
150
                     "appcrc.exe"       => "TOOL_APPCRC",
151
                     "mcrpld.pl"        => "TOOL_MCRPLD",
4488 dpurdie 152
                     "mcrflashend.pl"   => "TOOL_MCRFLASHEND",
227 dpurdie 153
                   );
154
        my %found = ();
155
 
156
        #
157
        #   Locate the required files
158
        #
159
        for my $program ( keys( %need ))
160
        {
161
            if ( my $path = ToolExtensionProgram( $program ) )
162
            {
163
                $found{ $need{$program} } = $path;
164
                delete( $need{$program} );
165
            }
166
        }
167
 
168
        ::Warning( "Tool program(s) required by toolset not found:",
169
                  sort( keys %need),
170
                  "Check that the mos_tools and mcr_tools packages are present" )
171
            if ( scalar keys %need );
172
 
173
        #
174
        #   Generate the definitions
175
        #
176
 
177
        ToolsetDefine ( "#################################################" );
178
        ToolsetDefine ( "#  The path to tools required to build MOS Programs" );
179
        ToolsetDefine ( "#" );
180
        for my $defn ( keys %found )
181
        {
182
            ToolsetDefine ( "$defn := $found{$defn}" );
183
        }
184
        ToolsetDefine ( "" );
185
    }
186
}
187
 
188
 
189
###############################################################################
190
#   ToolsetCC( $source, $obj, \@args )
191
#       This subroutine takes the user options and builds the rule(s)
192
#       required to compile the source file 'source' to 'obj'
193
#
194
###############################################################################
195
 
196
sub ToolsetCC
197
{
198
    MakePrint( "\n\t\$(CC)\n\n" );
199
}
200
 
201
 
202
 
203
###############################################################################
204
#   ToolsetCCDepend( $depend, \@sources )
205
#       This subroutine takes the user options and builds the
206
#       rule(s) required to build the dependencies for the source
207
#       files 'sources' to 'depend'.
208
#
209
###############################################################################
210
 
211
sub ToolsetCCDepend
212
{
213
    MakePrint( "\t\$(CCDEPEND)\n\n" );
214
}
215
 
216
###############################################################################
217
#   ToolsetCXX( $source, $obj, \@args )
218
#       This subroutine takes the user options and builds the rule(s)
219
#       required to compile the source file 'source' to 'obj'
220
#
221
#
222
#   In this toolset the source files WILL be .thx files that are to be
223
#   converted to "C" files and then to object files
224
#
225
#   On entry JATS has created the basic part of the recipe. The object file
226
#   is dependant on the source file and the makefile
227
#
228
#   This function must generate the body of the recipe
229
#
230
###############################################################################
231
 
232
sub ToolsetCXX
233
{
234
    my ($source, $obj, @args) = @_;
235
    my $name = $source;
236
    my $odir = "\$(OBJDIR)";
237
    my $tname = "$odir/${obj}";
238
 
239
    #
240
    #   Ensure that we have a .THX file
241
    #
242
    Error("Unknown file type: $source")
243
        unless ( $source =~ /\.thx$/i );
244
 
245
    #
246
    #   THX files are processed by:
247
    #       .thx    -> modcrc      ->   .bin
248
    #       .bin    -> fontcrc     ->   .c
249
    #       .c      -> compiler    ->   .r30
250
    #
251
    MakePrint( "\n\t\$(call THX2R30,$source,$tname)\n\n" );
252
 
253
    #
254
    #   Override the C source filename when building this target
255
    #   This is required as the C source is in the OBJ directory
256
    #
257
    MakePrint( "\$(OBJDIR)/$obj.$::o:", "\tcc_source_file=${tname}.c\n\n" );
258
 
259
 
260
    #
261
    #   Cleanup files that may be generated
262
    #
263
    ToolsetGenerate( "$tname.c" );
264
    ToolsetGenerate( "$tname.bin" );
265
    ToolsetGenerate( "$tname.thx" );
266
    ToolsetGenerate( "$tname.nul" );
267
}
268
 
269
###############################################################################
270
#   ToolsetCXXDepend( $depend, \@sources )
271
#       This subroutine takes the user options and builds the
272
#       rule(s) required to build the dependencies for the source
273
#       files 'sources' to 'depend'.
274
#
275
###############################################################################
276
 
277
sub ToolsetCXXDepend
278
{
287 dpurdie 279
    ToolsetCCDepend();
227 dpurdie 280
}
281
 
282
###############################################################################
283
#   ToolsetAS( $source, $obj, \@args )
284
#       This subroutine takes the user options and builds the rule(s)
285
#       required to compile the source file 'source' to 'obj'
286
#
287
###############################################################################
288
 
289
sub ToolsetAS
290
{
291
    my( $source, $obj, @args) = @_;
292
    MakePrint( "\n\t\$(AS)\n" );
293
    ToolsetGenerate( "\$(OBJDIR)/$obj.lst" );
294
}
295
 
296
sub ToolsetASDepend
297
{
298
}
299
 
300
###############################################################################
301
#   ToolsetAR( $name, \@args, \@objs )
302
#       This subroutine takes the user options and builds the rules
303
#       required to build the library 'name'.
304
 
305
#
306
#   Arguments:
307
#       --xxx                   No arguments currently defined
308
#
309
#   Output:
310
#       [ $(BINDIR)/name$.${a}:   .... ]
311
#           $(AR)
312
#
313
###############################################################################
314
 
315
sub ToolsetAR
316
{
317
    my( $name, $pArgs, $pObjs ) = @_;
318
 
319
    Debug("ToolsetAR");
320
 
321
#.. Parse arguments
322
#
323
    foreach $_ ( @$pArgs ) {
324
        if (/^--/) {
325
            Message( "AR: unknown option $_ -- ignored\n" );
326
        }
327
    }
328
 
329
#.. Target
330
#
331
    MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", " \\\n\t\t", ".${o}", @$pObjs );
332
 
333
#.. Build library rule (just append to standard rule)
334
#
335
    MakePrint( "\n\t\$(AR)\n\n" );
336
 
337
#.. Generated files
338
#
339
    ToolsetGenerate( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}.ar" );
340
}
341
 
342
 
343
###############################################################################
344
#   ToolsetLD( $name, \@args, \@objs, \@libraries )
345
#       This subroutine takes the user options and builds the rules
346
#       required to link the program 'name'.
347
#
348
#   The process of creating a THX files consists of:
349
#       1) Link .R30 object files to create a .X30 file
350
#       2) Process the .X30 file to create a .raw file
351
#       3) Use 'modcrc' to create a .thx file
352
#       4) Use 'modcrc' to create a .mod file (a MOS .bin file)
353
#
354
#   Note: This toolset will handle the generation of the dependancies
355
#         by itself. This allows complete control over the generation
356
#         of the dependancies. Required as the process of creating
357
#         a THX is complex.
358
#
359
#   Arguments:
360
#       --Set=Name=Value            Linker -LOC data
361
#       --Rel=Name                  Rel file base for MODCRC
362
#       --NoThx                     Suppress the creation of THX files
363
#       --NoPayload                 Suppress the creation of Payload files
364
#       --MotOnly                   Only Generate the MOT file
365
#                                   Forces --NoThx and --NoPayload
366
#
367
###############################################################################
368
 
369
sub ToolsetLD
370
{
371
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
372
    my ( @slist );
373
    my $lib = $name;
374
    my %loc_list;
375
    my ($u_rel_file, $rel_file);
376
    my $no_thx;
377
    my $no_payload;
378
    my $mot_only;
4488 dpurdie 379
    my $flash_end;
227 dpurdie 380
    my @builds;
381
 
382
#.. Parse arguments
383
#
384
    foreach $_ ( @$pArgs ) {
385
        if ( /^--Set=(.*)=(.*)/ ) {
386
            $loc_list{$1} = $2;
387
 
388
        } elsif (/^--Rel=(.*)/ ) {
389
            $u_rel_file = $1;
390
 
391
        } elsif (/^--NoThx/ ) {
392
            $no_thx = 1;
393
 
394
        } elsif (/^--NoPayload/ ) {
395
            $no_payload = 1;
396
 
397
        } elsif (/^--MotOnly/ ) {
398
            $mot_only = 1;
399
            $no_thx = 1;
400
            $no_payload = 1;
4488 dpurdie 401
 
402
        } elsif (/^--FlashEnd=(.*)/ ) {
403
            $flash_end = $1;
404
 
227 dpurdie 405
        } else {
406
            Message( "m16c LD: unknown option $_ -- ignored\n" );
407
        }
408
    }
409
 
410
    #
411
    #   Post processing
412
    #
413
    if ( $u_rel_file )
414
    {
415
        #
416
        #   Locate the true path of the provided REL file
417
        #   If it is a generate file it will be in the SRCS hash
418
        #   Otherwise the user will have to use Src to locate the file
419
        #
420
        $rel_file = MakeSrcResolve ( $u_rel_file );
421
    }
422
 
423
    #
424
    #   Prepare version information
425
    #
426
    my @ver_data = split( /\./, $ScmBuildVersion);
427
 
428
    #
429
    #   Create a printer tool instance
430
    #
431
    my $io = ToolsetPrinter::New();
432
 
4488 dpurdie 433
    #
434
    #   Create the flash size information for this linker Target
435
    #
436
    $io->Label( "Flash Boundary Checking", $name );
437
    if ( $flash_end )
438
    {
439
        $io->Prt( "${name}_FlashEnd = $flash_end\n" );
440
    }
441
    else
442
    {
443
        $io->Prt( "${name}_FlashEnd = 0\n" );
444
    }
445
    $io->Newline();
446
 
227 dpurdie 447
    unless ( $no_payload )
448
    {
449
        ####################################################################
450
        #
451
        #   Build the .payload file from the .bin file
452
        #
453
        my $pl_file = "\$(BINDIR)/${lib}_$ver_data[0].$ver_data[1].$ver_data[2].payload";
454
        $io->Label( "Payload Module", $name );
455
        $io->Prt( "$pl_file :" .
456
                  "\\\n\t\t\$(BINDIR)/$lib.bin ".
457
                  "\n\t\t\$(call MCRPLD,$ver_data[0].$ver_data[1].$ver_data[2])\n"
458
                );
459
        $io->Newline();
460
 
461
        #
462
        #   Register generated file for cleanup
463
        #
464
        ToolsetGenerate( $pl_file );
465
 
466
        #
467
        #   Specify the files to be packaged as part of the shared library
468
        #
469
        PackageProgAddFiles( $name, $pl_file );
470
        ProgAddExtra( $name, $pl_file );
471
        push @builds, $pl_file;
472
    }
473
 
474
 
475
    unless ( $no_thx )
476
    {
477
        ####################################################################
478
        #
479
        #   Build the .thx file from the .raw file
480
        #
481
        my $rel_mod = "\$(BINDIR)/$name.rel";
482
        $io->Label( "THX Module", $name );
483
        $io->Prt( "\$(BINDIR)/$lib.thx :" .
484
                  "\\\n\t\t\$(BINDIR)/$lib.raw ".
485
                  "\\\n\t\t$rel_mod ".
486
                  "\n\t\t\$(call MODCRC,$rel_mod)\n"
487
                );
488
        $io->Newline();
489
 
490
        #
491
        #   Register generated file for cleanup
492
        #   The MODCRC process generates a .bak file. Ensure that it gets removed
493
        #
494
        ToolsetGenerate( "\$(BINDIR)/$lib.thx" );
495
        ToolsetGenerate( "\$(BINDIR)/$lib.bak" );
496
        ToolsetGenerate( "\$(BINDIR)/$lib.mod" );
497
 
498
        #
499
        #   Specify the files to be packaged as part of the shared library
500
        #
501
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.thx" );
502
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.mod" );
503
        ProgAddExtra( $name, "\$(BINDIR)/$lib.thx" );
504
        ProgAddExtra( $name, "\$(BINDIR)/$lib.mod" );
505
        push @builds, "\$(BINDIR)/$lib.thx";
506
        push @builds, "\$(BINDIR)/$lib.mod";
507
 
508
        #
509
        #   Generate the .rel files needed by MODCRC in the generation
510
        #   of the .THX file
511
        #
245 dpurdie 512
        #   Need to massage the version number to be a decimal representation
513
        #   of a BCD number. Required to interwork with Mug Files
514
        #   The version number consists of 4 BCD chacaters
515
        #       The  most significant 2 are the major number 0-99
516
        #       The least significant 2 are the minor number 0-99
517
        #
227 dpurdie 518
        #   Can't do this at 'make time'
519
        #
245 dpurdie 520
        sub convertBcdDigit
521
        {
522
            my ($num, $shift) = @_;
523
            return ($num % 10) << $shift;
524
        }
525
 
526
        if ( $ver_data[1] > 99 || $ver_data[0] > 99 )
527
        {
528
            Error ("Cannot convert the package version number to required format",
529
                   "Major and Minor numbers MUST be less that 99",
530
                   "Major: $ver_data[0], Minor: $ver_data[1]");
531
        }
532
        my $ver = convertBcdDigit( $ver_data[1]     , 0 )
533
                + convertBcdDigit( $ver_data[1] / 10, 4)
534
                + convertBcdDigit( $ver_data[0]     , 8 )
535
                + convertBcdDigit( $ver_data[0] / 10, 12 );
536
 
227 dpurdie 537
 
538
        $io->Prt( "$rel_mod :" .
539
                  "\\\n\t\t$rel_file ".
540
                  "\\\n\t\t\$(GBE_PLATFORM).mk " .
541
                  "\n\t\t\$(XX_PRE)\$(echo) > $rel_mod \"version=$ver\"\n" );
542
        $io->Prt ( "\t\t\$(XX_PRE)\$(grep) < $rel_file >> $rel_mod -v \"^version\"\n" ) if($rel_file);
543
        $io->Newline();
544
        ToolsetGenerate( $rel_mod );
545
    }
546
 
547
    unless ( $mot_only )
548
    {
549
        ####################################################################
550
        #
551
        #   Build the .raw file from the .X30 file
552
        #   Build a .bin file in the process that has a version number embedded
553
        #   in the name of the file
554
        #
555
        my $bin = $lib . "_$ver_data[0].$ver_data[1].$ver_data[2]";
556
        $bin = "\$(BINDIR)/$bin.bin";
557
 
558
        $io->Label( "Raw Binary Image", $name );
559
        $io->Prt( "\$(BINDIR)/$lib.raw \\\n" .
560
                  "\$(BINDIR)/$lib.bin \\\n" .
561
                  "$bin \\\n" .
562
                  "\$(BINDIR)/$lib.mot:" .
563
                  "\\\n\t\t\$(BINDIR)/$lib.X30 ".
564
                  "\n\t\t\$(call LMC,$bin)\n"
565
                );
566
        $io->Newline();
567
 
568
        PackageProgAddFiles( $name, $bin );
569
        ProgAddExtra( $name, $bin );
570
        push @builds, $bin;
571
 
572
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.bin" );
573
        ProgAddExtra($name, "\$(BINDIR)/$lib.bin" );
574
        push @builds, "\$(BINDIR)/$lib.bin";
575
 
576
        #
577
        #   Register generated file for cleanup
578
        #
579
        ToolsetGenerate( "\$(BINDIR)/$lib.mot" );
580
        ToolsetGenerate( "\$(BINDIR)/$lib.bin" );
581
        ToolsetGenerate( $bin );
582
        ToolsetGenerate( "\$(BINDIR)/$lib.raw" );
583
 
584
    }
585
    else
586
    {
587
        ####################################################################
588
        #
589
        #   Build the .mot file from the .X30 file
590
        #   Build a .mot file that has a version number embedded in the name of the file
591
        #
592
        my $bin = $lib . "_$ver_data[0].$ver_data[1].$ver_data[2]";
593
        $bin = "\$(BINDIR)/$bin.mot";
594
 
595
        $io->Label( "MOT Image", $name );
596
        $io->Prt( "\$(BINDIR)/$lib.mot \\\n" .
597
                  "$bin:" .
598
                  "\\\n\t\t\$(BINDIR)/$lib.X30 ".
599
                  "\n\t\t\$(call LMC_MOT,$bin)\n"
600
                );
601
        $io->Newline();
602
 
603
        PackageProgAddFiles( $name, $bin );
604
        ProgAddExtra( $name, $bin );
605
        push @builds, $bin;
606
 
607
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.mot" );
608
        ProgAddExtra($name, "\$(BINDIR)/$lib.mot" );
609
        push @builds, "\$(BINDIR)/$lib.mot";
610
 
611
        #
612
        #   Register generated file for cleanup
613
        #
614
        ToolsetGenerate( "\$(BINDIR)/$lib.mot" );
615
        ToolsetGenerate( $bin );
616
    }
617
 
618
    ####################################################################
619
    #
620
    #   Build the .X30 file from the .R30 object files
621
    #
335 dpurdie 622
    my $dep = $io->SetLdTarget( $lib );
623
 
227 dpurdie 624
    $io->Label( "Link Object Files", $name );
625
    my $Xname = "\$(BINDIR)/$lib";
626
    my $Tname = "$Xname.X30";
627
 
628
    $io->Prt( "$Tname:\tSHBASE=${lib}\n" );
629
    $io->Prt( "$Tname:\tSHNAME=${lib}\n" );
630
    $io->Entry( "$Tname :\t", "", "\\\n\t\t", ".$::o ", @$pObjs );
335 dpurdie 631
    $io->Prt( "\\\n\t\t\$(SCM_MAKEFILE) " );
632
    $io->Prt( "\\\n\t\t$dep " );
227 dpurdie 633
    $io->Prt( "\n\t\$(LD)\n" );
634
    $io->Newline();
635
 
636
    #
637
    #   Add the MAP file to the program package
638
    #
639
    PackageProgAddFiles( $name, "\$(BINDIR)/${name}.map" , 'Class=map' );
640
 
641
    #
642
    #   Register generated file for cleanup
643
    #
644
    ToolsetGenerate( "$Xname.X30" );
645
    ToolsetGenerate( "$Xname.map" );
646
 
647
    ####################################################################
648
    #
649
    #   Build the linker command file
650
    #
651
    #   Now the fun part... piecing together a variable ${name}_ld
652
    #   which ends up in the command file.
653
    #
654
    $io->Label( "Linker commands", $name );     # label
655
    $io->SetTag( "${lib}_ld" );                 # command tag
656
 
657
    $io->Cmd( "-O \$(subst /,\\,$Xname.X30)" );
658
    $io->Cmd( "-G" );
659
    $io->Cmd( "-MS" );
660
    $io->Cmd( "-." );
661
 
662
    #
663
    #   User specified locations
664
    #
665
    for (keys %loc_list ) {
666
        $io->Cmd( "-LOC $_=$loc_list{$_}" );
667
    }
668
 
669
                                            # object list
670
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
671
 
672
                                            # library list
673
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
674
 
675
    #
676
    #   System libraries last
677
    #
678
    $io->Cmd( "-L \$(LIB30)\\\\nc30lib.lib" );
679
 
680
 
681
    $io->Newline();
682
    ToolsetGenerate( "$Xname.ld" );
683
 
684
    ####################################################################
685
    #
335 dpurdie 686
    #.. Dependency link,
687
    #   Create a linker dependency file
227 dpurdie 688
    #   This will be used to generate associations between the .X30 file
689
    #   and libraries used to create the .X30 file
690
    #
335 dpurdie 691
    #       Create command file to build applicaton dependency list
692
    #       from the list of dependent libraries
227 dpurdie 693
    #
335 dpurdie 694
    #       Create makefile directives to include the dependency
695
    #       list into the makefile.
227 dpurdie 696
    #
335 dpurdie 697
    $io->DepRules( $pLibs, \&ToolsetLibRecipe, "$Xname.X30" );
698
    $io->LDDEPEND();
227 dpurdie 699
 
700
    #
701
    #   The Program that 'should' be created by this function does not always
702
    #   get produced. The name MUST be retained, but it is a PHONY.
703
    #   Create a recipe to build the bits we really need
704
    #
705
    my %builds;
706
    $builds{$_} = 1 foreach @builds;
707
    my $prog_target = "\$(BINDIR)/$name$exe";
708
    unless ( exists ($builds{$prog_target} ))
709
    {
710
        #
711
        $io->Label( "Phony Program", $name );
712
        $io->PrtLn( ".PHONY: $prog_target" );
713
        $io->Entry( "$prog_target :\t", "", "\\\n\t\t", "", @builds );
714
        $io->Newline();
715
    }
716
 
717
}
718
 
719
########################################################################
720
#
721
#   Generate a linker object recipe.  This is a helper function used 
722
#   within this toolset.
723
#
724
#   Arguments:
725
#       $io         I/O stream
726
#       $target     Name of the target
727
#       $obj        Library specification
728
#
729
########################################################################
730
 
731
sub ToolsetObjRecipe
732
{
733
    my ($io, $target, $obj) = @_;
734
 
735
    $io->Cmd("\$(subst /,\\\\,$obj.$::o)");
736
}
737
 
738
########################################################################
739
#
740
#   Generate a linker/depend library recipe.  This is a helper function
741
#   used within this toolset.
742
#
743
#   Arguments:
744
#       $io         I/O stream
745
#       $target     Name of the target
746
#       $lib        Library specification
747
#       $dp         If building a depend list, the full target name.
748
#
749
########################################################################
750
 
751
sub ToolsetLibRecipe
752
{
753
    my ($io, $target, $lib, $dp) = @_;
754
 
755
    if ( !defined($dp) ) {                      # linker
756
        $io->Cmd("-L @(vpath2,$lib.$::a,M16C_LIB)" );
757
 
758
    } else {                                    # depend
759
        $io->Cmd( "$dp:\t@(vlib2,$lib.$::a,M16C_LIB)" );
760
    }
761
}
762
 
763
 
764
1;
765