return path;\r
}\r
\r
+string\r
+Directory::GetEnvironmentVariable ( const string& name )\r
+{\r
+ char* value = getenv ( name.c_str () );\r
+ if ( value != NULL && strlen ( value ) > 0 )\r
+ return ssprintf ( "%s",\r
+ value );\r
+ else\r
+ return "";\r
+}\r
+\r
+string\r
+Directory::GetEnvironmentVariablePathOrDefault ( const string& name,\r
+ const string& defaultValue )\r
+{\r
+ const string& environmentVariableValue = GetEnvironmentVariable ( name );\r
+ if ( environmentVariableValue.length () > 0 )\r
+ return NormalizeFilename ( environmentVariableValue );\r
+ else\r
+ return defaultValue;\r
+}\r
+\r
string\r
Directory::GetIntermediatePath ()\r
{\r
return "output-i386";\r
}\r
\r
+string\r
+Directory::GetInstallPath ()\r
+{\r
+ return GetEnvironmentVariablePathOrDefault ( "ROS_INSTALL",\r
+ "reactos" );\r
+}\r
+\r
void\r
Directory::ResolveVariablesInPath ( char* buf,\r
string path )\r
{\r
string s = ReplaceVariable ( "$(INTERMEDIATE)", GetIntermediatePath (), path );\r
s = ReplaceVariable ( "$(OUTPUT)", GetOutputPath (), s );\r
+ s = ReplaceVariable ( "$(INSTALL)", GetInstallPath (), s );\r
strcpy ( buf, s.c_str () );\r
}\r
\r
MingwBackend::MingwBackend ( Project& project, bool verbose )\r
: Backend ( project, verbose ),\r
intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ),\r
- outputDirectory ( new Directory ( "$(OUTPUT)" ) )\r
+ outputDirectory ( new Directory ( "$(OUTPUT)" ) ),\r
+ installDirectory ( new Directory ( "$(INSTALL)" ) )\r
{\r
}\r
\r
{\r
delete intermediateDirectory;\r
delete outputDirectory;\r
+ delete installDirectory;\r
}\r
\r
string\r
printf ( "Creating directories..." );\r
intermediateDirectory->GenerateTree ( "", verbose );\r
outputDirectory->GenerateTree ( "", verbose );\r
+ installDirectory->GenerateTree ( "", verbose );\r
printf ( "done\n" );\r
}\r
\r
-string\r
-FixupTargetFilename ( const string& targetFilename )\r
-{\r
- return NormalizeFilename ( targetFilename );\r
-}\r
-\r
void\r
MingwBackend::DetectPipeSupport ()\r
{\r
printf ( "detected\n" );\r
else\r
printf ( "not detected\n" );\r
-\r
- // TODO FIXME - eventually check for ROS_USE_PCH env var and\r
- // allow that to override use_pch if true\r
}\r
\r
void\r
printf ( "detected\n" );\r
else\r
printf ( "not detected\n" );\r
-\r
- // TODO FIXME - eventually check for ROS_USE_PCH env var and\r
- // allow that to override use_pch if true\r
}\r
\r
void\r
MingwBackend::GetNonModuleInstallTargetFiles (\r
- string installDirectory,\r
vector<string>& out ) const\r
{\r
for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ )\r
{\r
const InstallFile& installfile = *ProjectNode.installfiles[i];\r
- string targetFilenameNoFixup = installDirectory + SSEP + installfile.base + SSEP + installfile.newname;\r
+ string targetFilenameNoFixup = installfile.base + SSEP + installfile.newname;\r
string targetFilename = MingwModuleHandler::PassThruCacheDirectory (\r
NormalizeFilename ( targetFilenameNoFixup ),\r
- outputDirectory );\r
+ installDirectory );\r
out.push_back ( targetFilename );\r
}\r
}\r
\r
void\r
MingwBackend::GetModuleInstallTargetFiles (\r
- string installDirectory,\r
vector<string>& out ) const\r
{\r
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )\r
const Module& module = *ProjectNode.modules[i];\r
if ( module.installName.length () > 0 )\r
{\r
- string targetFilenameNoFixup = installDirectory + SSEP + module.installBase + SSEP + module.installName;\r
+ string targetFilenameNoFixup = module.installBase + SSEP + module.installName;\r
string targetFilename = MingwModuleHandler::PassThruCacheDirectory (\r
NormalizeFilename ( targetFilenameNoFixup ),\r
- outputDirectory );\r
+ installDirectory );\r
out.push_back ( targetFilename );\r
}\r
}\r
\r
void\r
MingwBackend::GetInstallTargetFiles (\r
- string installDirectory,\r
vector<string>& out ) const\r
{\r
- GetNonModuleInstallTargetFiles ( installDirectory,\r
- out );\r
- GetModuleInstallTargetFiles ( installDirectory,\r
- out );\r
+ GetNonModuleInstallTargetFiles ( out );\r
+ GetModuleInstallTargetFiles ( out );\r
}\r
\r
void\r
-MingwBackend::OutputInstallTarget ( const string& installDirectory,\r
- const string& sourceFilename,\r
+MingwBackend::OutputInstallTarget ( const string& sourceFilename,\r
const string& targetFilename,\r
const string& targetDirectory )\r
{\r
string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory (\r
- NormalizeFilename ( installDirectory + SSEP + targetDirectory + SSEP + targetFilename ),\r
- outputDirectory );\r
+ NormalizeFilename ( targetDirectory + SSEP + targetFilename ),\r
+ installDirectory );\r
string normalizedTargetDirectory = MingwModuleHandler::PassThruCacheDirectory (\r
- NormalizeFilename ( installDirectory + SSEP + targetDirectory ),\r
- outputDirectory );\r
+ NormalizeFilename ( targetDirectory ),\r
+ installDirectory );\r
fprintf ( fMakefile,\r
"%s: %s %s\n",\r
normalizedTargetFilename.c_str (),\r
}\r
\r
void\r
-MingwBackend::OutputNonModuleInstallTargets ( const string& installDirectory )\r
+MingwBackend::OutputNonModuleInstallTargets ()\r
{\r
for ( size_t i = 0; i < ProjectNode.installfiles.size (); i++ )\r
{\r
const InstallFile& installfile = *ProjectNode.installfiles[i];\r
- OutputInstallTarget ( installDirectory,\r
- installfile.GetPath (),\r
+ OutputInstallTarget ( installfile.GetPath (),\r
installfile.newname,\r
installfile.base );\r
}\r
}\r
\r
void\r
-MingwBackend::OutputModuleInstallTargets ( const string& installDirectory )\r
+MingwBackend::OutputModuleInstallTargets ()\r
{\r
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )\r
{\r
string sourceFilename = MingwModuleHandler::PassThruCacheDirectory (\r
NormalizeFilename ( module.GetPath () ),\r
outputDirectory );\r
- OutputInstallTarget ( installDirectory,\r
- sourceFilename,\r
+ OutputInstallTarget ( sourceFilename,\r
module.installName,\r
module.installBase );\r
}\r
}\r
\r
string\r
-MingwBackend::GetRegistryTargetFiles ( const string& installDirectory )\r
+MingwBackend::GetRegistryTargetFiles ()\r
{\r
- string system32ConfigDirectory = MingwModuleHandler::PassThruCacheDirectory (\r
- NormalizeFilename ( installDirectory + SSEP + "system32" + SSEP "config" ),\r
- outputDirectory );\r
+ string system32ConfigDirectory = NormalizeFilename (\r
+ MingwModuleHandler::PassThruCacheDirectory (\r
+ "system32" SSEP "config" SSEP,\r
+ installDirectory ) );\r
return system32ConfigDirectory + SSEP "default " +\r
system32ConfigDirectory + SSEP "sam " +\r
system32ConfigDirectory + SSEP "security " +\r
}\r
\r
void\r
-MingwBackend::OutputRegistryInstallTarget ( const string& installDirectory )\r
+MingwBackend::OutputRegistryInstallTarget ()\r
{\r
- string system32ConfigDirectory = MingwModuleHandler::PassThruCacheDirectory (\r
- NormalizeFilename ( installDirectory + SSEP + "system32" + SSEP "config" ),\r
- outputDirectory );\r
+ string system32ConfigDirectory = NormalizeFilename (\r
+ MingwModuleHandler::PassThruCacheDirectory (\r
+ "system32" SSEP "config" SSEP,\r
+ installDirectory ) );\r
\r
string registrySourceFiles = GetRegistrySourceFiles ();\r
- string registryTargetFiles = GetRegistryTargetFiles ( installDirectory );\r
+ string registryTargetFiles = GetRegistryTargetFiles ();\r
fprintf ( fMakefile,\r
"install_registry: %s\n",\r
registryTargetFiles.c_str () );\r
void\r
MingwBackend::GenerateInstallTarget ()\r
{\r
- string installDirectoryNoFixup = "reactos";\r
- string installDirectory = MingwModuleHandler::PassThruCacheDirectory (\r
- NormalizeFilename ( installDirectoryNoFixup ),\r
- outputDirectory );\r
vector<string> vInstallTargetFiles;\r
- GetInstallTargetFiles ( installDirectoryNoFixup,\r
- vInstallTargetFiles );\r
+ GetInstallTargetFiles ( vInstallTargetFiles );\r
string installTargetFiles = v2s ( vInstallTargetFiles, 5 );\r
\r
fprintf ( fMakefile,\r
- "install: %s %s install_registry\n",\r
- installDirectory.c_str (),\r
+ "install: %s install_registry\n",\r
installTargetFiles.c_str () );\r
- OutputNonModuleInstallTargets ( installDirectoryNoFixup );\r
- OutputModuleInstallTargets ( installDirectoryNoFixup );\r
- OutputRegistryInstallTarget ( installDirectoryNoFixup );\r
+ OutputNonModuleInstallTargets ();\r
+ OutputModuleInstallTargets ();\r
+ OutputRegistryInstallTarget ();\r
fprintf ( fMakefile,\r
"\n" );\r
}\r
std::string ReplaceVariable ( std::string name,\r
std::string value,\r
std::string path );\r
+ std::string GetEnvironmentVariable ( const std::string& name );\r
+ std::string GetEnvironmentVariablePathOrDefault ( const std::string& name,\r
+ const std::string& defaultValue );\r
std::string GetIntermediatePath ();\r
std::string GetOutputPath ();\r
+ std::string GetInstallPath ();\r
void ResolveVariablesInPath ( char* buf,\r
std::string path );\r
bool CreateDirectory ( std::string path );\r
bool usePipe;\r
Directory* intermediateDirectory;\r
Directory* outputDirectory;\r
+ Directory* installDirectory;\r
private:\r
void CreateMakefile ();\r
void CloseMakefile () const;\r
std::string GetInstallDirectories ( const std::string& installDirectory );\r
void GetNonModuleInstallFiles ( std::vector<std::string>& out ) const;\r
void GetInstallFiles ( std::vector<std::string>& out ) const;\r
- void GetNonModuleInstallTargetFiles ( std::string installDirectory,\r
- std::vector<std::string>& out ) const;\r
- void GetModuleInstallTargetFiles ( std::string installDirectory,\r
- std::vector<std::string>& out ) const;\r
- void GetInstallTargetFiles ( std::string installDirectory,\r
- std::vector<std::string>& out ) const;\r
- void OutputInstallTarget ( const std::string& installDirectory,\r
- const std::string& sourceFilename,\r
+ void GetNonModuleInstallTargetFiles ( std::vector<std::string>& out ) const;\r
+ void GetModuleInstallTargetFiles ( std::vector<std::string>& out ) const;\r
+ void GetInstallTargetFiles ( std::vector<std::string>& out ) const;\r
+ void OutputInstallTarget ( const std::string& sourceFilename,\r
const std::string& targetFilename,\r
const std::string& targetDirectory );\r
- void OutputNonModuleInstallTargets ( const std::string& installDirectory );\r
- void OutputModuleInstallTargets ( const std::string& installDirectory );\r
+ void OutputNonModuleInstallTargets ();\r
+ void OutputModuleInstallTargets ();\r
std::string GetRegistrySourceFiles ();\r
- std::string GetRegistryTargetFiles ( const std::string& installDirectory );\r
- void OutputRegistryInstallTarget ( const std::string& installDirectory );\r
+ std::string GetRegistryTargetFiles ();\r
+ void OutputRegistryInstallTarget ();\r
void GenerateInstallTarget ();\r
FILE* fMakefile;\r
bool use_pch;\r
};\r
\r
-std::string FixupTargetFilename ( const std::string& targetFilename );\r
-\r
#endif /* MINGW_H */\r
string_list* pclean_files )\r
{\r
string target = PassThruCacheDirectory (\r
- FixupTargetFilename ( module.GetPath () ),\r
+ NormalizeFilename ( module.GetPath () ),\r
backend->outputDirectory );\r
if ( pclean_files )\r
{\r
string_list* pclean_files )\r
{\r
string target = PassThruCacheDirectory (\r
- FixupTargetFilename ( module.GetDependencyPath () ),\r
+ NormalizeFilename ( module.GetDependencyPath () ),\r
backend->outputDirectory );\r
if ( pclean_files )\r
{\r
invoke_targets[i].c_str () );\r
fprintf ( fMakefile,\r
": %s\n",\r
- FixupTargetFilename ( invoke.invokeModule->GetPath () ).c_str () );\r
+ NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_INVOKE)\n" );\r
fprintf ( fMakefile,\r
"\t%s %s\n\n",\r
- FixupTargetFilename ( invoke.invokeModule->GetPath () ).c_str (),\r
+ NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str (),\r
invoke.GetParameters ().c_str () );\r
}\r
}\r
string extension = GetExtension ( file.name );\r
if ( extension == ".rc" || extension == ".RC" )\r
{\r
- string resource = FixupTargetFilename ( file.name );\r
+ string resource = NormalizeFilename ( file.name );\r
fprintf ( fMakefile, "\t$(ECHO_BIN2RES)\n" );\r
fprintf ( fMakefile, "\t@:echo ${bin2res} -f -x %s\n",\r
resource.c_str () );\r
{\r
const Module& m = *module.project.modules[i];\r
if ( m.bootstrap != NULL )\r
- out.push_back ( FixupTargetFilename ( m.GetPath () ) );\r
+ out.push_back ( NormalizeFilename ( m.GetPath () ) );\r
}\r
}\r
\r
MingwIsoModuleHandler::GenerateIsoModuleTarget ()\r
{\r
string bootcdDirectory = "cd";\r
- string isoboot = FixupTargetFilename ( "boot/freeldr/bootsect/isoboot.o" );\r
+ string isoboot = NormalizeFilename ( "boot/freeldr/bootsect/isoboot.o" );\r
string bootcdReactosNoFixup = bootcdDirectory + "/reactos";\r
string bootcdReactos = PassThruCacheDirectory (\r
NormalizeFilename ( bootcdReactosNoFixup ),\r
backend->outputDirectory );\r
CLEAN_FILE ( bootcdReactos );\r
- string reactosInf = ros_temp + FixupTargetFilename ( bootcdReactosNoFixup + "/reactos.inf" );\r
+ string reactosInf = ros_temp + NormalizeFilename ( bootcdReactosNoFixup + "/reactos.inf" );\r
string reactosDff = NormalizeFilename ( "bootdata/packages/reactos.dff" );\r
string cdDirectories = GetCdDirectories ( bootcdDirectory );\r
vector<string> vCdFiles;\r