Subversion Repositories DevTools

Rev

Rev 227 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

# -*- mode: perl; indent-width: 4; -*-
##############################################################################
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
#
# File:         PLATFORM/unix
#
# Contents:     Generic UNIX platform definition
#               The definitions of
#                   HOST_KERNEL
#                   HOST_CPU
#                   HOST_PROD
#                   HOST_FAM
#               must be provided before this file is 'Required'
#               Suitable definitions will the added to the build system
#
#               NOTE: The platform config file MUST provide the definitions
#                     This is not a suitable place to make the decisions
#
##############################################################################
#
#use strict;
use warnings;

UnixInit();

sub UnixInit
{
    #
    #   Sanity test
    #   'Unix' is not a PLATFORM that should be directly invoked
    #   It should only be invoked by a another platform that defines the
    #   required valies.
    #
    Error ("Unix platform: HOST_KERNEL has not been defined") unless (defined($HOST_KERNEL));
    Error ("Unix platform: HOST_CPU has not been defined")    unless ($HOST_CPU);
    Error ("Unix platform: HOST_PROD has not been defined")   unless (defined ($HOST_PROD));
    Error ("Unix platform: HOST_FAM has not been defined")    unless (defined (HOST_FAM));

    #.. Target defines
    #
    PlatformDefine( "#################################################");
    PlatformDefine( "# Building a UNIX application" );
    PlatformDefine( "#" );
    PlatformDefine( "HOST_KERNEL    = $HOST_KERNEL" );
    PlatformDefine( "HOST_CPU       = $HOST_CPU" );
    PlatformDefine( "HOST_PROD      = $HOST_PROD" );
    PlatformDefine( "HOST_FAM       = $HOST_FAM" );
    PlatformDefine( "" );

    #.. Order of directory search
    #       CPU, PROD, then FAMILY ...
    #
    AddFlags( '*',          "-DHOST_CPU=$HOST_CPU" );
    AddFlags( '*',          "-DHOST_$HOST_CPU" );
    AddDir( '*',            "$HOST_CPU", '--Local', '--NoWarn' );

    if ( "$HOST_PROD" ne "" ) {
        AddFlags( '*',      "-DHOST_PROD=$HOST_PROD" );
        AddFlags( '*',      "-DHOST_$HOST_PROD" );
        AddDir( '*',        "$HOST_PROD", '--Local', '--NoWarn' );
    }        

    AddFlags( '*',  "-DHOST_FAM=$HOST_FAM" );
    if ( "$HOST_PROD" ne "$HOST_FAM" ) {
        if ( "$HOST_FAM" ne "" ) {
            AddFlags( '*',  "-DHOST_$HOST_FAM" );
            AddDir( '*',    "$HOST_FAM", '--Local', '--NoWarn' );
        }            
    }
}

1;