mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Generate make rules for creating directories if they don't exist
svn path=/branches/xmlbuildsystem/; revision=15244
This commit is contained in:
parent
d927b8d8fe
commit
9c85c4d513
3 changed files with 68 additions and 4 deletions
|
@ -179,7 +179,7 @@ Directory::GenerateTree ( const string& parent,
|
|||
{
|
||||
string path;
|
||||
|
||||
if ( parent.size() )
|
||||
if ( parent.size () > 0 )
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
|
@ -191,11 +191,62 @@ Directory::GenerateTree ( const string& parent,
|
|||
else
|
||||
path = name;
|
||||
|
||||
for ( directory_map::iterator i = subdirs.begin ();
|
||||
i != subdirs.end ();
|
||||
++i )
|
||||
{
|
||||
i->second->GenerateTree ( path, verbose );
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
Directory::EscapeSpaces ( string path )
|
||||
{
|
||||
string newpath;
|
||||
char* p = &path[0];
|
||||
while ( *p != 0 )
|
||||
{
|
||||
if ( *p == ' ' )
|
||||
newpath = newpath + "\\ ";
|
||||
else
|
||||
newpath = newpath + *p;
|
||||
*p++;
|
||||
}
|
||||
return newpath;
|
||||
}
|
||||
|
||||
void
|
||||
Directory::CreateRule ( FILE* f,
|
||||
const string& parent )
|
||||
{
|
||||
string path;
|
||||
|
||||
if ( parent.size() > 0 )
|
||||
{
|
||||
string escapedParent = EscapeSpaces ( parent );
|
||||
fprintf ( f,
|
||||
"%s%c%s: | %s\n",
|
||||
escapedParent.c_str (),
|
||||
CSEP,
|
||||
EscapeSpaces ( name ).c_str (),
|
||||
escapedParent.c_str () );
|
||||
|
||||
fprintf ( f,
|
||||
"\t$(ECHO_MKDIR)\n" );
|
||||
|
||||
fprintf ( f,
|
||||
"\t${mkdir} $@\n" );
|
||||
|
||||
path = parent + SSEP + name;
|
||||
}
|
||||
else
|
||||
path = name;
|
||||
|
||||
for ( directory_map::iterator i = subdirs.begin();
|
||||
i != subdirs.end();
|
||||
++i )
|
||||
{
|
||||
i->second->GenerateTree ( path, verbose );
|
||||
i->second->CreateRule ( f, path );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,6 +353,7 @@ MingwBackend::Process ()
|
|||
GenerateXmlBuildFilesMacro ();
|
||||
ProcessModules ();
|
||||
GenerateInstallTarget ();
|
||||
GenerateDirectoryTargets ();
|
||||
GenerateDirectories ();
|
||||
CheckAutomaticDependencies ();
|
||||
CloseMakefile ();
|
||||
|
@ -723,7 +775,7 @@ MingwBackend::OutputInstallTarget ( const string& sourceFilename,
|
|||
NormalizeFilename ( targetDirectory ),
|
||||
installDirectory );
|
||||
fprintf ( fMakefile,
|
||||
"%s: %s %s\n",
|
||||
"%s: %s | %s\n",
|
||||
normalizedTargetFilename.c_str (),
|
||||
sourceFilename.c_str (),
|
||||
normalizedTargetDirectory.c_str () );
|
||||
|
@ -832,3 +884,11 @@ MingwBackend::GenerateInstallTarget ()
|
|||
fprintf ( fMakefile,
|
||||
"\n" );
|
||||
}
|
||||
|
||||
void
|
||||
MingwBackend::GenerateDirectoryTargets ()
|
||||
{
|
||||
intermediateDirectory->CreateRule ( fMakefile, "" );
|
||||
outputDirectory->CreateRule ( fMakefile, "" );
|
||||
installDirectory->CreateRule ( fMakefile, "" );
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ public:
|
|||
void Add ( const char* subdir );
|
||||
void GenerateTree ( const std::string& parent,
|
||||
bool verbose );
|
||||
std::string EscapeSpaces ( std::string path );
|
||||
void CreateRule ( FILE* f,
|
||||
const std::string& parent );
|
||||
private:
|
||||
bool mkdir_p ( const char* path );
|
||||
std::string ReplaceVariable ( std::string name,
|
||||
|
@ -105,6 +108,7 @@ private:
|
|||
std::string GetRegistryTargetFiles ();
|
||||
void OutputRegistryInstallTarget ();
|
||||
void GenerateInstallTarget ();
|
||||
void GenerateDirectoryTargets ();
|
||||
FILE* fMakefile;
|
||||
bool use_pch;
|
||||
};
|
||||
|
|
|
@ -129,7 +129,7 @@ MingwModuleHandler::GetTargetFilename (
|
|||
{
|
||||
string target = PassThruCacheDirectory (
|
||||
NormalizeFilename ( module.GetPath () ),
|
||||
backend->intermediateDirectory );
|
||||
GetTargetDirectoryTree ( module ) );
|
||||
if ( pclean_files )
|
||||
{
|
||||
string_list& clean_files = *pclean_files;
|
||||
|
|
Loading…
Reference in a new issue