Rev 259 | Blame | Last modification | View Log | RSS feed
#..# Copyright (C) 1998-2008 ERG Transit Systems, All rights reserved## Module name : JATS# Module type : JATS Toolset# Compiler(s) : Perl# Environment(s): JATS## Description:# This file provides Toolset initialisation and plugin functions# to makelib.pl2## Contents: ACEX rules as used for the Fairchild ACE# ACE only supports an assembler##............................................................................#use strict;## Decalare gobal file-extension variables# These are exported by the toolset#our $s;our $o;our $so;our $exe;############################################################################### ToolsetInit()# Runtime initialisation###############################################################################ToolsetInit();sub ToolsetInit{my( @args ) = @::ScmToolsetArgs; # Toolset arguments#.. Parse arguments#Debug( "acex(@args)\n" );foreach $_ ( @args ) {Message( "acex: unknown toolset argument $_ -- ignored\n" );}#.. Parse Platform Arguments#@args = @::ScmPlatformArgs; # Platform argumentsforeach $_ ( @args ) {if (/^--product=(.*)/) { # GBE product - ignored} else {Message( "acex: unknown platform argument $_ -- ignored\n" );}}#.. Standard.rul requirements#$s = 'asm'; # Assembler source file$o = ''; # Object file - None$a = undef; # Library file - None$so = undef; # Shared library - None$exe = '.hex'; # Program#.. Toolset configuration#$::ScmToolsetVersion = "1.0.0"; # our version$::ScmToolsetGenerate = 0; # generate optional$::ScmToolsetProgDependancies = 0; # handle Prog dependancies myself%::ScmToolsetProgSource = ( # handle these files directly'.asm' => '', # Will be flagged as "CSRCS");#.. Cleanup rules##.. Define ACEx environment### Define initialisation targets# These will be used to ensure that correct versions of the toolset are present#Init( "acex" );ToolsetDefine ( "#################################################" );ToolsetDefine ( "# ACEx compiler version" );ToolsetDefine ( "#" );ToolsetDefines( "acex.def" );ToolsetRules ( "acex.rul" );ToolsetRules ( "standard.rul" );}################################################################################ Name: ToolsetLD# This subroutine takes the user options and builds the rules# required to link the program 'name'.## Arguments:# $name - Name of the target program# $pArgs - Ref to an array of argumennts# $pObjs - Ref to an array of object files# $pLibs - Ref to an array of libraries## Output:# Makefile recipes to create the Program## Notes:# This Program Builder will handle its own dependancies## p$args# --NoMap - Don't publish map file (default)# --Map - Do publish map file# Source File - One source file# Optional. Use $name.asm if not provided################################################################################sub ToolsetLD{my ( $name, $pArgs, $pObjs, $pLibs ) = @_;my $map = 0;my @source;my $base;my $root;my $full;my $mapFile;my $asm;#.. Parse arguments#foreach ( @$pArgs ) {if (/^--NoMap/i) {$map = 0;} elsif ( /^--Map/i ) {$map = 1;} elsif ( !/^-/ ) {push @source, MakeSrcResolve($_);} else {Message( "ACEx LD: unknown option $_ -- ignored\n" );}}## If the user has not specified a source file# then use on of the same name as the output program#push @source, MakeSrcResolve($name . '.asm')unless ( @source );## Sanity test#Error ('ACEx LD: Libraries not allowed')if ( @$pLibs );Error ('ACEx LD: Object files not allowed')if ( @$pObjs );Error ('ACEx LD: Only one source file allowed')if ( $#source > 0 );## Determine the target output name(s)#$base = $name;$root = "\$(BINDIR)/$base";$full = $root . $::exe;$asm = $root . '.asm';$mapFile = "$root.prn";## Create Rules and Recipes to create the Program#my $me = MakeEntry::New (*MAKEFILE, $full );$me->AddComment ("Build Program: $name" );$me->AddName ( $mapFile ) if ( $map );$me->AddDependancy ( @source );$me->AddRecipe ( '$(AS)' );$me->Print();## Files to clean up#ToolsetGenerate( $mapFile );ToolsetGenerate( $asm );#.. Package up files that are a part of the program#PackageProgAddFiles ( $name, $full );PackageProgAddFiles ( $name, $mapFile, 'Class=map' ) if ( $map );}#.. Successful termination1;