Generate proxy makefiles in output tree.

svn path=/trunk/; revision=15808
This commit is contained in:
Casper Hornstrup 2005-06-05 15:59:18 +00:00
parent 4c7bbd9c39
commit 2163a01133
9 changed files with 106 additions and 11 deletions

View file

@ -54,6 +54,7 @@
# -c Clean as you go. Delete generated files as soon as they are not needed anymore. # -c Clean as you go. Delete generated files as soon as they are not needed anymore.
# -d Disable automatic dependencies. # -d Disable automatic dependencies.
# -mi Let make handle creation of install directories. Rbuild will not generate the directories. # -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: all
.PHONY: clean .PHONY: clean

View file

@ -5,6 +5,8 @@
class XMLElement; class XMLElement;
extern std::string working_directory;
void void
InitWorkingDirectory(); InitWorkingDirectory();

View file

@ -645,12 +645,22 @@ MingwBackend::GenerateTestSupportCode ()
printf ( "done\n" ); printf ( "done\n" );
} }
string
MingwBackend::GetProxyMakefileTree () const
{
if ( configuration.GenerateProxyMakefilesInSourceTree )
return "";
else
return Environment::GetOutputPath ();
}
void void
MingwBackend::GenerateProxyMakefiles () MingwBackend::GenerateProxyMakefiles ()
{ {
printf ( "Generating proxy makefiles..." ); printf ( "Generating proxy makefiles..." );
ProxyMakefile proxyMakefile ( ProjectNode ); ProxyMakefile proxyMakefile ( ProjectNode );
proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose ); proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose,
GetProxyMakefileTree () );
printf ( "done\n" ); printf ( "done\n" );
} }
@ -929,8 +939,8 @@ MingwBackend::OutputModuleInstallTargets ()
NormalizeFilename ( module.GetPath () ), NormalizeFilename ( module.GetPath () ),
outputDirectory ); outputDirectory );
OutputInstallTarget ( sourceFilename, OutputInstallTarget ( sourceFilename,
module.installName, module.installName,
module.installBase ); module.installBase );
} }
} }
} }

View file

@ -83,6 +83,7 @@ private:
std::string GetBin2ResExecutable (); std::string GetBin2ResExecutable ();
void UnpackWineResources (); void UnpackWineResources ();
void GenerateTestSupportCode (); void GenerateTestSupportCode ();
std::string GetProxyMakefileTree () const;
void GenerateProxyMakefiles (); void GenerateProxyMakefiles ();
void CheckAutomaticDependencies (); void CheckAutomaticDependencies ();
bool IncludeDirectoryTarget ( const std::string& directory ) const; bool IncludeDirectoryTarget ( const std::string& directory ) const;
@ -122,12 +123,15 @@ class ProxyMakefile
public: public:
ProxyMakefile ( const Project& project ); ProxyMakefile ( const Project& project );
~ProxyMakefile (); ~ProxyMakefile ();
void GenerateProxyMakefiles ( bool verbose ); void GenerateProxyMakefiles ( bool verbose,
std::string outputTree );
private: private:
std::string GeneratePathToParentDirectory ( int numberOfParentDirectories ); std::string GeneratePathToParentDirectory ( int numberOfParentDirectories );
std::string GetPathToTopDirectory ( Module& module ); std::string GetPathToTopDirectory ( Module& module );
bool GenerateProxyMakefile ( Module& module );
void GenerateProxyMakefileForModule ( Module& module, void GenerateProxyMakefileForModule ( Module& module,
bool verbose ); bool verbose,
std::string outputTree );
const Project& project; const Project& project;
}; };

View file

@ -15,13 +15,26 @@ ProxyMakefile::~ProxyMakefile ()
{ {
} }
bool
ProxyMakefile::GenerateProxyMakefile ( Module& module )
{
return module.GenerateInOutputTree ();
}
void void
ProxyMakefile::GenerateProxyMakefiles ( bool verbose ) ProxyMakefile::GenerateProxyMakefiles ( bool verbose,
string outputTree )
{ {
for ( size_t i = 0; i < project.modules.size (); i++ ) for ( size_t i = 0; i < project.modules.size (); i++ )
{ {
GenerateProxyMakefileForModule ( *project.modules[i], Module& module = *project.modules[i];
verbose ); if ( !module.enabled )
continue;
if ( !GenerateProxyMakefile ( module ) )
continue;
GenerateProxyMakefileForModule ( module,
verbose,
outputTree );
} }
} }
@ -53,7 +66,8 @@ ProxyMakefile::GetPathToTopDirectory ( Module& module )
void void
ProxyMakefile::GenerateProxyMakefileForModule ( Module& module, ProxyMakefile::GenerateProxyMakefileForModule ( Module& module,
bool verbose ) bool verbose,
string outputTree )
{ {
char* buf; char* buf;
char* s; char* s;
@ -64,8 +78,20 @@ ProxyMakefile::GenerateProxyMakefileForModule ( Module& module,
module.name.c_str () ); module.name.c_str () );
} }
string proxyMakefile = NormalizeFilename ( module.GetBasePath () + SSEP "makefile" ); string base;
string pathToTopDirectory = GetPathToTopDirectory ( module ); 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; string defaultTarget = module.name;
buf = (char*) malloc ( 10*1024 ); buf = (char*) malloc ( 10*1024 );

View file

@ -9,6 +9,7 @@ Configuration::Configuration ()
CleanAsYouGo = false; CleanAsYouGo = false;
AutomaticDependencies = true; AutomaticDependencies = true;
MakeHandlesInstallDirectories = false; MakeHandlesInstallDirectories = false;
GenerateProxyMakefilesInSourceTree = false;
} }
Configuration::~Configuration () Configuration::~Configuration ()

View file

@ -667,6 +667,36 @@ Module::IsDLL () const
__LINE__ ); __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 string
Module::GetTargetName () const Module::GetTargetName () const
{ {

View file

@ -36,6 +36,22 @@ ParseMakeSwitch ( char switchChar2 )
return true; return true;
} }
bool
ParseProxyMakefileSwitch ( char switchChar2 )
{
switch ( switchChar2 )
{
case 's':
configuration.GenerateProxyMakefilesInSourceTree = true;
break;
default:
printf ( "Unknown switch -p%c",
switchChar2 );
return false;
}
return true;
}
bool bool
ParseSwitch ( int argc, char** argv, int index ) ParseSwitch ( int argc, char** argv, int index )
{ {
@ -57,6 +73,8 @@ ParseSwitch ( int argc, char** argv, int index )
break; break;
case 'm': case 'm':
return ParseMakeSwitch ( switchChar2 ); return ParseMakeSwitch ( switchChar2 );
case 'p':
return ParseProxyMakefileSwitch ( switchChar2 );
default: default:
printf ( "Unknown switch -%c", printf ( "Unknown switch -%c",
switchChar ); switchChar );
@ -98,6 +116,7 @@ main ( int argc, char** argv )
printf ( " -d Disable automatic dependencies.\n" ); printf ( " -d Disable automatic dependencies.\n" );
printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml.\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 ( " -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 ( "\n" );
printf ( " buildsystem Target build system. Can be one of:\n" ); printf ( " buildsystem Target build system. Can be one of:\n" );
printf ( " mingw MinGW\n" ); printf ( " mingw MinGW\n" );

View file

@ -77,6 +77,7 @@ public:
bool CleanAsYouGo; bool CleanAsYouGo;
bool AutomaticDependencies; bool AutomaticDependencies;
bool MakeHandlesInstallDirectories; bool MakeHandlesInstallDirectories;
bool GenerateProxyMakefilesInSourceTree;
}; };
class Environment class Environment
@ -222,6 +223,7 @@ public:
const XMLAttribute& attribute ); const XMLAttribute& attribute );
bool HasImportLibrary () const; bool HasImportLibrary () const;
bool IsDLL () const; bool IsDLL () const;
bool GenerateInOutputTree () const;
std::string GetTargetName () const; std::string GetTargetName () const;
std::string GetDependencyPath () const; std::string GetDependencyPath () const;
std::string GetBasePath () const; std::string GetBasePath () const;