Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
259 dpurdie 1
#..
2
# Copyright (C) 1998-2008 ERG Transit Systems, All rights reserved
3
#
4
# Module name   : JATS
5
# Module type   : JATS Toolset
6
# Compiler(s)   : Perl
7
# Environment(s): JATS
8
#
9
# Description:
10
#       This file provides Toolset initialisation and plugin functions
11
#       to makelib.pl2
12
#
13
# Contents:     ACEX rules as used for the Fairchild ACE
14
#               ACE only supports an assembler
15
#
16
#............................................................................#
17
 
18
use strict;
19
 
20
#
21
#   Decalare gobal file-extension variables
22
#   These are exported by the toolset
23
#
24
our $s;
25
our $o;
26
our $so;
27
our $exe;
28
 
29
##############################################################################
30
#   ToolsetInit()
31
#       Runtime initialisation
32
#
33
##############################################################################
34
 
35
ToolsetInit();
36
 
37
sub ToolsetInit
38
{
39
    my( @args ) = @::ScmToolsetArgs;             # Toolset arguments
40
 
41
    #.. Parse arguments
42
    #
43
    Debug( "acex(@args)\n" );
44
 
45
    foreach $_ ( @args ) {
46
        Message( "acex: unknown toolset argument $_ -- ignored\n" );
47
    }
48
 
49
    #.. Parse Platform Arguments
50
    #
51
    @args = @::ScmPlatformArgs;                 # Platform arguments
52
    foreach $_ ( @args ) {
53
        if (/^--product=(.*)/) {                # GBE product - ignored
54
 
55
        } else {
56
            Message( "acex: unknown platform argument $_ -- ignored\n" );
57
        }
58
    }
59
 
60
    #.. Standard.rul requirements
61
    #
62
    $s = 'asm';             # Assembler source file
63
    $o = '';                # Object file - None
64
    $a = undef;             # Library file - None
65
    $so = undef;            # Shared library - None
66
    $exe = '.hex';          # Program
67
 
68
    #.. Toolset configuration
69
    #
70
    $::ScmToolsetVersion = "1.0.0";             # our version
71
    $::ScmToolsetGenerate = 0;                  # generate optional
72
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
73
    %::ScmToolsetProgSource = (                 # handle these files directly
74
            '.asm'      => '',                  # Will be flagged as "CSRCS"
75
            );
76
 
77
 
78
#.. Cleanup rules
79
#
80
 
81
    #.. Define ACEx environment
82
    #
83
    #
84
    #   Define initialisation targets
85
    #   These will be used to ensure that correct versions of the toolset are present
86
    #
87
    Init( "acex" );
88
 
89
    ToolsetDefine ( "#################################################" );
90
    ToolsetDefine ( "# ACEx compiler version" );
91
    ToolsetDefine ( "#" );
92
    ToolsetDefines( "acex.def" );
93
    ToolsetRules  ( "acex.rul" );
94
    ToolsetRules  ( "standard.rul" );
95
}
96
 
97
###############################################################################
98
#   Name: ToolsetLD
99
#       This subroutine takes the user options and builds the rules
100
#       required to link the program 'name'.
101
#
102
#   Arguments:
103
#       $name       - Name of the target program
104
#       $pArgs      - Ref to an array of argumennts
105
#       $pObjs      - Ref to an array of object files
106
#       $pLibs      - Ref to an array of libraries
107
#
108
#   Output:
109
#       Makefile recipes to create the Program
110
#
111
#   Notes:
112
#       This Program Builder will handle its own dependancies
113
#
114
#   p$args
115
#       --NoMap                 - Don't publish map file (default)
116
#       --Map                   - Do publish map file
117
#       Source File             - One source file
118
#                                 Optional. Use $name.asm if not provided
119
#
120
###############################################################################
121
 
122
sub ToolsetLD
123
{
124
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
125
    my $map = 0;
126
    my @source;
127
    my $base;
128
    my $root;
129
    my $full;
130
    my $mapFile;
131
    my $asm;
132
 
133
    #.. Parse arguments
134
    #
135
    foreach ( @$pArgs ) {
136
        if (/^--NoMap/i) {
137
            $map = 0;
138
 
139
        } elsif ( /^--Map/i ) {
140
            $map = 1;
141
 
142
        } elsif ( !/^-/ ) {
143
            push @source, MakeSrcResolve($_);
144
 
145
        } else {
146
            Message( "ACEx LD: unknown option $_ -- ignored\n" );
147
 
148
        }
149
    }
150
 
151
    #
152
    #   If the user has not specified a source file
153
    #   then use on of the same name as the output program
154
    #
155
    push @source, MakeSrcResolve($name . '.asm')
156
        unless ( @source );
157
 
158
    #
159
    #   Sanity test
160
    #
161
    Error ('ACEx LD: Libraries not allowed')
162
        if ( @$pLibs );
163
 
164
    Error ('ACEx LD: Object files not allowed')
165
        if ( @$pObjs );
166
 
167
    Error ('ACEx LD: Only one source file allowed')
168
        if ( $#source > 0 );
169
 
170
    #
171
    #   Determine the target output name(s)
172
    #
173
    $base = $name;
174
    $root = "\$(BINDIR)/$base";
175
    $full = $root . $::exe;
176
    $asm  = $root . '.asm';
177
    $mapFile = "$root.prn";
178
 
179
    #
180
    #   Create Rules and Recipes to create the Program
181
    #
182
    my $me = MakeEntry::New (*MAKEFILE, $full );
183
    $me->AddComment ("Build Program: $name" );
184
    $me->AddName    ( $mapFile ) if ( $map );
185
    $me->AddDependancy ( @source );
186
    $me->AddRecipe ( '$(AS)' );
187
    $me->Print();
188
 
189
    #
190
    #   Files to clean up
191
    #
192
    ToolsetGenerate( $mapFile );
193
    ToolsetGenerate( $asm );
194
 
195
 
196
    #.. Package up files that are a part of the program
197
    #
198
    PackageProgAddFiles ( $name, $full );
199
    PackageProgAddFiles ( $name, $mapFile, 'Class=map' ) if ( $map );
200
}
201
 
202
#.. Successful termination
203
1;
204