--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-05-12 19:31:10 UTC (rev 15243)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-05-12 19:32:15 UTC (rev 15244)
@@ -179,7 +179,7 @@
{
string path;
- if ( parent.size() )
+ if ( parent.size () > 0 )
{
char buf[256];
@@ -191,11 +191,62 @@
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 @@
GenerateXmlBuildFilesMacro ();
ProcessModules ();
GenerateInstallTarget ();
+ GenerateDirectoryTargets ();
GenerateDirectories ();
CheckAutomaticDependencies ();
CloseMakefile ();
@@ -723,7 +775,7 @@
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 @@
fprintf ( fMakefile,
"\n" );
}
+
+void
+MingwBackend::GenerateDirectoryTargets ()
+{
+ intermediateDirectory->CreateRule ( fMakefile, "" );
+ outputDirectory->CreateRule ( fMakefile, "" );
+ installDirectory->CreateRule ( fMakefile, "" );
+}
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-05-12 19:31:10 UTC (rev 15243)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-05-12 19:32:15 UTC (rev 15244)
@@ -34,6 +34,9 @@
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 @@
std::string GetRegistryTargetFiles ();
void OutputRegistryInstallTarget ();
void GenerateInstallTarget ();
+ void GenerateDirectoryTargets ();
FILE* fMakefile;
bool use_pch;
};
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-05-12 19:31:10 UTC (rev 15243)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-05-12 19:32:15 UTC (rev 15244)
@@ -129,7 +129,7 @@
{
string target = PassThruCacheDirectory (
NormalizeFilename ( module.GetPath () ),
- backend->intermediateDirectory );
+ GetTargetDirectoryTree ( module ) );
if ( pclean_files )
{
string_list& clean_files = *pclean_files;