Added support for ROS_AUTOMAKE variable.
Added support for <if> <module ...> </if>
Added BootProgram target type
Added simple initial ReactOS-ppc.xml, using my egcs compiler
More work required, but getting there
Added: trunk/reactos/ReactOS-ppc.xml
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.h
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
Modified: trunk/reactos/tools/rbuild/bootstrap.cpp
Modified: trunk/reactos/tools/rbuild/define.cpp
Modified: trunk/reactos/tools/rbuild/module.cpp
Modified: trunk/reactos/tools/rbuild/project.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/tools/rbuild/rbuild.mak
_____
Added: trunk/reactos/ReactOS-ppc.xml
--- trunk/reactos/ReactOS-ppc.xml 2005-12-04 12:02:21 UTC (rev
19853)
+++ trunk/reactos/ReactOS-ppc.xml 2005-12-04 12:02:45 UTC (rev
19854)
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
+<project name="ReactOS" makefile="makefile.ppc"
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="config-ppc.xml">
+ <xi:fallback>
+ <xi:include href="config.template.xml" />
+ </xi:fallback>
+ </xi:include>
+
+ <xi:include href="baseaddress.xml" />
+
+ <property name="BOOTPROG_PREPARE" value="ppc-le2be" />
+ <property name="BOOTPROG_FLATFORMAT" value="-O elf32-powerpc -B
powerpc:common" />
+ <property name="BOOTPROG_LINKFORMAT" value="-melf32ppc
--no-omagic -Ttext 0xe00000 -Tdata 0xe10000" />
+ <property name="BOOTPROG_COPYFORMAT" value="--only-section=.text
--only-section=.data --only-section=.bss -O aixcoff-rs6000" />
+
+ <define name="_M_PPC" />
+ <define name="_PPC_" />
+ <define name="__PowerPC__" />
+ <define name="_REACTOS_" />
+ <define name="__MINGW_IMPORT" empty="true" />
+ <define name="__restrict__" empty="true" />
+ <compilerflag>-v</compilerflag>
+ <if property="MP" value="1">
+ <define name="CONFIG_SMP" value="1" />
+ </if>
+ <if property="DBG" value="1">
+ <define name="DBG" value="1" />
+ <property name="DBG_OR_KDBG" value="true" />
+ </if>
+ <if property="DBG" value="0">
+ <compilerflag>-Os</compilerflag>
+ <compilerflag>-Wno-strict-aliasing</compilerflag>
+ </if>
+ <if property="KDBG" value="1">
+ <define name="KDBG" value="1" />
+ <property name="DBG_OR_KDBG" value="true" />
+ </if>
+ <compilerflag>-Wpointer-arith</compilerflag>
+
+ <include>.</include>
+ <include>include</include>
+ <include>include/reactos</include>
+ <include>include/libs</include>
+ <include>include/drivers</include>
+ <include>include/subsys</include>
+ <include>include/ndk</include>
+ <include>w32api/include</include>
+ <include>w32api/include/crt</include>
+ <include>w32api/include/ddk</include>
+
+ <directory name="apps">
+ <xi:include href="apps/directory.xml" />
+ </directory>
+ <directory name="boot">
+ <xi:include href="boot/boot.xml" />
+ </directory>
+ <directory name="bootdata">
+ <xi:include href="bootdata/bootdata.xml" />
+ </directory>
+ <directory name="drivers">
+ <xi:include href="drivers/directory.xml" />
+ </directory>
+ <directory name="hal">
+ <xi:include href="hal/directory.xml" />
+ </directory>
+ <directory name="include">
+ <xi:include href="include/directory.xml" />
+ </directory>
+ <directory name="lib">
+ <xi:include href="lib/directory.xml" />
+ </directory>
+ <directory name="media">
+ <xi:include href="media/directory.xml" />
+ </directory>
+ <directory name="modules">
+ <xi:include href="modules/directory.xml" />
+ </directory>
+ <directory name="ntoskrnl">
+ <xi:include href="ntoskrnl/ntoskrnl.xml" />
+ </directory>
+ <directory name="regtests">
+ <xi:include href="regtests/directory.xml" />
+ </directory>
+ <directory name="services">
+ <xi:include href="services/directory.xml" />
+ </directory>
+ <directory name="subsys">
+ <xi:include href="subsys/directory.xml" />
+ </directory>
+</project>
_____
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-12-04
12:02:21 UTC (rev 19853)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-12-04
12:02:45 UTC (rev 19854)
@@ -71,6 +71,7 @@
MingwBackend::MingwBackend ( Project& project,
Configuration& configuration )
: Backend ( project, configuration ),
+ manualBinutilsSetting( false ),
intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ),
outputDirectory ( new Directory ( "$(OUTPUT)" ) ),
installDirectory ( new Directory ( "$(INSTALL)" ) )
@@ -137,6 +138,7 @@
vector<MingwModuleHandler*> v;
size_t i;
+
for ( i = 0; i < ProjectNode.modules.size (); i++ )
{
Module& module = *ProjectNode.modules[i];
@@ -752,6 +754,7 @@
bool
MingwBackend::IsSupportedBinutilsVersion ( const string&
binutilsVersion )
{
+ if ( manualBinutilsSetting ) return true;
if ( ( ( strcmp ( binutilsVersion.c_str (), "20040902") >= 0 )
&&
( strcmp ( binutilsVersion.c_str (), "20041008") <= 0 ) )
||
( strcmp ( binutilsVersion.c_str (), "20031001") < 0 ) )
@@ -767,11 +770,13 @@
bool detectedBinutils = false;
const string& ROS_PREFIXValue = Environment::GetVariable (
"ROS_PREFIX" );
+
if ( ROS_PREFIXValue.length () > 0 )
{
binutilsPrefix = ROS_PREFIXValue;
binutilsCommand = binutilsPrefix + "-ld";
- detectedBinutils = TryToDetectThisBinutils (
binutilsCommand );
+ manualBinutilsSetting = true;
+ detectedBinutils = true;
}
#if defined(WIN32)
if ( !detectedBinutils )
@@ -802,6 +807,7 @@
}
else
printf ( "not detected\n" );
+
}
void
_____
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.h
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-12-04
12:02:21 UTC (rev 19853)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-12-04
12:02:45 UTC (rev 19854)
@@ -48,7 +48,7 @@
std::string nasmCommand;
std::string binutilsPrefix;
std::string binutilsCommand;
- bool usePipe;
+ bool usePipe, manualBinutilsSetting;
Directory* intermediateDirectory;
Directory* outputDirectory;
Directory* installDirectory;
_____
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
2005-12-04 12:02:21 UTC (rev 19853)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
2005-12-04 12:02:45 UTC (rev 19854)
@@ -230,6 +230,9 @@
case BootSector:
handler = new MingwBootSectorModuleHandler (
module );
break;
+ case BootProgram:
+ handler = new MingwBootProgramModuleHandler (
module );
+ break;
case Iso:
handler = new MingwIsoModuleHandler ( module );
break;
@@ -2704,6 +2707,69 @@
}
+MingwBootProgramModuleHandler::MingwBootProgramModuleHandler (
+ const Module& module_ )
+ : MingwModuleHandler ( module_ )
+{
+}
+
+void
+MingwBootProgramModuleHandler::Process ()
+{
+ GenerateBootProgramModuleTarget ();
+}
+
+void
+MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget ()
+{
+ string targetName ( module.GetTargetName () );
+ string targetMacro ( GetTargetMacro (module) );
+ string workingDirectory = GetWorkingDirectory ();
+ string junk_tmp = ros_temp + module.name + ".junk.tmp";
+ string junk_elf = ros_temp + module.name + ".junk.elf";
+ string junk_cpy = ros_temp + module.name + ".junk.cpy";
+ CLEAN_FILE ( junk_tmp );
+ CLEAN_FILE ( junk_elf );
+ CLEAN_FILE ( junk_cpy );
+ string objectsMacro = GetObjectsMacro ( module );
+ string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
+ const Module *payload = module.project.LocateModule (
module.payload );
+
+ GenerateRules ();
+
+ fprintf ( fMakefile, "%s: %s %s %s | %s\n",
+ targetMacro.c_str (),
+ objectsMacro.c_str (),
+ linkDepsMacro.c_str (),
+ payload->name.c_str (),
+ GetDirectory(GetTargetFilename(module,NULL)).c_str ()
);
+
+ fprintf ( fMakefile, "\t$(ECHO_BOOTPROG)\n" );
+
+ fprintf ( fMakefile, "\t$(BOOTPROG_PREPARE) $(OUTPUT)$(SEP)%s
%s\n",
+ NormalizeFilename( payload->GetPath() ).c_str (),
+ junk_cpy.c_str () );
+
+ fprintf ( fMakefile, "\t${objcopy} $(BOOTPROG_FLATFORMAT) %s
%s\n",
+ junk_cpy.c_str (),
+ junk_tmp.c_str () );
+
+ fprintf ( fMakefile, "\t${ld} $(BOOTPROG_LINKFORMAT) %s %s -g -o
%s\n",
+ linkDepsMacro.c_str (),
+ junk_tmp.c_str (),
+ junk_elf.c_str () );
+
+ fprintf ( fMakefile, "\t${objcopy} $(BOOTPROG_COPYFORMAT) %s
%s\n",
+ junk_elf.c_str (),
+ module.GetPath().c_str () );
+
+ fprintf ( fMakefile,
+ "\t-@${rm} %s %s %s 2>$(NUL)\n",
+ junk_tmp.c_str (), junk_elf.c_str (), junk_cpy.c_str
() );
+}
+
+
MingwIsoModuleHandler::MingwIsoModuleHandler (
const Module& module_ )
_____
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
2005-12-04 12:02:21 UTC (rev 19853)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
2005-12-04 12:02:45 UTC (rev 19854)
@@ -375,6 +375,19 @@
};
+class MingwBootProgramModuleHandler : public MingwModuleHandler
+{
+public:
+ MingwBootProgramModuleHandler ( const Module& module );
+ virtual HostType DefaultHost() { return HostFalse; }
+ virtual void Process ();
+ std::string GetProgTextAddrMacro ();
+ std::string TypeSpecificLinkerFlags() { return "-nostartfiles
-nostdlib"; }
+private:
+ void GenerateBootProgramModuleTarget ();
+};
+
+
class MingwIsoModuleHandler : public MingwModuleHandler
{
public:
_____
Modified: trunk/reactos/tools/rbuild/bootstrap.cpp
--- trunk/reactos/tools/rbuild/bootstrap.cpp 2005-12-04 12:02:21 UTC
(rev 19853)
+++ trunk/reactos/tools/rbuild/bootstrap.cpp 2005-12-04 12:02:45 UTC
(rev 19854)
@@ -51,6 +51,7 @@
case KernelModeDriver:
case BootSector:
case BootLoader:
+ case BootProgram:
return true;
case BuildTool:
case StaticLibrary:
_____
Modified: trunk/reactos/tools/rbuild/define.cpp
--- trunk/reactos/tools/rbuild/define.cpp 2005-12-04 12:02:21 UTC
(rev 19853)
+++ trunk/reactos/tools/rbuild/define.cpp 2005-12-04 12:02:45 UTC
(rev 19854)
@@ -50,9 +50,11 @@
Define::Initialize()
{
const XMLAttribute* att = node.GetAttribute ( "name", true );
+ const XMLAttribute* empty = node.GetAttribute ( "empty", false
);
assert(att);
name = att->value;
value = node.value;
+ if( empty ) value = " ";
}
void
_____
Modified: trunk/reactos/tools/rbuild/module.cpp
--- trunk/reactos/tools/rbuild/module.cpp 2005-12-04 12:02:21 UTC
(rev 19853)
+++ trunk/reactos/tools/rbuild/module.cpp 2005-12-04 12:02:45 UTC
(rev 19854)
@@ -195,6 +195,13 @@
return filename;
}
+void IfableData::ExtractModules( std::vector<Module*> &modules )
+{
+ size_t i;
+ for ( i = 0; i < this->modules.size (); i++ )
+ modules.push_back(this->modules[i]);
+}
+
IfableData::~IfableData()
{
size_t i;
@@ -208,6 +215,8 @@
delete properties[i];
for ( i = 0; i < compilerFlags.size (); i++ )
delete compilerFlags[i];
+ for ( i = 0; i < modules.size(); i++ )
+ delete modules[i];
for ( i = 0; i < ifs.size (); i++ )
delete ifs[i];
for ( i = 0; i < compilationUnits.size (); i++ )
@@ -388,6 +397,12 @@
aliasedModuleName = att->value;
else
aliasedModuleName = "";
+
+ if ( type == BootProgram )
+ {
+ att = moduleNode.GetAttribute ( "payload", true );
+ payload = att->value;
+ }
}
Module::~Module ()
@@ -732,6 +747,8 @@
return BootLoader;
if ( attribute.value == "bootsector" )
return BootSector;
+ if ( attribute.value == "bootprogram" )
+ return BootProgram;
if ( attribute.value == "iso" )
return Iso;
if ( attribute.value == "liveiso" )
@@ -785,6 +802,8 @@
return ".o";
case Alias:
return "";
+ case BootProgram:
+ return "";
}
throw InvalidOperationException ( __FILE__,
__LINE__ );
@@ -828,6 +847,7 @@
case RpcServer:
case RpcClient:
case Alias:
+ case BootProgram:
return "";
}
throw InvalidOperationException ( __FILE__,
@@ -863,6 +883,7 @@
case RpcServer:
case RpcClient:
case Alias:
+ case BootProgram:
return "";
}
throw InvalidOperationException ( __FILE__,
@@ -895,6 +916,7 @@
case ObjectLibrary:
case BootLoader:
case BootSector:
+ case BootProgram:
case Iso:
case LiveIso:
case RpcServer:
@@ -923,6 +945,7 @@
case BuildTool:
case BootLoader:
case BootSector:
+ case BootProgram:
case Iso:
case LiveIso:
return true;
@@ -1289,6 +1312,7 @@
void
If::ProcessXML()
{
+
}
@@ -1358,6 +1382,7 @@
case KernelModeDriver:
case BootSector:
case BootLoader:
+ case BootProgram:
case BuildTool:
case StaticLibrary:
case ObjectLibrary:
_____
Modified: trunk/reactos/tools/rbuild/project.cpp
--- trunk/reactos/tools/rbuild/project.cpp 2005-12-04 12:02:21 UTC
(rev 19853)
+++ trunk/reactos/tools/rbuild/project.cpp 2005-12-04 12:02:45 UTC
(rev 19854)
@@ -97,8 +97,10 @@
size_t i;
if ( _backend )
delete _backend;
+#ifdef NOT_NEEDED_SINCE_THESE_ARE_CLEANED_BY_IFABLE_DATA
for ( i = 0; i < modules.size (); i++ )
delete modules[i];
+#endif
for ( i = 0; i < linkerFlags.size (); i++ )
delete linkerFlags[i];
for ( i = 0; i < cdfiles.size (); i++ )
@@ -225,6 +227,7 @@
void
Project::ExecuteInvocations ()
{
+ fprintf( stderr, "ExecuteInvocations\n" );
for ( size_t i = 0; i < modules.size (); i++ )
modules[i]->InvokeModule ();
}
@@ -277,11 +280,29 @@
ParseContext parseContext;
ProcessXMLSubElement ( *node->subElements[i], path,
parseContext );
}
+
+ non_if_data.ProcessXML ();
+
+ non_if_data.ExtractModules( modules );
+
+ for ( i = 0; i < non_if_data.ifs.size (); i++ )
+ {
+ const Property *property =
+ LookupProperty( non_if_data.ifs[i]->property );
+
+ if( !property ) continue;
+
+ bool conditionTrue =
+ (non_if_data.ifs[i]->negated &&
+ (property->value != non_if_data.ifs[i]->value))
||
+ (property->value == non_if_data.ifs[i]->value);
+ if ( conditionTrue )
+ non_if_data.ifs[i]->data.ExtractModules( modules
);
+ }
+ for ( i = 0; i < linkerFlags.size (); i++ )
+ linkerFlags[i]->ProcessXML ();
for ( i = 0; i < modules.size (); i++ )
modules[i]->ProcessXML ();
- for ( i = 0; i < linkerFlags.size (); i++ )
- linkerFlags[i]->ProcessXML ();
- non_if_data.ProcessXML ();
for ( i = 0; i < cdfiles.size (); i++ )
cdfiles[i]->ProcessXML ();
for ( i = 0; i < installfiles.size (); i++ )
@@ -294,13 +315,11 @@
ParseContext& parseContext )
{
bool subs_invalid = false;
+ If* pOldIf = parseContext.ifData;
+
string subpath(path);
if ( e.name == "module" )
{
- if ( parseContext.ifData )
- throw XMLInvalidBuildFileException (
- e.location,
- "<module> is not a valid sub-element of
<if>" );
Module* module = new Module ( *this, e, path );
if ( LocateModule ( module->name ) )
throw XMLInvalidBuildFileException (
@@ -308,7 +327,10 @@
"module name conflict: '%s' (originally
defined at %s)",
module->name.c_str(),
module->node.location.c_str() );
- modules.push_back ( module );
+ if ( parseContext.ifData )
+ parseContext.ifData->data.modules.push_back( module
);
+ else
+ non_if_data.modules.push_back ( module );
return; // defer processing until later
}
else if ( e.name == "cdfile" )
@@ -363,7 +385,6 @@
}
else if ( e.name == "if" )
{
- If* pOldIf = parseContext.ifData;
parseContext.ifData = new If ( e, *this, NULL );
if ( pOldIf )
pOldIf->data.ifs.push_back ( parseContext.ifData
);
@@ -373,7 +394,6 @@
}
else if ( e.name == "ifnot" )
{
- If* pOldIf = parseContext.ifData;
parseContext.ifData = new If ( e, *this, NULL, true );
if ( pOldIf )
pOldIf->data.ifs.push_back ( parseContext.ifData
);
@@ -398,6 +418,8 @@
}
for ( size_t i = 0; i < e.subElements.size (); i++ )
ProcessXMLSubElement ( *e.subElements[i], subpath,
parseContext );
+
+ parseContext.ifData = pOldIf;
}
Module*
_____
Modified: trunk/reactos/tools/rbuild/rbuild.h
--- trunk/reactos/tools/rbuild/rbuild.h 2005-12-04 12:02:21 UTC (rev
19853)
+++ trunk/reactos/tools/rbuild/rbuild.h 2005-12-04 12:02:45 UTC (rev
19854)
@@ -183,11 +183,13 @@
std::vector<Define*> defines;
std::vector<Library*> libraries;
std::vector<Property*> properties;
+ std::vector<Module*> modules;
std::vector<CompilerFlag*> compilerFlags;
std::vector<If*> ifs;
~IfableData();
void ProcessXML();
+ void ExtractModules( std::vector<Module*> &modules );
};
class Project
@@ -200,10 +202,10 @@
std::string name;
std::string makefile;
XMLIncludes xmlbuildfiles;
- std::vector<Module*> modules;
std::vector<LinkerFlag*> linkerFlags;
std::vector<CDFile*> cdfiles;
std::vector<InstallFile*> installfiles;
+ std::vector<Module*> modules;
IfableData non_if_data;
Project ( const Configuration& configuration,
@@ -258,7 +260,8 @@
Test = 15,
RpcServer = 16,
RpcClient = 17,
- Alias = 18
+ Alias = 18,
+ BootProgram = 19
};
enum HostType
@@ -279,6 +282,7 @@
std::string extension;
std::string entrypoint;
std::string baseaddress;
+ std::string payload;
std::string path;
ModuleType type;
ImportLibrary* importLibrary;
_____
Modified: trunk/reactos/tools/rbuild/rbuild.mak
--- trunk/reactos/tools/rbuild/rbuild.mak 2005-12-04 12:02:21 UTC
(rev 19853)
+++ trunk/reactos/tools/rbuild/rbuild.mak 2005-12-04 12:02:45 UTC
(rev 19854)
@@ -254,6 +254,7 @@
.PHONY: rbuild
rbuild: $(RBUILD_TARGET)
+host_gpp += -g
$(RBUILD_TARGET): $(RBUILD_OBJECTS) $(XML_SSPRINTF_OBJECTS)
$(INFLIB_HOST_OBJECTS) | $(RBUILD_OUT)
$(ECHO_LD)