Modified: trunk/reactos/Makefile
Modified: trunk/reactos/tools/rbuild/XML.h
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/proxymakefile.cpp
Modified: trunk/reactos/tools/rbuild/configuration.cpp
Modified: trunk/reactos/tools/rbuild/module.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.h
--- trunk/reactos/Makefile 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/Makefile 2005-06-05 15:59:18 UTC (rev 15808)
@@ -54,6 +54,7 @@
# -c Clean as you go. Delete generated files as soon as they are not needed anymore.
# -d Disable automatic dependencies.
# -mi Let make handle creation of install directories. Rbuild will not generate the directories.
+# -ps Generate proxy makefiles in source tree instead of the output tree.
.PHONY: all
.PHONY: clean
--- trunk/reactos/tools/rbuild/XML.h 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/XML.h 2005-06-05 15:59:18 UTC (rev 15808)
@@ -5,6 +5,8 @@
class XMLElement;
+extern std::string working_directory;
+
void
InitWorkingDirectory();
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-06-05 15:59:18 UTC (rev 15808)
@@ -645,12 +645,22 @@
printf ( "done\n" );
}
+string
+MingwBackend::GetProxyMakefileTree () const
+{
+ if ( configuration.GenerateProxyMakefilesInSourceTree )
+ return "";
+ else
+ return Environment::GetOutputPath ();
+}
+
void
MingwBackend::GenerateProxyMakefiles ()
{
printf ( "Generating proxy makefiles..." );
ProxyMakefile proxyMakefile ( ProjectNode );
- proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose );
+ proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose,
+ GetProxyMakefileTree () );
printf ( "done\n" );
}
@@ -929,8 +939,8 @@
NormalizeFilename ( module.GetPath () ),
outputDirectory );
OutputInstallTarget ( sourceFilename,
- module.installName,
- module.installBase );
+ module.installName,
+ module.installBase );
}
}
}
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-06-05 15:59:18 UTC (rev 15808)
@@ -83,6 +83,7 @@
std::string GetBin2ResExecutable ();
void UnpackWineResources ();
void GenerateTestSupportCode ();
+ std::string GetProxyMakefileTree () const;
void GenerateProxyMakefiles ();
void CheckAutomaticDependencies ();
bool IncludeDirectoryTarget ( const std::string& directory ) const;
@@ -122,12 +123,15 @@
public:
ProxyMakefile ( const Project& project );
~ProxyMakefile ();
- void GenerateProxyMakefiles ( bool verbose );
+ void GenerateProxyMakefiles ( bool verbose,
+ std::string outputTree );
private:
std::string GeneratePathToParentDirectory ( int numberOfParentDirectories );
std::string GetPathToTopDirectory ( Module& module );
+ bool GenerateProxyMakefile ( Module& module );
void GenerateProxyMakefileForModule ( Module& module,
- bool verbose );
+ bool verbose,
+ std::string outputTree );
const Project& project;
};
--- trunk/reactos/tools/rbuild/backend/mingw/proxymakefile.cpp 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/backend/mingw/proxymakefile.cpp 2005-06-05 15:59:18 UTC (rev 15808)
@@ -15,13 +15,26 @@
{
}
+bool
+ProxyMakefile::GenerateProxyMakefile ( Module& module )
+{
+ return module.GenerateInOutputTree ();
+}
+
void
-ProxyMakefile::GenerateProxyMakefiles ( bool verbose )
+ProxyMakefile::GenerateProxyMakefiles ( bool verbose,
+ string outputTree )
{
for ( size_t i = 0; i < project.modules.size (); i++ )
{
- GenerateProxyMakefileForModule ( *project.modules[i],
- verbose );
+ Module& module = *project.modules[i];
+ if ( !module.enabled )
+ continue;
+ if ( !GenerateProxyMakefile ( module ) )
+ continue;
+ GenerateProxyMakefileForModule ( module,
+ verbose,
+ outputTree );
}
}
@@ -53,7 +66,8 @@
void
ProxyMakefile::GenerateProxyMakefileForModule ( Module& module,
- bool verbose )
+ bool verbose,
+ string outputTree )
{
char* buf;
char* s;
@@ -64,8 +78,20 @@
module.name.c_str () );
}
- string proxyMakefile = NormalizeFilename ( module.GetBasePath () + SSEP "makefile" );
- string pathToTopDirectory = GetPathToTopDirectory ( module );
+ string base;
+ string pathToTopDirectory;
+ if ( outputTree.length () > 0 )
+ {
+ base = outputTree + SSEP + module.GetBasePath ();
+ Path path;
+ pathToTopDirectory = working_directory;
+ }
+ else
+ {
+ base = module.GetBasePath ();
+ pathToTopDirectory = GetPathToTopDirectory ( module );
+ }
+ string proxyMakefile = NormalizeFilename ( base + SSEP "makefile" );
string defaultTarget = module.name;
buf = (char*) malloc ( 10*1024 );
--- trunk/reactos/tools/rbuild/configuration.cpp 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/configuration.cpp 2005-06-05 15:59:18 UTC (rev 15808)
@@ -9,6 +9,7 @@
CleanAsYouGo = false;
AutomaticDependencies = true;
MakeHandlesInstallDirectories = false;
+ GenerateProxyMakefilesInSourceTree = false;
}
Configuration::~Configuration ()
--- trunk/reactos/tools/rbuild/module.cpp 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/module.cpp 2005-06-05 15:59:18 UTC (rev 15808)
@@ -667,6 +667,36 @@
__LINE__ );
}
+bool
+Module::GenerateInOutputTree () const
+{
+ switch ( type )
+ {
+ case Kernel:
+ case KernelModeDLL:
+ case NativeDLL:
+ case Win32DLL:
+ case KernelModeDriver:
+ case NativeCUI:
+ case Win32CUI:
+ case Test:
+ case Win32GUI:
+ case BuildTool:
+ case BootLoader:
+ case BootSector:
+ case Iso:
+ case LiveIso:
+ return true;
+ case StaticLibrary:
+ case ObjectLibrary:
+ case RpcServer:
+ case RpcClient:
+ return false;
+ }
+ throw InvalidOperationException ( __FILE__,
+ __LINE__ );
+}
+
string
Module::GetTargetName () const
{
--- trunk/reactos/tools/rbuild/rbuild.cpp 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/rbuild.cpp 2005-06-05 15:59:18 UTC (rev 15808)
@@ -37,6 +37,22 @@
}
bool
+ParseProxyMakefileSwitch ( char switchChar2 )
+{
+ switch ( switchChar2 )
+ {
+ case 's':
+ configuration.GenerateProxyMakefilesInSourceTree = true;
+ break;
+ default:
+ printf ( "Unknown switch -p%c",
+ switchChar2 );
+ return false;
+ }
+ return true;
+}
+
+bool
ParseSwitch ( int argc, char** argv, int index )
{
char switchChar = strlen ( argv[index] ) > 1 ? argv[index][1] : ' ';
@@ -57,6 +73,8 @@
break;
case 'm':
return ParseMakeSwitch ( switchChar2 );
+ case 'p':
+ return ParseProxyMakefileSwitch ( switchChar2 );
default:
printf ( "Unknown switch -%c",
switchChar );
@@ -98,6 +116,7 @@
printf ( " -d Disable automatic dependencies.\n" );
printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml.\n" );
printf ( " -mi Let make handle creation of install directories. Rbuild will not generate the directories.\n" );
+ printf ( " -ps Generate proxy makefiles in source tree instead of the output tree.\n" );
printf ( "\n" );
printf ( " buildsystem Target build system. Can be one of:\n" );
printf ( " mingw MinGW\n" );
--- trunk/reactos/tools/rbuild/rbuild.h 2005-06-05 15:50:55 UTC (rev 15807)
+++ trunk/reactos/tools/rbuild/rbuild.h 2005-06-05 15:59:18 UTC (rev 15808)
@@ -77,6 +77,7 @@
bool CleanAsYouGo;
bool AutomaticDependencies;
bool MakeHandlesInstallDirectories;
+ bool GenerateProxyMakefilesInSourceTree;
};
class Environment
@@ -222,6 +223,7 @@
const XMLAttribute& attribute );
bool HasImportLibrary () const;
bool IsDLL () const;
+ bool GenerateInOutputTree () const;
std::string GetTargetName () const;
std::string GetDependencyPath () const;
std::string GetBasePath () const;