Subversion Repositories DevTools

Rev

Go to most recent revision | 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
    $::ScmToolsetIFLAG3 = 1;                    # supports IFLAG3
73
    $::ScmToolsetProgDependancies = 0;          # handle Prog dependancies myself
74
    %::ScmToolsetProgSource = (                 # handle these files directly
75
            '.asm'      => '',                  # Will be flagged as "CSRCS"
76
            );
77
 
78
 
79
#.. Cleanup rules
80
#
81
 
82
    #.. Define ACEx environment
83
    #
84
    #
85
    #   Define initialisation targets
86
    #   These will be used to ensure that correct versions of the toolset are present
87
    #
88
    Init( "acex" );
89
 
90
    ToolsetDefine ( "#################################################" );
91
    ToolsetDefine ( "# ACEx compiler version" );
92
    ToolsetDefine ( "#" );
93
    ToolsetDefines( "acex.def" );
94
    ToolsetRules  ( "acex.rul" );
95
    ToolsetRules  ( "standard.rul" );
96
}
97
 
98
###############################################################################
99
#   Name: ToolsetLD
100
#       This subroutine takes the user options and builds the rules
101
#       required to link the program 'name'.
102
#
103
#   Arguments:
104
#       $name       - Name of the target program
105
#       $pArgs      - Ref to an array of argumennts
106
#       $pObjs      - Ref to an array of object files
107
#       $pLibs      - Ref to an array of libraries
108
#
109
#   Output:
110
#       Makefile recipes to create the Program
111
#
112
#   Notes:
113
#       This Program Builder will handle its own dependancies
114
#
115
#   p$args
116
#       --NoMap                 - Don't publish map file (default)
117
#       --Map                   - Do publish map file
118
#       Source File             - One source file
119
#                                 Optional. Use $name.asm if not provided
120
#
121
###############################################################################
122
 
123
sub ToolsetLD
124
{
125
    my ( $name, $pArgs, $pObjs, $pLibs ) = @_;
126
    my $map = 0;
127
    my @source;
128
    my $base;
129
    my $root;
130
    my $full;
131
    my $mapFile;
132
    my $asm;
133
 
134
    #.. Parse arguments
135
    #
136
    foreach ( @$pArgs ) {
137
        if (/^--NoMap/i) {
138
            $map = 0;
139
 
140
        } elsif ( /^--Map/i ) {
141
            $map = 1;
142
 
143
        } elsif ( !/^-/ ) {
144
            push @source, MakeSrcResolve($_);
145
 
146
        } else {
147
            Message( "ACEx LD: unknown option $_ -- ignored\n" );
148
 
149
        }
150
    }
151
 
152
    #
153
    #   If the user has not specified a source file
154
    #   then use on of the same name as the output program
155
    #
156
    push @source, MakeSrcResolve($name . '.asm')
157
        unless ( @source );
158
 
159
    #
160
    #   Sanity test
161
    #
162
    Error ('ACEx LD: Libraries not allowed')
163
        if ( @$pLibs );
164
 
165
    Error ('ACEx LD: Object files not allowed')
166
        if ( @$pObjs );
167
 
168
    Error ('ACEx LD: Only one source file allowed')
169
        if ( $#source > 0 );
170
 
171
    #
172
    #   Determine the target output name(s)
173
    #
174
    $base = $name;
175
    $root = "\$(BINDIR)/$base";
176
    $full = $root . $::exe;
177
    $asm  = $root . '.asm';
178
    $mapFile = "$root.prn";
179
 
180
    #
181
    #   Create Rules and Recipes to create the Program
182
    #
183
    my $me = MakeEntry::New (*MAKEFILE, $full );
184
    $me->AddComment ("Build Program: $name" );
185
    $me->AddName    ( $mapFile ) if ( $map );
186
    $me->AddDependancy ( @source );
187
    $me->AddRecipe ( '$(AS)' );
188
    $me->Print();
189
 
190
    #
191
    #   Files to clean up
192
    #
193
    ToolsetGenerate( $mapFile );
194
    ToolsetGenerate( $asm );
195
 
196
 
197
    #.. Package up files that are a part of the program
198
    #
199
    PackageProgAddFiles ( $name, $full );
200
    PackageProgAddFiles ( $name, $mapFile, 'Class=map' ) if ( $map );
201
}
202
 
203
#.. Successful termination
204
1;
205