1#----------------------------------------------------------------------------
2# Project:  Horizon
3# File:     platformdefs.om
4#
5# Copyright (C)2009-2011 Nintendo Co., Ltd.  All rights reserved.
6#
7# These coded instructions, statements, and computer programs contain
8# proprietary information of Nintendo of America Inc. and/or Nintendo
9# Company Ltd., and are protected by Federal copyright law. They may
10# not be disclosed to third parties or copied or duplicated in any form,
11# in whole or in part, without the prior written consent of Nintendo.
12#
13# $Rev: 40245 $
14#----------------------------------------------------------------------------
15
16#----------------------------------------------------------------------------
17# Class definitions
18#----------------------------------------------------------------------------
19
20PlatformManager. =
21    class PlatformManager
22
23    this.platforms[] = $(EMPTY)
24
25    new() =
26        Dump()
27        return $(this)
28
29    Add(spec) =
30        platforms += $(spec)
31        return $(this)
32
33    Select(targets) =
34        echo $(platforms.nth 1)
35        return $(if $(equal $(platforms.length),0),$(EMPTY),$(platforms.nth 1))
36
37    Dump() =
38        platforms.foreach(v)
39            println($"Platform: "$(v.Name))
40        return
41
42PlatformSpec.=
43    class PlatformSpec
44
45    this.platform_name = $(EMPTY)
46    this.compiler_type = $(EMPTY)
47    this.debugger_type = $(EMPTY)
48
49    new(pn, ct, dt) =
50        platform_name = $(pn)
51        compiler_type = $(ct)
52        debugger_type = $(dt)
53        return $(this)
54
55    Name() =
56        return $(this.platform_name)
57
58    GetCompilerType() =
59        return $(this.compiler_type)
60
61    GetDebuggerType() =
62        return $(this.debugger_type)
63
64
65global.RegisterPlatform(name) =
66    NN_PLATFORM_MANAGER = $(NN_PLATFORM_MANAGER.Add $(name))
67    export
68
69#----------------------------------------------------------------------------
70# Variable Definitions
71#----------------------------------------------------------------------------
72
73global.NN_PLATFORM_MANAGER = $(PlatformManager.new)
74
75
76
77#----------------------------------------------------------------------------
78# Load platform definitions
79#----------------------------------------------------------------------------
80
81foreach(om,$(ls i,$(ROOT_OMAKE)/platforms/*.om))
82    include $(removesuffix $(om))
83    export
84
85