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