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