Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
227 dpurdie 1
#..
2
# Copyright (C) 1998-2005 ERG Transit Systems, All rights reserved
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",
152
                   );
153
        my %found = ();
154
 
155
        #
156
        #   Locate the required files
157
        #
158
        for my $program ( keys( %need ))
159
        {
160
            if ( my $path = ToolExtensionProgram( $program ) )
161
            {
162
                $found{ $need{$program} } = $path;
163
                delete( $need{$program} );
164
            }
165
        }
166
 
167
        ::Warning( "Tool program(s) required by toolset not found:",
168
                  sort( keys %need),
169
                  "Check that the mos_tools and mcr_tools packages are present" )
170
            if ( scalar keys %need );
171
 
172
        #
173
        #   Generate the definitions
174
        #
175
 
176
        ToolsetDefine ( "#################################################" );
177
        ToolsetDefine ( "#  The path to tools required to build MOS Programs" );
178
        ToolsetDefine ( "#" );
179
        for my $defn ( keys %found )
180
        {
181
            ToolsetDefine ( "$defn := $found{$defn}" );
182
        }
183
        ToolsetDefine ( "" );
184
    }
185
}
186
 
187
 
188
###############################################################################
189
#   ToolsetCC( $source, $obj, \@args )
190
#       This subroutine takes the user options and builds the rule(s)
191
#       required to compile the source file 'source' to 'obj'
192
#
193
###############################################################################
194
 
195
sub ToolsetCC
196
{
197
    MakePrint( "\n\t\$(CC)\n\n" );
198
}
199
 
200
 
201
 
202
###############################################################################
203
#   ToolsetCCDepend( $depend, \@sources )
204
#       This subroutine takes the user options and builds the
205
#       rule(s) required to build the dependencies for the source
206
#       files 'sources' to 'depend'.
207
#
208
###############################################################################
209
 
210
sub ToolsetCCDepend
211
{
212
    MakePrint( "\t\$(CCDEPEND)\n\n" );
213
}
214
 
215
###############################################################################
216
#   ToolsetCXX( $source, $obj, \@args )
217
#       This subroutine takes the user options and builds the rule(s)
218
#       required to compile the source file 'source' to 'obj'
219
#
220
#
221
#   In this toolset the source files WILL be .thx files that are to be
222
#   converted to "C" files and then to object files
223
#
224
#   On entry JATS has created the basic part of the recipe. The object file
225
#   is dependant on the source file and the makefile
226
#
227
#   This function must generate the body of the recipe
228
#
229
###############################################################################
230
 
231
sub ToolsetCXX
232
{
233
    my ($source, $obj, @args) = @_;
234
    my $name = $source;
235
    my $odir = "\$(OBJDIR)";
236
    my $tname = "$odir/${obj}";
237
 
238
    #
239
    #   Ensure that we have a .THX file
240
    #
241
    Error("Unknown file type: $source")
242
        unless ( $source =~ /\.thx$/i );
243
 
244
    #
245
    #   THX files are processed by:
246
    #       .thx    -> modcrc      ->   .bin
247
    #       .bin    -> fontcrc     ->   .c
248
    #       .c      -> compiler    ->   .r30
249
    #
250
    MakePrint( "\n\t\$(call THX2R30,$source,$tname)\n\n" );
251
 
252
    #
253
    #   Override the C source filename when building this target
254
    #   This is required as the C source is in the OBJ directory
255
    #
256
    MakePrint( "\$(OBJDIR)/$obj.$::o:", "\tcc_source_file=${tname}.c\n\n" );
257
 
258
 
259
    #
260
    #   Cleanup files that may be generated
261
    #
262
    ToolsetGenerate( "$tname.c" );
263
    ToolsetGenerate( "$tname.bin" );
264
    ToolsetGenerate( "$tname.thx" );
265
    ToolsetGenerate( "$tname.nul" );
266
}
267
 
268
###############################################################################
269
#   ToolsetCXXDepend( $depend, \@sources )
270
#       This subroutine takes the user options and builds the
271
#       rule(s) required to build the dependencies for the source
272
#       files 'sources' to 'depend'.
273
#
274
###############################################################################
275
 
276
sub ToolsetCXXDepend
277
{
287 dpurdie 278
    ToolsetCCDepend();
227 dpurdie 279
}
280
 
281
###############################################################################
282
#   ToolsetAS( $source, $obj, \@args )
283
#       This subroutine takes the user options and builds the rule(s)
284
#       required to compile the source file 'source' to 'obj'
285
#
286
###############################################################################
287
 
288
sub ToolsetAS
289
{
290
    my( $source, $obj, @args) = @_;
291
    MakePrint( "\n\t\$(AS)\n" );
292
    ToolsetGenerate( "\$(OBJDIR)/$obj.lst" );
293
}
294
 
295
sub ToolsetASDepend
296
{
297
}
298
 
299
###############################################################################
300
#   ToolsetAR( $name, \@args, \@objs )
301
#       This subroutine takes the user options and builds the rules
302
#       required to build the library 'name'.
303
 
304
#
305
#   Arguments:
306
#       --xxx                   No arguments currently defined
307
#
308
#   Output:
309
#       [ $(BINDIR)/name$.${a}:   .... ]
310
#           $(AR)
311
#
312
###############################################################################
313
 
314
sub ToolsetAR
315
{
316
    my( $name, $pArgs, $pObjs ) = @_;
317
 
318
    Debug("ToolsetAR");
319
 
320
#.. Parse arguments
321
#
322
    foreach $_ ( @$pArgs ) {
323
        if (/^--/) {
324
            Message( "AR: unknown option $_ -- ignored\n" );
325
        }
326
    }
327
 
328
#.. Target
329
#
330
    MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", " \\\n\t\t", ".${o}", @$pObjs );
331
 
332
#.. Build library rule (just append to standard rule)
333
#
334
    MakePrint( "\n\t\$(AR)\n\n" );
335
 
336
#.. Generated files
337
#
338
    ToolsetGenerate( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}.ar" );
339
}
340
 
341
 
342
###############################################################################
343
#   ToolsetLD( $name, \@args, \@objs, \@libraries )
344
#       This subroutine takes the user options and builds the rules
345
#       required to link the program 'name'.
346
#
347
#   The process of creating a THX files consists of:
348
#       1) Link .R30 object files to create a .X30 file
349
#       2) Process the .X30 file to create a .raw file
350
#       3) Use 'modcrc' to create a .thx file
351
#       4) Use 'modcrc' to create a .mod file (a MOS .bin file)
352
#
353
#   Note: This toolset will handle the generation of the dependancies
354
#         by itself. This allows complete control over the generation
355
#         of the dependancies. Required as the process of creating
356
#         a THX is complex.
357
#
358
#   Arguments:
359
#       --Set=Name=Value            Linker -LOC data
360
#       --Rel=Name                  Rel file base for MODCRC
361
#       --NoThx                     Suppress the creation of THX files
362
#       --NoPayload                 Suppress the creation of Payload files
363
#       --MotOnly                   Only Generate the MOT file
364
#                                   Forces --NoThx and --NoPayload
365
#
366
###############################################################################
367
 
368
sub ToolsetLD
369
{
370
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
371
    my ( @slist );
372
    my $lib = $name;
373
    my %loc_list;
374
    my ($u_rel_file, $rel_file);
375
    my $no_thx;
376
    my $no_payload;
377
    my $mot_only;
378
    my @builds;
379
 
380
#.. Parse arguments
381
#
382
    foreach $_ ( @$pArgs ) {
383
        if ( /^--Set=(.*)=(.*)/ ) {
384
            $loc_list{$1} = $2;
385
 
386
        } elsif (/^--Rel=(.*)/ ) {
387
            $u_rel_file = $1;
388
 
389
        } elsif (/^--NoThx/ ) {
390
            $no_thx = 1;
391
 
392
        } elsif (/^--NoPayload/ ) {
393
            $no_payload = 1;
394
 
395
        } elsif (/^--MotOnly/ ) {
396
            $mot_only = 1;
397
            $no_thx = 1;
398
            $no_payload = 1;
399
 
400
        } else {
401
            Message( "m16c LD: unknown option $_ -- ignored\n" );
402
        }
403
    }
404
 
405
    #
406
    #   Post processing
407
    #
408
    if ( $u_rel_file )
409
    {
410
        #
411
        #   Locate the true path of the provided REL file
412
        #   If it is a generate file it will be in the SRCS hash
413
        #   Otherwise the user will have to use Src to locate the file
414
        #
415
        $rel_file = MakeSrcResolve ( $u_rel_file );
416
    }
417
 
418
    #
419
    #   Prepare version information
420
    #
421
    my @ver_data = split( /\./, $ScmBuildVersion);
422
 
423
    #
424
    #   Create a printer tool instance
425
    #
426
    my $io = ToolsetPrinter::New();
427
 
428
    unless ( $no_payload )
429
    {
430
        ####################################################################
431
        #
432
        #   Build the .payload file from the .bin file
433
        #
434
        my $pl_file = "\$(BINDIR)/${lib}_$ver_data[0].$ver_data[1].$ver_data[2].payload";
435
        $io->Label( "Payload Module", $name );
436
        $io->Prt( "$pl_file :" .
437
                  "\\\n\t\t\$(BINDIR)/$lib.bin ".
438
                  "\n\t\t\$(call MCRPLD,$ver_data[0].$ver_data[1].$ver_data[2])\n"
439
                );
440
        $io->Newline();
441
 
442
        #
443
        #   Register generated file for cleanup
444
        #
445
        ToolsetGenerate( $pl_file );
446
 
447
        #
448
        #   Specify the files to be packaged as part of the shared library
449
        #
450
        PackageProgAddFiles( $name, $pl_file );
451
        ProgAddExtra( $name, $pl_file );
452
        push @builds, $pl_file;
453
    }
454
 
455
 
456
    unless ( $no_thx )
457
    {
458
        ####################################################################
459
        #
460
        #   Build the .thx file from the .raw file
461
        #
462
        my $rel_mod = "\$(BINDIR)/$name.rel";
463
        $io->Label( "THX Module", $name );
464
        $io->Prt( "\$(BINDIR)/$lib.thx :" .
465
                  "\\\n\t\t\$(BINDIR)/$lib.raw ".
466
                  "\\\n\t\t$rel_mod ".
467
                  "\n\t\t\$(call MODCRC,$rel_mod)\n"
468
                );
469
        $io->Newline();
470
 
471
        #
472
        #   Register generated file for cleanup
473
        #   The MODCRC process generates a .bak file. Ensure that it gets removed
474
        #
475
        ToolsetGenerate( "\$(BINDIR)/$lib.thx" );
476
        ToolsetGenerate( "\$(BINDIR)/$lib.bak" );
477
        ToolsetGenerate( "\$(BINDIR)/$lib.mod" );
478
 
479
        #
480
        #   Specify the files to be packaged as part of the shared library
481
        #
482
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.thx" );
483
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.mod" );
484
        ProgAddExtra( $name, "\$(BINDIR)/$lib.thx" );
485
        ProgAddExtra( $name, "\$(BINDIR)/$lib.mod" );
486
        push @builds, "\$(BINDIR)/$lib.thx";
487
        push @builds, "\$(BINDIR)/$lib.mod";
488
 
489
        #
490
        #   Generate the .rel files needed by MODCRC in the generation
491
        #   of the .THX file
492
        #
245 dpurdie 493
        #   Need to massage the version number to be a decimal representation
494
        #   of a BCD number. Required to interwork with Mug Files
495
        #   The version number consists of 4 BCD chacaters
496
        #       The  most significant 2 are the major number 0-99
497
        #       The least significant 2 are the minor number 0-99
498
        #
227 dpurdie 499
        #   Can't do this at 'make time'
500
        #
245 dpurdie 501
        sub convertBcdDigit
502
        {
503
            my ($num, $shift) = @_;
504
            return ($num % 10) << $shift;
505
        }
506
 
507
        if ( $ver_data[1] > 99 || $ver_data[0] > 99 )
508
        {
509
            Error ("Cannot convert the package version number to required format",
510
                   "Major and Minor numbers MUST be less that 99",
511
                   "Major: $ver_data[0], Minor: $ver_data[1]");
512
        }
513
        my $ver = convertBcdDigit( $ver_data[1]     , 0 )
514
                + convertBcdDigit( $ver_data[1] / 10, 4)
515
                + convertBcdDigit( $ver_data[0]     , 8 )
516
                + convertBcdDigit( $ver_data[0] / 10, 12 );
517
 
227 dpurdie 518
 
519
        $io->Prt( "$rel_mod :" .
520
                  "\\\n\t\t$rel_file ".
521
                  "\\\n\t\t\$(GBE_PLATFORM).mk " .
522
                  "\n\t\t\$(XX_PRE)\$(echo) > $rel_mod \"version=$ver\"\n" );
523
        $io->Prt ( "\t\t\$(XX_PRE)\$(grep) < $rel_file >> $rel_mod -v \"^version\"\n" ) if($rel_file);
524
        $io->Newline();
525
        ToolsetGenerate( $rel_mod );
526
    }
527
 
528
    unless ( $mot_only )
529
    {
530
        ####################################################################
531
        #
532
        #   Build the .raw file from the .X30 file
533
        #   Build a .bin file in the process that has a version number embedded
534
        #   in the name of the file
535
        #
536
        my $bin = $lib . "_$ver_data[0].$ver_data[1].$ver_data[2]";
537
        $bin = "\$(BINDIR)/$bin.bin";
538
 
539
        $io->Label( "Raw Binary Image", $name );
540
        $io->Prt( "\$(BINDIR)/$lib.raw \\\n" .
541
                  "\$(BINDIR)/$lib.bin \\\n" .
542
                  "$bin \\\n" .
543
                  "\$(BINDIR)/$lib.mot:" .
544
                  "\\\n\t\t\$(BINDIR)/$lib.X30 ".
545
                  "\n\t\t\$(call LMC,$bin)\n"
546
                );
547
        $io->Newline();
548
 
549
        PackageProgAddFiles( $name, $bin );
550
        ProgAddExtra( $name, $bin );
551
        push @builds, $bin;
552
 
553
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.bin" );
554
        ProgAddExtra($name, "\$(BINDIR)/$lib.bin" );
555
        push @builds, "\$(BINDIR)/$lib.bin";
556
 
557
        #
558
        #   Register generated file for cleanup
559
        #
560
        ToolsetGenerate( "\$(BINDIR)/$lib.mot" );
561
        ToolsetGenerate( "\$(BINDIR)/$lib.bin" );
562
        ToolsetGenerate( $bin );
563
        ToolsetGenerate( "\$(BINDIR)/$lib.raw" );
564
 
565
    }
566
    else
567
    {
568
        ####################################################################
569
        #
570
        #   Build the .mot file from the .X30 file
571
        #   Build a .mot file that has a version number embedded in the name of the file
572
        #
573
        my $bin = $lib . "_$ver_data[0].$ver_data[1].$ver_data[2]";
574
        $bin = "\$(BINDIR)/$bin.mot";
575
 
576
        $io->Label( "MOT Image", $name );
577
        $io->Prt( "\$(BINDIR)/$lib.mot \\\n" .
578
                  "$bin:" .
579
                  "\\\n\t\t\$(BINDIR)/$lib.X30 ".
580
                  "\n\t\t\$(call LMC_MOT,$bin)\n"
581
                );
582
        $io->Newline();
583
 
584
        PackageProgAddFiles( $name, $bin );
585
        ProgAddExtra( $name, $bin );
586
        push @builds, $bin;
587
 
588
        PackageProgAddFiles( $name, "\$(BINDIR)/$lib.mot" );
589
        ProgAddExtra($name, "\$(BINDIR)/$lib.mot" );
590
        push @builds, "\$(BINDIR)/$lib.mot";
591
 
592
        #
593
        #   Register generated file for cleanup
594
        #
595
        ToolsetGenerate( "\$(BINDIR)/$lib.mot" );
596
        ToolsetGenerate( $bin );
597
    }
598
 
599
    ####################################################################
600
    #
601
    #   Build the .X30 file from the .R30 object files
602
    #
603
    $io->Label( "Link Object Files", $name );
604
    my $Xname = "\$(BINDIR)/$lib";
605
    my $Tname = "$Xname.X30";
606
 
607
    $io->Prt( "$Tname:\tSHBASE=${lib}\n" );
608
    $io->Prt( "$Tname:\tSHNAME=${lib}\n" );
609
#    $io->Prt( "$Tname:\tCFLAGS+=\$(SHCFLAGS)\n" );
610
#    $io->Prt( "$Tname:\tCXXLAGS+=\$(SHCXXFLAGS)\n" );
611
    $io->Entry( "$Tname :\t", "", "\\\n\t\t", ".$::o ", @$pObjs );
612
    $io->Prt( "\\\n\t\t\$(GBE_PLATFORM).mk " );
613
    $io->Prt( "\\\n\t\t$Xname.dep " );
614
    $io->Prt( "\n\t\$(LD)\n" );
615
    $io->Newline();
616
 
617
    #
618
    #   Add the MAP file to the program package
619
    #
620
    PackageProgAddFiles( $name, "\$(BINDIR)/${name}.map" , 'Class=map' );
621
 
622
    #
623
    #   Register generated file for cleanup
624
    #
625
    ToolsetGenerate( "$Xname.X30" );
626
    ToolsetGenerate( "$Xname.dep" );
627
    ToolsetGenerate( "$Xname.map" );
628
 
629
    ####################################################################
630
    #
631
    #   Build the linker command file
632
    #
633
    #   Now the fun part... piecing together a variable ${name}_ld
634
    #   which ends up in the command file.
635
    #
636
    $io->Label( "Linker commands", $name );     # label
637
    $io->SetTag( "${lib}_ld" );                 # command tag
638
 
639
    $io->Cmd( "-O \$(subst /,\\,$Xname.X30)" );
640
    $io->Cmd( "-G" );
641
    $io->Cmd( "-MS" );
642
    $io->Cmd( "-." );
643
 
644
    #
645
    #   User specified locations
646
    #
647
    for (keys %loc_list ) {
648
        $io->Cmd( "-LOC $_=$loc_list{$_}" );
649
    }
650
 
651
                                            # object list
652
    $io->ObjList( $name, $pObjs, \&ToolsetObjRecipe );
653
 
654
                                            # library list
655
    $io->LibList( $name, $pLibs, \&ToolsetLibRecipe );
656
 
657
    #
658
    #   System libraries last
659
    #
660
    $io->Cmd( "-L \$(LIB30)\\\\nc30lib.lib" );
661
 
662
 
663
    $io->Newline();
664
    ToolsetGenerate( "$Xname.ld" );
665
 
666
    ####################################################################
667
    #
668
    #   Build the linker dependancy file
669
    #   This will be used to generate associations between the .X30 file
670
    #   and libraries used to create the .X30 file
671
    #
672
    #   This information is calculated at 'make' time
673
    #
674
    $io->Label( "Linker dependancy rules", $name );     # label
675
    $io->SetTag( "${lib}_dp" );                         # command tag
676
    $io->DepRules( $lib, $pLibs,                        # library depends rules
677
            \&ToolsetLibRecipe, "$Xname.X30" );
678
 
679
    #
680
    #   Generate Shared Library dependency information
681
    #
682
    $io->LDDEPEND( $lib );                # std LDDEPEND rules
683
 
684
 
685
    #
686
    #   The Program that 'should' be created by this function does not always
687
    #   get produced. The name MUST be retained, but it is a PHONY.
688
    #   Create a recipe to build the bits we really need
689
    #
690
    my %builds;
691
    $builds{$_} = 1 foreach @builds;
692
    my $prog_target = "\$(BINDIR)/$name$exe";
693
    unless ( exists ($builds{$prog_target} ))
694
    {
695
        #
696
        $io->Label( "Phony Program", $name );
697
        $io->PrtLn( ".PHONY: $prog_target" );
698
        $io->Entry( "$prog_target :\t", "", "\\\n\t\t", "", @builds );
699
        $io->Newline();
700
    }
701
 
702
}
703
 
704
########################################################################
705
#
706
#   Generate a linker object recipe.  This is a helper function used 
707
#   within this toolset.
708
#
709
#   Arguments:
710
#       $io         I/O stream
711
#       $target     Name of the target
712
#       $obj        Library specification
713
#
714
########################################################################
715
 
716
sub ToolsetObjRecipe
717
{
718
    my ($io, $target, $obj) = @_;
719
 
720
    $io->Cmd("\$(subst /,\\\\,$obj.$::o)");
721
}
722
 
723
########################################################################
724
#
725
#   Generate a linker/depend library recipe.  This is a helper function
726
#   used within this toolset.
727
#
728
#   Arguments:
729
#       $io         I/O stream
730
#       $target     Name of the target
731
#       $lib        Library specification
732
#       $dp         If building a depend list, the full target name.
733
#
734
########################################################################
735
 
736
sub ToolsetLibRecipe
737
{
738
    my ($io, $target, $lib, $dp) = @_;
739
 
740
    if ( !defined($dp) ) {                      # linker
741
        $io->Cmd("-L @(vpath2,$lib.$::a,M16C_LIB)" );
742
 
743
    } else {                                    # depend
744
        $io->Cmd( "$dp:\t@(vlib2,$lib.$::a,M16C_LIB)" );
745
    }
746
}
747
 
748
 
749
1;
750