diff --git a/reactos/Makefile b/reactos/Makefile index e0d3f8bf773..3d318c7eb86 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -99,16 +99,20 @@ else # mingw32-windows NUL = NUL endif -ifneq ($(ROS_INTERMEDIATE),) -$(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE) - ${nmkdir} $(ROS_INTERMEDIATE)tools -endif - ifneq ($(ROS_INTERMEDIATE),) $(ROS_INTERMEDIATE): ${nmkdir} $(ROS_INTERMEDIATE) +$(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE) + ${nmkdir} $@ +$(ROS_INTERMEDIATE)dk: $(ROS_INTERMEDIATE) + ${nkmdir} $@ +$(ROS_INTERMEDIATE)dk$(SEP)nkm: $(ROS_INTERMEDIATE)dk + ${nkmdir} $@ endif +$(ROS_INTERMEDIATE)dk$(SEP)nkm$(SEP)lib: $(ROS_INTERMEDIATE)dk$(SEP)nkm + ${nmkdir} $@ + NTOSKRNL_MC = .$(SEP)ntoskrnl$(SEP)ntoskrnl.mc KERNEL32_MC = .$(SEP)lib$(SEP)kernel32$(SEP)kernel32.mc BUILDNO_H = .$(SEP)include$(SEP)reactos$(SEP)buildno.h diff --git a/reactos/tools/rbuild/XML.cpp b/reactos/tools/rbuild/XML.cpp index e3f42de6853..07b9c8f93f6 100644 --- a/reactos/tools/rbuild/XML.cpp +++ b/reactos/tools/rbuild/XML.cpp @@ -179,8 +179,8 @@ Path::RelativeFromWorkingDirectory ( const string& path ) vout.push_back ( vpath[i++] ); // now merge vout into a string again - string out = "."; - for ( i = 0; i < vout.size(); i++ ) + string out = vout[0]; + for ( i = 1; i < vout.size(); i++ ) { out += "/" + vout[i]; } diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 7a9e4a65781..57a070eb339 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -19,6 +19,25 @@ FixSeparator ( const string& s ) return s2; } +string +GetSubPath ( + const string& location, + const string& path, + const string& att_value ) +{ + if ( !att_value.size() ) + throw InvalidBuildFileException ( + location, + " tag has empty 'name' attribute" ); + if ( strpbrk ( att_value.c_str (), "/\\?*:<>|" ) ) + throw InvalidBuildFileException ( + location, + " tag has invalid characters in 'name' attribute" ); + if ( !path.size() ) + return att_value; + return FixSeparator(path + CSEP + att_value); +} + string GetExtension ( const string& filename ) { @@ -252,7 +271,7 @@ Module::ProcessXMLSubElement ( const XMLElement& e, { const XMLAttribute* att = e.GetAttribute ( "name", true ); assert(att); - subpath = FixSeparator ( path + CSEP + att->value ); + subpath = GetSubPath ( e.location, path, att->value ); } else if ( e.name == "include" ) { @@ -508,10 +527,10 @@ Module::GetDependencyPath () const { if ( HasImportLibrary () ) { - return ssprintf ( "dk%snkm%slib%slib%s.a", - SSEP, - SSEP, - SSEP, + return ssprintf ( "dk%cnkm%clib%clib%s.a", + CSEP, + CSEP, + CSEP, name.c_str () ); } else diff --git a/reactos/tools/rbuild/project.cpp b/reactos/tools/rbuild/project.cpp index e929c0cfe87..e3d51fa7760 100644 --- a/reactos/tools/rbuild/project.cpp +++ b/reactos/tools/rbuild/project.cpp @@ -182,7 +182,8 @@ Project::ReadXml () if ( head->subElements[i]->name == "project" ) { node = head->subElements[i]; - this->ProcessXML ( "." ); + string path; + this->ProcessXML ( path ); return; } } @@ -254,7 +255,7 @@ Project::ProcessXMLSubElement ( const XMLElement& e, { const XMLAttribute* att = e.GetAttribute ( "name", true ); assert(att); - subpath = path + CSEP + att->value; + subpath = GetSubPath ( e.location, path, att->value ); } else if ( e.name == "include" ) { diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 926909f74a5..7c718d224ff 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -6,15 +6,17 @@ #ifdef WIN32 #include #include -#endif +#endif/*WIN32*/ #include #include #ifdef _MSC_VER #include -#else +#else/*_MSC_VER*/ #include +#ifdef WIN32 #include -#endif +#endif/*WIN32*/ +#endif/*_MSC_VER*/ #include "ssprintf.h" #include "exception.h" @@ -524,10 +526,15 @@ public: void ProcessXML(); }; - extern std::string FixSeparator ( const std::string& s ); +extern std::string +GetSubPath ( + const std::string& location, + const std::string& path, + const std::string& att_value ); + extern std::string GetExtension ( const std::string& filename );