Added support for ROS_AUTOMAKE variable.
[reactos.git] / reactos / tools / rbuild / bootstrap.cpp
1 /*
2 * Copyright (C) 2005 Casper S. Hornstrup
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 #include "pch.h"
19 #include <assert.h>
20
21 #include "rbuild.h"
22
23 using std::string;
24
25 Bootstrap::Bootstrap ( const Project& project_,
26 const Module* module_,
27 const XMLElement& bootstrapNode )
28 : project(project_),
29 module(module_),
30 node(bootstrapNode)
31 {
32 Initialize();
33 }
34
35 Bootstrap::~Bootstrap ()
36 {
37 }
38
39 bool
40 Bootstrap::IsSupportedModuleType ( ModuleType type )
41 {
42 switch ( type )
43 {
44 case Kernel:
45 case KernelModeDLL:
46 case NativeDLL:
47 case NativeCUI:
48 case Win32DLL:
49 case Win32CUI:
50 case Win32GUI:
51 case KernelModeDriver:
52 case BootSector:
53 case BootLoader:
54 case BootProgram:
55 return true;
56 case BuildTool:
57 case StaticLibrary:
58 case ObjectLibrary:
59 case Iso:
60 case LiveIso:
61 case Test:
62 case RpcServer:
63 case RpcClient:
64 case Alias:
65 return false;
66 }
67 throw InvalidOperationException ( __FILE__,
68 __LINE__ );
69 }
70
71 void
72 Bootstrap::Initialize ()
73 {
74 if ( !IsSupportedModuleType ( module->type ) )
75 {
76 throw XMLInvalidBuildFileException (
77 node.location,
78 "<bootstrap> is not applicable for this module type." );
79 }
80
81 const XMLAttribute* att = node.GetAttribute ( "base", false );
82 if ( att != NULL )
83 base = att->value;
84 else
85 base = "";
86
87 att = node.GetAttribute ( "nameoncd", false );
88 if ( att != NULL )
89 nameoncd = att->value;
90 else
91 nameoncd = module->GetTargetName ();
92 }
93
94 void
95 Bootstrap::ProcessXML()
96 {
97 }