Continue rbuild cleanup (Module class)

svn path=/trunk/; revision=28964
This commit is contained in:
Hervé Poussineau 2007-09-09 07:53:40 +00:00
parent 8be848bceb
commit 5d0fb46096
20 changed files with 203 additions and 271 deletions

View file

@ -198,7 +198,7 @@ std::string
CBBackend::CbpFileName ( const Module& module ) const CBBackend::CbpFileName ( const Module& module ) const
{ {
return DosSeparator( return DosSeparator(
ReplaceExtension ( module.GetPath(), + "_auto.cbp" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_auto.cbp" )
); );
} }
@ -206,7 +206,7 @@ std::string
CBBackend::LayoutFileName ( const Module& module ) const CBBackend::LayoutFileName ( const Module& module ) const
{ {
return DosSeparator( return DosSeparator(
ReplaceExtension ( module.GetPath(), + "_auto.layout" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_auto.layout" )
); );
} }
@ -214,14 +214,14 @@ std::string
CBBackend::DependFileName ( const Module& module ) const CBBackend::DependFileName ( const Module& module ) const
{ {
return DosSeparator( return DosSeparator(
ReplaceExtension ( module.GetPath(), + "_auto.depend" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_auto.depend" )
); );
} }
void void
CBBackend::_get_object_files ( const Module& module, vector<string>& out) const CBBackend::_get_object_files ( const Module& module, vector<string>& out) const
{ {
string basepath = module.GetBasePath (); string basepath = module.output->relative_path;
size_t i; size_t i;
string intenv = Environment::GetIntermediatePath () + "\\" + basepath + "\\"; string intenv = Environment::GetIntermediatePath () + "\\" + basepath + "\\";
string outenv = Environment::GetOutputPath () + "\\" + basepath + "\\"; string outenv = Environment::GetOutputPath () + "\\" + basepath + "\\";
@ -273,9 +273,9 @@ CBBackend::_clean_project_files ( void )
{ {
Module& module = *ProjectNode.modules[i]; Module& module = *ProjectNode.modules[i];
vector<string> out; vector<string> out;
printf("Cleaning project %s %s\n", module.name.c_str (), module.GetBasePath ().c_str () ); printf("Cleaning project %s %s\n", module.name.c_str (), module.output->relative_path.c_str () );
string basepath = module.GetBasePath (); string basepath = module.output->relative_path;
remove ( CbpFileName ( module ).c_str () ); remove ( CbpFileName ( module ).c_str () );
remove ( DependFileName ( module ).c_str () ); remove ( DependFileName ( module ).c_str () );
remove ( LayoutFileName ( module ).c_str () ); remove ( LayoutFileName ( module ).c_str () );
@ -321,7 +321,7 @@ CBBackend::_generate_workspace ( FILE* OUT )
ifs_list.pop_back(); ifs_list.pop_back();
const vector<Library*>& libs = data.libraries; const vector<Library*>& libs = data.libraries;
for ( size_t j = 0; j < libs.size(); j++ ) for ( size_t j = 0; j < libs.size(); j++ )
fprintf ( OUT, "\t\t\t<Depends filename=\"%s\\%s_auto.cbp\" />\r\n", libs[j]->importedModule->GetBasePath().c_str(), libs[j]->name.c_str() ); fprintf ( OUT, "\t\t\t<Depends filename=\"%s\\%s_auto.cbp\" />\r\n", libs[j]->importedModule->output->relative_path.c_str(), libs[j]->name.c_str() );
} }
fprintf ( OUT, "\t\t</Project>\r\n" ); fprintf ( OUT, "\t\t</Project>\r\n" );
} }
@ -342,8 +342,8 @@ CBBackend::_generate_cbproj ( const Module& module )
string path_basedir = module.GetPathToBaseDir (); string path_basedir = module.GetPathToBaseDir ();
string intenv = Environment::GetIntermediatePath (); string intenv = Environment::GetIntermediatePath ();
string outenv = Environment::GetOutputPath (); string outenv = Environment::GetOutputPath ();
string module_type = GetExtension(module.GetTargetName()); string module_type = GetExtension(module.output->name);
string cbproj_path = module.GetBasePath(); string cbproj_path = module.output->relative_path;
string CompilerVar; string CompilerVar;
string baseaddr; string baseaddr;
string windres_defines; string windres_defines;
@ -383,7 +383,7 @@ CBBackend::_generate_cbproj ( const Module& module )
{ {
string pch_path = Path::RelativeFromDirectory ( string pch_path = Path::RelativeFromDirectory (
module.pch->file.name, module.pch->file.name,
module.GetBasePath() ); module.output->relative_path );
header_files.push_back ( pch_path ); header_files.push_back ( pch_path );
} }
@ -430,7 +430,7 @@ CBBackend::_generate_cbproj ( const Module& module )
{ {
string path = Path::RelativeFromDirectory ( string path = Path::RelativeFromDirectory (
incs[i]->directory, incs[i]->directory,
module.GetBasePath() ); module.output->relative_path );
includes.push_back ( path ); includes.push_back ( path );
widl_options += "-I" + path + " "; widl_options += "-I" + path + " ";
@ -438,7 +438,7 @@ CBBackend::_generate_cbproj ( const Module& module )
const vector<Library*>& libs = data.libraries; const vector<Library*>& libs = data.libraries;
for ( i = 0; i < libs.size(); i++ ) for ( i = 0; i < libs.size(); i++ )
{ {
string libpath = intdir + "\\" + libs[i]->importedModule->GetBasePath(); string libpath = intdir + "\\" + libs[i]->importedModule->output->relative_path;
libraries.push_back ( libs[i]->name ); libraries.push_back ( libs[i]->name );
libpaths.push_back ( libpath ); libpaths.push_back ( libpath );
} }
@ -507,18 +507,18 @@ CBBackend::_generate_cbproj ( const Module& module )
if ( configuration.UseConfigurationInPath ) if ( configuration.UseConfigurationInPath )
{ {
if ( module.type == StaticLibrary ||module.type == ObjectLibrary ) if ( module.type == StaticLibrary ||module.type == ObjectLibrary )
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.GetBasePath ().c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str()); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str());
else else
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.GetBasePath ().c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str()); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str());
fprintf ( OUT, "\t\t\t\t<Option object_output=\"%s\\%s%s\" />\r\n", intdir.c_str(), module.GetBasePath ().c_str (), cfg.name.c_str() ); fprintf ( OUT, "\t\t\t\t<Option object_output=\"%s\\%s%s\" />\r\n", intdir.c_str(), module.output->relative_path.c_str (), cfg.name.c_str() );
} }
else else
{ {
if ( module.type == StaticLibrary || module.type == ObjectLibrary ) if ( module.type == StaticLibrary || module.type == ObjectLibrary )
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.GetBasePath ().c_str (), module.name.c_str(), module_type.c_str() ); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() );
else else
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.GetBasePath ().c_str (), module.name.c_str(), module_type.c_str() ); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() );
fprintf ( OUT, "\t\t\t\t<Option object_output=\"%s\\%s\" />\r\n", intdir.c_str(), module.GetBasePath ().c_str () ); fprintf ( OUT, "\t\t\t\t<Option object_output=\"%s\\%s\" />\r\n", intdir.c_str(), module.output->relative_path.c_str () );
} }
if ( lib ) if ( lib )

View file

@ -166,7 +166,7 @@ DepMapBackend::_generate_depmap ( FILE* OUT )
fprintf ( m_DepMapFile, "\t<component>\r\n" ); fprintf ( m_DepMapFile, "\t<component>\r\n" );
fprintf ( m_DepMapFile, "\t\t<name>%s</name>\r\n", module.name.c_str () ); fprintf ( m_DepMapFile, "\t\t<name>%s</name>\r\n", module.name.c_str () );
fprintf ( m_DepMapFile, "\t\t<base>%s</base>\r\n", module.GetBasePath ().c_str () ); fprintf ( m_DepMapFile, "\t\t<base>%s</base>\r\n", module.output->relative_path.c_str () );
fprintf ( m_DepMapFile, "\t\t<ref_count>%u</ref_count>\r\n", (unsigned int)data->references.size () ); fprintf ( m_DepMapFile, "\t\t<ref_count>%u</ref_count>\r\n", (unsigned int)data->references.size () );
fprintf ( m_DepMapFile, "\t\t<lib_count>%u</lib_count>\r\n", (unsigned int)data->libraries.size () ); fprintf ( m_DepMapFile, "\t\t<lib_count>%u</lib_count>\r\n", (unsigned int)data->libraries.size () );
#if 0 #if 0

View file

@ -587,7 +587,7 @@ MingwBackend::GetBuildToolDependencies () const
{ {
if ( dependencies.length () > 0 ) if ( dependencies.length () > 0 )
dependencies += " "; dependencies += " ";
dependencies += module.GetDependencyPath (); dependencies += strFile ( module.dependency );
} }
} }
return dependencies; return dependencies;
@ -1165,12 +1165,8 @@ MingwBackend::GetModuleInstallTargetFiles (
const Module& module = *ProjectNode.modules[i]; const Module& module = *ProjectNode.modules[i];
if ( !module.enabled ) if ( !module.enabled )
continue; continue;
if ( module.installName.length () > 0 ) if ( module.install )
{ out.push_back ( *module.install );
out.push_back ( FileLocation ( InstallDirectory,
module.installBase,
module.installName ) );
}
} }
} }
@ -1230,13 +1226,10 @@ MingwBackend::OutputModuleInstallTargets ()
const Module& module = *ProjectNode.modules[i]; const Module& module = *ProjectNode.modules[i];
if ( !module.enabled ) if ( !module.enabled )
continue; continue;
if ( module.installName.length () > 0 ) if ( module.install )
{ {
const Module& aliasedModule = GetAliasedModuleOrModule ( module ); const Module& aliasedModule = GetAliasedModuleOrModule ( module );
OutputInstallTarget ( *aliasedModule.output, *module.install );
FileLocation source ( OutputDirectory, aliasedModule.GetBasePath (), aliasedModule.GetTargetName () );
FileLocation target ( InstallDirectory, module.installBase, module.installName );
OutputInstallTarget ( source, target );
} }
} }
} }

View file

@ -124,21 +124,12 @@ MingwModuleHandler::PassThruCacheDirectory (const FileLocation* file )
return file; return file;
} }
/*static*/ DirectoryLocation
MingwModuleHandler::GetTargetDirectoryTree (
const Module& module )
{
if ( module.type == StaticLibrary )
return IntermediateDirectory;
return OutputDirectory;
}
/*static*/ const FileLocation* /*static*/ const FileLocation*
MingwModuleHandler::GetTargetFilename ( MingwModuleHandler::GetTargetFilename (
const Module& module, const Module& module,
string_list* pclean_files ) string_list* pclean_files )
{ {
FileLocation *target = new FileLocation ( GetTargetDirectoryTree ( module ), module.GetBasePath (), module.GetTargetName () ); FileLocation *target = new FileLocation ( *module.output );
if ( pclean_files ) if ( pclean_files )
{ {
string_list& clean_files = *pclean_files; string_list& clean_files = *pclean_files;
@ -152,7 +143,7 @@ MingwModuleHandler::GetImportLibraryFilename (
const Module& module, const Module& module,
string_list* pclean_files ) string_list* pclean_files )
{ {
FileLocation *target = new FileLocation ( IntermediateDirectory, module.GetBasePath (), module.GetDependencyTargetName () ); FileLocation *target = new FileLocation ( *module.dependency );
if ( pclean_files ) if ( pclean_files )
{ {
string_list& clean_files = *pclean_files; string_list& clean_files = *pclean_files;
@ -354,7 +345,7 @@ MingwModuleHandler::GetModuleArchiveFilename () const
if ( module.type == StaticLibrary ) if ( module.type == StaticLibrary )
return new FileLocation ( *GetTargetFilename ( module, NULL ) ); return new FileLocation ( *GetTargetFilename ( module, NULL ) );
return new FileLocation ( IntermediateDirectory, return new FileLocation ( IntermediateDirectory,
module.GetBasePath (), module.output->relative_path,
ReplaceExtension ( module.name, ".temp.a" ) ); ReplaceExtension ( module.name, ".temp.a" ) );
} }
@ -581,16 +572,13 @@ MingwModuleHandler::GenerateCleanTarget () const
void void
MingwModuleHandler::GenerateInstallTarget () const MingwModuleHandler::GenerateInstallTarget () const
{ {
if ( module.installName.length () == 0 ) if ( !module.install )
return; return;
fprintf ( fMakefile, ".PHONY: %s_install\n", module.name.c_str() ); fprintf ( fMakefile, ".PHONY: %s_install\n", module.name.c_str() );
string normalizedTargetFilename =
NormalizeFilename ( module.installBase + sSep + module.installName );
fprintf ( fMakefile, fprintf ( fMakefile,
"%s_install: $(INSTALL)%c%s\n", "%s_install: %s\n",
module.name.c_str (), module.name.c_str (),
cSep, strFile ( module.install ).c_str () );
normalizedTargetFilename.c_str() );
} }
void void
@ -1473,8 +1461,8 @@ MingwModuleHandler::GenerateBuildMapCode ( const FileLocation *mapTarget )
"ifeq ($(ROS_BUILDMAP),full)\n" ); "ifeq ($(ROS_BUILDMAP),full)\n" );
FileLocation mapFilename ( OutputDirectory, FileLocation mapFilename ( OutputDirectory,
module.GetBasePath (), module.output->relative_path,
GetBasename ( module.GetTargetName () ) + ".map" ); GetBasename ( module.output->name ) + ".map" );
CLEAN_FILE ( &mapFilename ); CLEAN_FILE ( &mapFilename );
fprintf ( fMakefile, fprintf ( fMakefile,
@ -1509,16 +1497,13 @@ MingwModuleHandler::GenerateBuildNonSymbolStrippedCode ()
fprintf ( fMakefile, fprintf ( fMakefile,
"ifeq ($(ROS_BUILDNOSTRIP),yes)\n" ); "ifeq ($(ROS_BUILDNOSTRIP),yes)\n" );
string filename = module.GetTargetName (); string filename = module.output->name;
FileLocation outputFilename ( OutputDirectory,
module.GetBasePath (),
filename );
FileLocation nostripFilename ( OutputDirectory, FileLocation nostripFilename ( OutputDirectory,
module.GetBasePath (), module.output->relative_path,
GetBasename ( filename ) + ".nostrip" + GetExtension ( filename ) ); GetBasename ( filename ) + ".nostrip" + GetExtension ( filename ) );
CLEAN_FILE ( &nostripFilename ); CLEAN_FILE ( &nostripFilename );
OutputCopyCommand ( outputFilename, nostripFilename ); OutputCopyCommand ( *module.output, nostripFilename );
fprintf ( fMakefile, fprintf ( fMakefile,
"endif\n" ); "endif\n" );
@ -1626,7 +1611,7 @@ MingwModuleHandler::GenerateLinkerCommand (
dependencies.c_str (), dependencies.c_str (),
target_folder.c_str () ); target_folder.c_str () );
fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
string targetName ( module.GetTargetName () ); string targetName ( module.output->name );
if ( !module.IsDLL () ) if ( !module.IsDLL () )
{ {
@ -1682,7 +1667,7 @@ MingwModuleHandler::GenerateLinkerCommand (
* one has been provided... */ * one has been provided... */
/* See bug 1244 */ /* See bug 1244 */
//printf ( "%s will have all its functions exported\n", //printf ( "%s will have all its functions exported\n",
// module.GetTargetName ().c_str () ); // module.target->name.c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t%s %s %s -o %s %s %s %s\n", "\t%s %s %s -o %s %s %s %s\n",
linker.c_str (), linker.c_str (),
@ -2011,7 +1996,7 @@ MingwModuleHandler::GenerateOtherMacros ()
fMakefile, fMakefile,
"%s += $(PROJECT_WIDLFLAGS) -I%s\n", "%s += $(PROJECT_WIDLFLAGS) -I%s\n",
widlflagsMacro.c_str (), widlflagsMacro.c_str (),
module.GetBasePath ().c_str () ); module.output->relative_path.c_str () );
fprintf ( fprintf (
fMakefile, fMakefile,
@ -2076,7 +2061,7 @@ MingwModuleHandler::GenerateRules ()
if ( module.name != "zlib" ) /* Avoid make warning */ if ( module.name != "zlib" ) /* Avoid make warning */
{ {
FileLocation proxyMakefile ( OutputDirectory, FileLocation proxyMakefile ( OutputDirectory,
module.GetBasePath (), module.output->relative_path,
"makefile" ); "makefile" );
CLEAN_FILE ( &proxyMakefile ); CLEAN_FILE ( &proxyMakefile );
} }
@ -2172,11 +2157,11 @@ MingwModuleHandler::GenerateInvocations () const
invoke_targets[i].c_str () ); invoke_targets[i].c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
": %s\n", ": %s\n",
NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str () ); NormalizeFilename ( strFile ( invoke.invokeModule->output ) ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_INVOKE)\n" ); fprintf ( fMakefile, "\t$(ECHO_INVOKE)\n" );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t%s %s\n\n", "\t%s %s\n\n",
NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str (), NormalizeFilename ( strFile ( invoke.invokeModule->output ) ).c_str (),
invoke.GetParameters ().c_str () ); invoke.GetParameters ().c_str () );
} }
} }
@ -2296,7 +2281,7 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
fprintf ( fMakefile, fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-lib %s %s %s\n\n", "\t${dlltool} --dllname %s --def %s --output-lib %s %s %s\n\n",
module.GetTargetName ().c_str (), module.output->name.c_str (),
strFile ( defFilename ).c_str (), strFile ( defFilename ).c_str (),
strFile ( library_target ).c_str (), strFile ( library_target ).c_str (),
module.mangledSymbols ? "" : "--kill-at", module.mangledSymbols ? "" : "--kill-at",
@ -2457,7 +2442,7 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ()
string dependencies = linkDepsMacro + " " + objectsMacro; string dependencies = linkDepsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-Wl,-T,%s%cntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared", string linkerParameters = ssprintf ( "-Wl,-T,%s%cntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
module.GetBasePath ().c_str (), module.output->relative_path.c_str (),
cSep, cSep,
module.GetEntryPoint(true).c_str (), module.GetEntryPoint(true).c_str (),
module.baseaddress.c_str () ); module.baseaddress.c_str () );
@ -3037,7 +3022,7 @@ MingwBootLoaderModuleHandler::Process ()
void void
MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget () MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
{ {
string targetName ( module.GetTargetName () ); string targetName ( module.output->name );
string targetMacro ( GetTargetMacro (module) ); string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory (); string workingDirectory = GetWorkingDirectory ();
FileLocation junk_tmp ( TemporaryDirectory, FileLocation junk_tmp ( TemporaryDirectory,
@ -3118,7 +3103,7 @@ MingwBootProgramModuleHandler::Process ()
void void
MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget () MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget ()
{ {
string targetName ( module.GetTargetName () ); string targetName ( module.output->name );
string targetMacro ( GetTargetMacro (module) ); string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory (); string workingDirectory = GetWorkingDirectory ();
FileLocation junk_tmp ( TemporaryDirectory, FileLocation junk_tmp ( TemporaryDirectory,
@ -3151,7 +3136,7 @@ MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget ()
fprintf ( fMakefile, "\t$(%s_PREPARE) $(OUTPUT)$(SEP)%s %s\n", fprintf ( fMakefile, "\t$(%s_PREPARE) $(OUTPUT)$(SEP)%s %s\n",
module.buildtype.c_str (), module.buildtype.c_str (),
NormalizeFilename( payload->GetPath() ).c_str (), NormalizeFilename( strFile ( payload->output ) ).c_str (),
strFile ( &junk_cpy ).c_str () ); strFile ( &junk_cpy ).c_str () );
fprintf ( fMakefile, "\t${objcopy} $(%s_FLATFORMAT) %s %s\n", fprintf ( fMakefile, "\t${objcopy} $(%s_FLATFORMAT) %s %s\n",
@ -3168,7 +3153,7 @@ MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget ()
fprintf ( fMakefile, "\t${objcopy} $(%s_COPYFORMAT) %s $(INTERMEDIATE)$(SEP)%s\n", fprintf ( fMakefile, "\t${objcopy} $(%s_COPYFORMAT) %s $(INTERMEDIATE)$(SEP)%s\n",
module.buildtype.c_str (), module.buildtype.c_str (),
strFile ( &junk_elf ).c_str (), strFile ( &junk_elf ).c_str (),
module.GetPath().c_str () ); strFile ( module.output ) .c_str () );
fprintf ( fMakefile, fprintf ( fMakefile,
"\t-@${rm} %s %s %s 2>$(NUL)\n", "\t-@${rm} %s %s %s 2>$(NUL)\n",
@ -3200,13 +3185,10 @@ MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (
continue; continue;
if ( m.bootstrap != NULL ) if ( m.bootstrap != NULL )
{ {
FileLocation sourceFile ( OutputDirectory,
m.GetBasePath (),
m.GetTargetName () );
FileLocation targetFile ( OutputDirectory, FileLocation targetFile ( OutputDirectory,
bootcdDirectory + sSep + m.bootstrap->base, bootcdDirectory + sSep + m.bootstrap->base,
m.bootstrap->nameoncd ); m.bootstrap->nameoncd );
OutputCopyCommand ( sourceFile, targetFile ); OutputCopyCommand ( *m.output, targetFile );
} }
} }
} }
@ -3281,10 +3263,7 @@ MingwIsoModuleHandler::GetBootstrapCdFiles (
continue; continue;
if ( m.bootstrap != NULL ) if ( m.bootstrap != NULL )
{ {
FileLocation file ( OutputDirectory, out.push_back ( *m.output );
m.GetBasePath (),
m.GetTargetName () );
out.push_back ( file );
} }
} }
} }
@ -3434,18 +3413,15 @@ MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory,
const Module& m = *module.project.modules[i]; const Module& m = *module.project.modules[i];
if ( !m.enabled ) if ( !m.enabled )
continue; continue;
if ( m.installName.length () > 0 ) if ( m.install )
{ {
const Module& aliasedModule = backend->GetAliasedModuleOrModule ( m ); const Module& aliasedModule = backend->GetAliasedModuleOrModule ( m );
FileLocation source ( OutputDirectory,
aliasedModule.GetBasePath (),
aliasedModule.GetTargetName () );
FileLocation destination ( OutputDirectory, FileLocation destination ( OutputDirectory,
m.installBase.length () > 0 m.install->relative_path.length () > 0
? livecdDirectory + sSep + reactosDirectory + sSep + m.installBase ? livecdDirectory + sSep + reactosDirectory + sSep + m.install->relative_path
: livecdDirectory + sSep + reactosDirectory, : livecdDirectory + sSep + reactosDirectory,
m.installName ); m.install->name );
OutputCopyCommand ( source, OutputCopyCommand ( *aliasedModule.output,
destination); destination);
} }
} }
@ -3584,7 +3560,7 @@ MingwTestModuleHandler::Process ()
void void
MingwTestModuleHandler::GetModuleSpecificCompilationUnits ( vector<CompilationUnit*>& compilationUnits ) MingwTestModuleHandler::GetModuleSpecificCompilationUnits ( vector<CompilationUnit*>& compilationUnits )
{ {
string basePath = "$(INTERMEDIATE)" + sSep + module.GetBasePath (); string basePath = "$(INTERMEDIATE)" + sSep + module.output->relative_path;
compilationUnits.push_back ( new CompilationUnit ( new File ( basePath + sSep + "_hooks.c", false, "", false ) ) ); compilationUnits.push_back ( new CompilationUnit ( new File ( basePath + sSep + "_hooks.c", false, "", false ) ) );
compilationUnits.push_back ( new CompilationUnit ( new File ( basePath + sSep + "_stubs.S", false, "", false ) ) ); compilationUnits.push_back ( new CompilationUnit ( new File ( basePath + sSep + "_stubs.S", false, "", false ) ) );
compilationUnits.push_back ( new CompilationUnit ( new File ( basePath + sSep + "_startup.c", false, "", false ) ) ); compilationUnits.push_back ( new CompilationUnit ( new File ( basePath + sSep + "_startup.c", false, "", false ) ) );
@ -3693,7 +3669,7 @@ MingwElfExecutableModuleHandler::MingwElfExecutableModuleHandler (
void void
MingwElfExecutableModuleHandler::Process () MingwElfExecutableModuleHandler::Process ()
{ {
string targetName ( module.GetTargetName () ); string targetName ( module.output->name );
string targetMacro ( GetTargetMacro (module) ); string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory (); string workingDirectory = GetWorkingDirectory ();
string objectsMacro = GetObjectsMacro ( module ); string objectsMacro = GetObjectsMacro ( module );

View file

@ -43,9 +43,6 @@ public:
static const FileLocation* PassThruCacheDirectory (const FileLocation* fileLocation ); static const FileLocation* PassThruCacheDirectory (const FileLocation* fileLocation );
static DirectoryLocation GetTargetDirectoryTree (
const Module& module );
static const FileLocation* GetTargetFilename ( static const FileLocation* GetTargetFilename (
const Module& module, const Module& module,
string_list* pclean_files ); string_list* pclean_files );

View file

@ -35,7 +35,7 @@ ProxyMakefile::~ProxyMakefile ()
bool bool
ProxyMakefile::GenerateProxyMakefile ( Module& module ) ProxyMakefile::GenerateProxyMakefile ( Module& module )
{ {
return module.GenerateInOutputTree (); return module.output->directory == OutputDirectory;
} }
void void
@ -72,7 +72,7 @@ string
ProxyMakefile::GetPathToTopDirectory ( Module& module ) ProxyMakefile::GetPathToTopDirectory ( Module& module )
{ {
int numberOfDirectories = 1; int numberOfDirectories = 1;
string basePath = NormalizeFilename ( module.GetBasePath () ); string basePath = module.output->relative_path;
for ( size_t i = 0; i < basePath.length (); i++ ) for ( size_t i = 0; i < basePath.length (); i++ )
{ {
if ( basePath[i] == cSep ) if ( basePath[i] == cSep )
@ -99,12 +99,12 @@ ProxyMakefile::GenerateProxyMakefileForModule ( Module& module,
string pathToTopDirectory; string pathToTopDirectory;
if ( outputTree.length () > 0 ) if ( outputTree.length () > 0 )
{ {
base = outputTree + sSep + module.GetBasePath (); base = outputTree + sSep + module.output->relative_path;
pathToTopDirectory = working_directory; pathToTopDirectory = working_directory;
} }
else else
{ {
base = module.GetBasePath (); base = module.output->relative_path;
pathToTopDirectory = GetPathToTopDirectory ( module ); pathToTopDirectory = GetPathToTopDirectory ( module );
} }
string proxyMakefile = NormalizeFilename ( base + sSep + "GNUmakefile" ); string proxyMakefile = NormalizeFilename ( base + sSep + "GNUmakefile" );

View file

@ -72,7 +72,7 @@ void MsBuildBackend::Process()
void void
MsBuildBackend::_generate_makefile ( const Module& module ) MsBuildBackend::_generate_makefile ( const Module& module )
{ {
string makefile = module.GetBasePath() + "\\makefile"; string makefile = module.output->relative_path + "\\makefile";
FILE* OUT = fopen ( makefile.c_str(), "wb" ); FILE* OUT = fopen ( makefile.c_str(), "wb" );
fprintf ( OUT, "!INCLUDE $(NTMAKEENV)\\makefile.def\r\n" ); fprintf ( OUT, "!INCLUDE $(NTMAKEENV)\\makefile.def\r\n" );
fclose ( OUT ); fclose ( OUT );
@ -83,12 +83,12 @@ MsBuildBackend::_generate_sources ( const Module& module )
{ {
size_t i; size_t i;
string module_type = GetExtension(module.GetTargetName()); string module_type = GetExtension(module.output->name);
vector<string> source_files, resource_files, includes, libraries; vector<string> source_files, resource_files, includes, libraries;
vector<string> header_files, common_defines, compiler_flags; vector<string> header_files, common_defines, compiler_flags;
vector<string> vars, values; vector<string> vars, values;
string sourcesfile = module.GetBasePath() + "\\sources"; string sourcesfile = module.output->relative_path + "\\sources";
string proj_path = module.GetBasePath(); string proj_path = module.output->relative_path;
FILE* OUT = fopen ( sourcesfile.c_str(), "wb" ); FILE* OUT = fopen ( sourcesfile.c_str(), "wb" );
fprintf ( OUT, "TARGETNAME=%s\r\n", module.name.c_str() ); fprintf ( OUT, "TARGETNAME=%s\r\n", module.name.c_str() );
@ -121,7 +121,7 @@ MsBuildBackend::_generate_sources ( const Module& module )
{ {
string path = Path::RelativeFromDirectory ( string path = Path::RelativeFromDirectory (
incs[i]->directory, incs[i]->directory,
module.GetBasePath() ); module.output->relative_path );
includes.push_back ( path ); includes.push_back ( path );
} }
@ -220,12 +220,12 @@ MsBuildBackend::_clean_project_files ( void )
for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) for ( size_t i = 0; i < ProjectNode.modules.size(); i++ )
{ {
Module& module = *ProjectNode.modules[i]; Module& module = *ProjectNode.modules[i];
printf("Cleaning project %s %s\n", module.name.c_str (), module.GetBasePath ().c_str () ); printf("Cleaning project %s %s\n", module.name.c_str (), module.output->relative_path.c_str () );
string makefile = module.GetBasePath() + "\\makefile"; string makefile = module.output->relative_path + "\\makefile";
string sourcesfile = module.GetBasePath() + "\\sources"; string sourcesfile = module.output->relative_path + "\\sources";
string basepath = module.GetBasePath (); string basepath = module.output->relative_path;
remove ( makefile.c_str() ); remove ( makefile.c_str() );
remove ( sourcesfile.c_str() ); remove ( sourcesfile.c_str() );
} }

View file

@ -225,7 +225,7 @@ std::string
MSVCBackend::OptFileName ( const Module& module ) const MSVCBackend::OptFileName ( const Module& module ) const
{ {
return FixSeparatorForSystemCommand( return FixSeparatorForSystemCommand(
ReplaceExtension ( module.GetPath(), "_" + _get_vc_dir() + "_auto.opt" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_" + _get_vc_dir() + "_auto.opt" )
); );
} }
@ -233,7 +233,7 @@ std::string
MSVCBackend::SuoFileName ( const Module& module ) const MSVCBackend::SuoFileName ( const Module& module ) const
{ {
return FixSeparatorForSystemCommand( return FixSeparatorForSystemCommand(
ReplaceExtension ( module.GetPath(), "_" + _get_vc_dir() + "_auto.suo" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_" + _get_vc_dir() + "_auto.suo" )
); );
} }
@ -241,7 +241,7 @@ std::string
MSVCBackend::DswFileName ( const Module& module ) const MSVCBackend::DswFileName ( const Module& module ) const
{ {
return FixSeparatorForSystemCommand( return FixSeparatorForSystemCommand(
ReplaceExtension ( module.GetPath(), "_auto.dsw" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_auto.dsw" )
); );
} }
@ -249,7 +249,7 @@ std::string
MSVCBackend::SlnFileName ( const Module& module ) const MSVCBackend::SlnFileName ( const Module& module ) const
{ {
return FixSeparatorForSystemCommand( return FixSeparatorForSystemCommand(
ReplaceExtension ( module.GetPath(), "_" + _get_vc_dir() + "_auto.sln" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_" + _get_vc_dir() + "_auto.sln" )
); );
} }
@ -257,7 +257,7 @@ std::string
MSVCBackend::NcbFileName ( const Module& module ) const MSVCBackend::NcbFileName ( const Module& module ) const
{ {
return FixSeparatorForSystemCommand( return FixSeparatorForSystemCommand(
ReplaceExtension ( module.GetPath(), "_" + _get_vc_dir() + "_auto.ncb" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_" + _get_vc_dir() + "_auto.ncb" )
); );
} }
@ -265,7 +265,7 @@ std::string
MSVCBackend::DspFileName ( const Module& module ) const MSVCBackend::DspFileName ( const Module& module ) const
{ {
return FixSeparatorForSystemCommand( return FixSeparatorForSystemCommand(
ReplaceExtension ( module.GetPath(), "_auto.dsp" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_auto.dsp" )
); );
} }
@ -273,7 +273,7 @@ std::string
MSVCBackend::VcprojFileName ( const Module& module ) const MSVCBackend::VcprojFileName ( const Module& module ) const
{ {
return FixSeparatorForSystemCommand( return FixSeparatorForSystemCommand(
ReplaceExtension ( module.GetPath(), "_" + _get_vc_dir() + "_auto.vcproj" ) ReplaceExtension ( module.output->relative_path + "\\" + module.output->name, "_" + _get_vc_dir() + "_auto.vcproj" )
); );
} }
@ -296,7 +296,7 @@ std::string MSVCBackend::_get_vc_dir ( void ) const
void void
MSVCBackend::_get_object_files ( const Module& module, vector<string>& out) const MSVCBackend::_get_object_files ( const Module& module, vector<string>& out) const
{ {
string basepath = module.GetBasePath (); string basepath = module.output->relative_path;
string vcdir = _get_vc_dir (); string vcdir = _get_vc_dir ();
size_t i; size_t i;
string intenv = Environment::GetIntermediatePath () + DEF_SSEP + basepath + DEF_SSEP; string intenv = Environment::GetIntermediatePath () + DEF_SSEP + basepath + DEF_SSEP;
@ -361,7 +361,7 @@ MSVCBackend::_get_object_files ( const Module& module, vector<string>& out) cons
//files in the output dir //files in the output dir
for ( i = cfgs.size () / 2; i < cfgs.size (); i++ ) for ( i = cfgs.size () / 2; i < cfgs.size (); i++ )
{ {
out.push_back ( cfgs[i] + module.GetTargetName () ); out.push_back ( cfgs[i] + module.output->name );
out.push_back ( cfgs[i] + module.name + ".pdb" ); out.push_back ( cfgs[i] + module.name + ".pdb" );
out.push_back ( cfgs[i] + module.name + ".lib" ); out.push_back ( cfgs[i] + module.name + ".lib" );
out.push_back ( cfgs[i] + module.name + ".exp" ); out.push_back ( cfgs[i] + module.name + ".exp" );
@ -395,9 +395,9 @@ MSVCBackend::_clean_project_files ( void )
{ {
Module& module = *ProjectNode.modules[i]; Module& module = *ProjectNode.modules[i];
vector<string> out; vector<string> out;
printf("Cleaning project %s %s %s\n", module.name.c_str (), module.GetBasePath ().c_str (), NcbFileName ( module ).c_str () ); printf("Cleaning project %s %s %s\n", module.name.c_str (), module.output->relative_path.c_str (), NcbFileName ( module ).c_str () );
string basepath = module.GetBasePath (); string basepath = module.output->relative_path;
remove ( NcbFileName ( module ).c_str () ); remove ( NcbFileName ( module ).c_str () );
remove ( DspFileName ( module ).c_str () ); remove ( DspFileName ( module ).c_str () );
remove ( DswFileName ( module ).c_str () ); remove ( DswFileName ( module ).c_str () );
@ -461,11 +461,11 @@ MSVCBackend::_install_files (const std::string& vcdir, const::string& config)
for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) for ( size_t i = 0; i < ProjectNode.modules.size(); i++ )
{ {
Module& module = *ProjectNode.modules[i]; Module& module = *ProjectNode.modules[i];
if ( module.installBase == "" || module.installName == "" ) if ( !module.install )
continue; continue;
string inputname = Environment::GetOutputPath () + DEF_SSEP + module.GetBasePath () + DEF_SSEP + vcdir + DEF_SSEP + config + DEF_SSEP + module.GetTargetName (); string inputname = Environment::GetOutputPath () + DEF_SSEP + module.output->relative_path + DEF_SSEP + vcdir + DEF_SSEP + config + DEF_SSEP + module.output->name;
string installdir = Environment::GetInstallPath () + DEF_SSEP + module.installBase + DEF_SSEP + module.installName; string installdir = Environment::GetInstallPath () + DEF_SSEP + module.install->relative_path + DEF_SSEP + module.install->name;
if ( _copy_file( inputname, installdir ) ) if ( _copy_file( inputname, installdir ) )
printf ("Installed File :'%s'\n",installdir.c_str () ); printf ("Installed File :'%s'\n",installdir.c_str () );
} }

View file

@ -56,7 +56,7 @@ MSVCBackend::_generate_dsp ( const Module& module )
imports.push_back ( module.non_if_data.libraries[i]->name ); imports.push_back ( module.non_if_data.libraries[i]->name );
} }
string module_type = GetExtension(module.GetTargetName()); string module_type = GetExtension(module.output->name);
bool lib = (module_type == ".lib") || (module_type == ".a"); bool lib = (module_type == ".lib") || (module_type == ".a");
bool dll = (module_type == ".dll") || (module_type == ".cpl"); bool dll = (module_type == ".dll") || (module_type == ".cpl");
bool exe = (module_type == ".exe") || (module_type == ".scr"); bool exe = (module_type == ".exe") || (module_type == ".scr");
@ -82,7 +82,7 @@ MSVCBackend::_generate_dsp ( const Module& module )
//$output->progress("$dsp_file (file $progress_current of $progress_max)"); //$output->progress("$dsp_file (file $progress_current of $progress_max)");
// TODO FIXME - what's diff. betw. 'c_srcs' and 'source_files'? // TODO FIXME - what's diff. betw. 'c_srcs' and 'source_files'?
string dsp_path = module.GetBasePath(); string dsp_path = module.output->relative_path;
vector<string> c_srcs, source_files, header_files, resource_files, includes, libraries; vector<string> c_srcs, source_files, header_files, resource_files, includes, libraries;
StringSet common_defines; StringSet common_defines;
vector<const IfableData*> ifs_list; vector<const IfableData*> ifs_list;
@ -127,7 +127,7 @@ MSVCBackend::_generate_dsp ( const Module& module )
string path = Path::RelativeFromDirectory ( string path = Path::RelativeFromDirectory (
incs[i]->directory, incs[i]->directory,
module.GetBasePath() ); module.output->relative_path );
includes.push_back ( path ); includes.push_back ( path );
} }
const vector<Library*>& libs = data.libraries; const vector<Library*>& libs = data.libraries;

View file

@ -98,7 +98,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
FILE* OUT = fopen ( vcproj_file.c_str(), "wb" ); FILE* OUT = fopen ( vcproj_file.c_str(), "wb" );
vector<string> imports; vector<string> imports;
string module_type = GetExtension(module.GetTargetName()); string module_type = GetExtension(module.output->name);
bool lib = (module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a"); bool lib = (module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a");
bool dll = (module_type == ".dll") || (module_type == ".cpl"); bool dll = (module_type == ".dll") || (module_type == ".cpl");
bool exe = (module_type == ".exe") || (module_type == ".scr"); bool exe = (module_type == ".exe") || (module_type == ".scr");
@ -131,7 +131,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
bool console = exe && (module.type == Win32CUI); bool console = exe && (module.type == Win32CUI);
bool include_idl = false; bool include_idl = false;
string vcproj_path = module.GetBasePath(); string vcproj_path = module.output->relative_path;
vector<string> source_files, resource_files, header_files, includes, includes_ros, libraries; vector<string> source_files, resource_files, header_files, includes, includes_ros, libraries;
StringSet common_defines; StringSet common_defines;
vector<const IfableData*> ifs_list; vector<const IfableData*> ifs_list;
@ -172,7 +172,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
{ {
string path = Path::RelativeFromDirectory ( string path = Path::RelativeFromDirectory (
incs[i]->directory, incs[i]->directory,
module.GetBasePath() ); module.output->relative_path );
if ( module.type != RpcServer && module.type != RpcClient ) if ( module.type != RpcServer && module.type != RpcClient )
{ {
if ( path.find ("/include/reactos/idl") != string::npos) if ( path.find ("/include/reactos/idl") != string::npos)
@ -199,7 +199,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
const vector<Library*>& libs = data.libraries; const vector<Library*>& libs = data.libraries;
for ( i = 0; i < libs.size(); i++ ) for ( i = 0; i < libs.size(); i++ )
{ {
string libpath = outdir + "\\" + libs[i]->importedModule->GetBasePath() + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib"; string libpath = outdir + "\\" + libs[i]->importedModule->output->relative_path + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib";
libraries.push_back ( libpath ); libraries.push_back ( libpath );
} }
const vector<Define*>& defs = data.defines; const vector<Define*>& defs = data.defines;
@ -267,13 +267,13 @@ MSVCBackend::_generate_vcproj ( const Module& module )
if ( configuration.UseConfigurationInPath ) if ( configuration.UseConfigurationInPath )
{ {
fprintf ( OUT, "\t\t\tOutputDirectory=\"%s\\%s%s\\%s\"\r\n", outdir.c_str (), module.GetBasePath ().c_str (), vcdir.c_str (), cfg.name.c_str() ); fprintf ( OUT, "\t\t\tOutputDirectory=\"%s\\%s%s\\%s\"\r\n", outdir.c_str (), module.output->relative_path.c_str (), vcdir.c_str (), cfg.name.c_str() );
fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s%s\\%s\"\r\n", intdir.c_str (), module.GetBasePath ().c_str (), vcdir.c_str (), cfg.name.c_str() ); fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s%s\\%s\"\r\n", intdir.c_str (), module.output->relative_path.c_str (), vcdir.c_str (), cfg.name.c_str() );
} }
else else
{ {
fprintf ( OUT, "\t\t\tOutputDirectory=\"%s\\%s%s\"\r\n", outdir.c_str (), module.GetBasePath ().c_str (), vcdir.c_str () ); fprintf ( OUT, "\t\t\tOutputDirectory=\"%s\\%s%s\"\r\n", outdir.c_str (), module.output->relative_path.c_str (), vcdir.c_str () );
fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s%s\"\r\n", intdir.c_str (), module.GetBasePath ().c_str (), vcdir.c_str () ); fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s%s\"\r\n", intdir.c_str (), module.output->relative_path.c_str (), vcdir.c_str () );
} }
fprintf ( OUT, "\t\t\tConfigurationType=\"%d\"\r\n", exe ? 1 : dll ? 2 : lib ? 4 : -1 ); fprintf ( OUT, "\t\t\tConfigurationType=\"%d\"\r\n", exe ? 1 : dll ? 2 : lib ? 4 : -1 );
@ -375,7 +375,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
fprintf ( OUT, "\t\t\t\tUsePrecompiledHeader=\"2\"\r\n" ); fprintf ( OUT, "\t\t\t\tUsePrecompiledHeader=\"2\"\r\n" );
string pch_path = Path::RelativeFromDirectory ( string pch_path = Path::RelativeFromDirectory (
module.pch->file.name, module.pch->file.name,
module.GetBasePath() ); module.output->relative_path );
string::size_type pos = pch_path.find_last_of ("/"); string::size_type pos = pch_path.find_last_of ("/");
if ( pos != string::npos ) if ( pos != string::npos )
pch_path.erase(0, pos+1); pch_path.erase(0, pos+1);

View file

@ -108,7 +108,7 @@ VReportBackend::GenerateReport ( FILE* OUT )
{ {
fprintf ( m_VReportFile, "\t<component>\r\n" ); fprintf ( m_VReportFile, "\t<component>\r\n" );
fprintf ( m_VReportFile, "\t\t<name>%s</name>\r\n", module.name.c_str () ); fprintf ( m_VReportFile, "\t\t<name>%s</name>\r\n", module.name.c_str () );
fprintf ( m_VReportFile, "\t\t<base>%s</base>\r\n", module.GetBasePath().c_str () ); fprintf ( m_VReportFile, "\t\t<base>%s</base>\r\n", module.output->relative_path.c_str () );
fprintf ( m_VReportFile, "\t\t<version>%s</version>\r\n", module.metadata->version.c_str () ); fprintf ( m_VReportFile, "\t\t<version>%s</version>\r\n", module.metadata->version.c_str () );
fprintf ( m_VReportFile, "\t\t<date>%s</date>\r\n", module.metadata->date.c_str () ); fprintf ( m_VReportFile, "\t\t<date>%s</date>\r\n", module.metadata->date.c_str () );
fprintf ( m_VReportFile, "\t\t<owner>%s</owner>\r\n", module.metadata->owner.c_str () ); fprintf ( m_VReportFile, "\t\t<owner>%s</owner>\r\n", module.metadata->owner.c_str () );

View file

@ -107,7 +107,7 @@ Bootstrap::Initialize ()
if ( att != NULL ) if ( att != NULL )
nameoncd = att->value; nameoncd = att->value;
else else
nameoncd = module->GetTargetName (); nameoncd = module->output->name;
} }
void void

View file

@ -43,7 +43,7 @@ CompilationUnit::CompilationUnit ( const Project* project,
const XMLAttribute* att = node->GetAttribute ( "name", true ); const XMLAttribute* att = node->GetAttribute ( "name", true );
assert(att); assert(att);
local_name = att->value; local_name = att->value;
name = module->GetBasePath () + cSep + att->value; name = module->output->relative_path + cSep + att->value;
} }
CompilationUnit::~CompilationUnit () CompilationUnit::~CompilationUnit ()
@ -101,7 +101,7 @@ CompilationUnit::GetFilename () const
if ( files.size () == 0 || files.size () > 1 ) if ( files.size () == 0 || files.size () > 1 )
{ {
return new FileLocation ( IntermediateDirectory, return new FileLocation ( IntermediateDirectory,
module ? module->GetBasePath () : "", module ? module->output->relative_path : "",
local_name ); local_name );
} }

View file

@ -87,7 +87,7 @@ Include::ProcessXML()
if ( base != NULL ) if ( base != NULL )
{ {
baseModule = base; baseModule = base;
basePath = base->GetBasePath (); basePath = base->output->relative_path;
referenceResolved = true; referenceResolved = true;
} }
} }

View file

@ -57,7 +57,7 @@ LinkerScript::ProcessXML()
if ( base != NULL ) if ( base != NULL )
{ {
baseModule = base; baseModule = base;
basePath = base->GetBasePath (); basePath = base->output->relative_path;
referenceResolved = true; referenceResolved = true;
} }
} }

View file

@ -265,8 +265,6 @@ Module::Module ( const Project& project,
xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename () ); xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename () );
path = FixSeparator ( modulePath );
enabled = true; enabled = true;
const XMLAttribute* att = moduleNode.GetAttribute ( "if", false ); const XMLAttribute* att = moduleNode.GetAttribute ( "if", false );
@ -430,17 +428,16 @@ Module::Module ( const Project& project,
if ( att != NULL ) if ( att != NULL )
prefix = att->value; prefix = att->value;
att = moduleNode.GetAttribute ( "installbase", false );
if ( att != NULL )
installBase = att->value;
else
installBase = "";
att = moduleNode.GetAttribute ( "installname", false ); att = moduleNode.GetAttribute ( "installname", false );
if ( att != NULL ) if ( att != NULL )
installName = att->value; {
const XMLAttribute* installbase = moduleNode.GetAttribute ( "installbase", false );
install = new FileLocation ( InstallDirectory,
installbase ? installbase->value : "",
att->value );
}
else else
installName = ""; install = NULL;
att = moduleNode.GetAttribute ( "usewrc", false ); att = moduleNode.GetAttribute ( "usewrc", false );
if ( att != NULL ) if ( att != NULL )
@ -487,6 +484,11 @@ Module::Module ( const Project& project,
buildtype = "BOOTPROG"; buildtype = "BOOTPROG";
} }
} }
output = new FileLocation ( GetTargetDirectoryTree (),
modulePath,
name + extension );
SetImportLibrary ( NULL );
} }
Module::~Module () Module::~Module ()
@ -535,7 +537,7 @@ Module::ProcessXML()
for ( i = 0; i < node.subElements.size(); i++ ) for ( i = 0; i < node.subElements.size(); i++ )
{ {
ParseContext parseContext; ParseContext parseContext;
ProcessXMLSubElement ( *node.subElements[i], path, "", parseContext ); ProcessXMLSubElement ( *node.subElements[i], output->relative_path, "", parseContext );
} }
for ( i = 0; i < invocations.size(); i++ ) for ( i = 0; i < invocations.size(); i++ )
invocations[i]->ProcessXML (); invocations[i]->ProcessXML ();
@ -719,7 +721,7 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
e.location, e.location,
"Only one <importlibrary> is valid per module" ); "Only one <importlibrary> is valid per module" );
} }
importLibrary = new ImportLibrary ( project, e, *this ); SetImportLibrary ( new ImportLibrary ( project, e, *this ) );
subs_invalid = true; subs_invalid = true;
} }
else if ( e.name == "if" ) else if ( e.name == "if" )
@ -910,6 +912,45 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
attribute.value ); attribute.value );
} }
DirectoryLocation
Module::GetTargetDirectoryTree () const
{
switch ( type )
{
case Kernel:
case KernelModeDLL:
case NativeDLL:
case Win32DLL:
case Win32OCX:
case KernelModeDriver:
case NativeCUI:
case Win32CUI:
case Test:
case Win32SCR:
case Win32GUI:
case BuildTool:
case BootLoader:
case BootSector:
case BootProgram:
case Iso:
case LiveIso:
case IsoRegTest:
case LiveIsoRegTest:
case EmbeddedTypeLib:
case ElfExecutable:
return OutputDirectory;
case StaticLibrary:
case ObjectLibrary:
case RpcServer:
case RpcClient:
case Alias:
case IdlHeader:
return IntermediateDirectory;
}
throw InvalidOperationException ( __FILE__,
__LINE__ );
}
string string
Module::GetDefaultModuleExtension () const Module::GetDefaultModuleExtension () const
{ {
@ -1103,94 +1144,16 @@ Module::IsDLL () const
__LINE__ ); __LINE__ );
} }
bool
Module::GenerateInOutputTree () const
{
switch ( type )
{
case Kernel:
case KernelModeDLL:
case NativeDLL:
case Win32DLL:
case Win32OCX:
case KernelModeDriver:
case NativeCUI:
case Win32CUI:
case Test:
case Win32SCR:
case Win32GUI:
case BuildTool:
case BootLoader:
case BootSector:
case BootProgram:
case Iso:
case LiveIso:
case IsoRegTest:
case LiveIsoRegTest:
case EmbeddedTypeLib:
case ElfExecutable:
return true;
case StaticLibrary:
case ObjectLibrary:
case RpcServer:
case RpcClient:
case Alias:
case IdlHeader:
return false;
}
throw InvalidOperationException ( __FILE__,
__LINE__ );
}
string
Module::GetTargetName () const
{
return name + extension;
}
string
Module::GetDependencyPath () const
{
if ( HasImportLibrary () )
return ReplaceExtension ( GetPathWithPrefix ( "lib" ), ".a" );
else
return GetPath();
}
string
Module::GetDependencyTargetName () const
{
if ( HasImportLibrary () )
return "lib" + name + ".a";
else
return GetTargetName();
}
string
Module::GetBasePath () const
{
return path;
}
string
Module::GetPath () const
{
if ( path.length() > 0 )
return path + cSep + GetTargetName ();
else
return GetTargetName ();
}
string string
Module::GetPathWithPrefix ( const string& prefix ) const Module::GetPathWithPrefix ( const string& prefix ) const
{ {
return path + cSep + prefix + GetTargetName (); return output->relative_path + cSep + prefix + output->name;
} }
string string
Module::GetPathToBaseDir () const Module::GetPathToBaseDir () const
{ {
string temp_path = path; string temp_path = output->relative_path;
string result = "..\\"; string result = "..\\";
while(temp_path.find ('\\') != string::npos) while(temp_path.find ('\\') != string::npos)
{ {
@ -1247,7 +1210,7 @@ Module::InvokeModule () const
for ( size_t i = 0; i < invocations.size (); i++ ) for ( size_t i = 0; i < invocations.size (); i++ )
{ {
Invoke& invoke = *invocations[i]; Invoke& invoke = *invocations[i];
string command = FixSeparatorForSystemCommand(invoke.invokeModule->GetPath ()) + " " + invoke.GetParameters (); string command = FixSeparatorForSystemCommand(invoke.invokeModule->output->relative_path + "/" + invoke.invokeModule->output->name ) + " " + invoke.GetParameters ();
printf ( "Executing '%s'\n\n", command.c_str () ); printf ( "Executing '%s'\n\n", command.c_str () );
int exitcode = system ( command.c_str () ); int exitcode = system ( command.c_str () );
if ( exitcode != 0 ) if ( exitcode != 0 )
@ -1257,6 +1220,16 @@ Module::InvokeModule () const
} }
void
Module::SetImportLibrary ( ImportLibrary* importLibrary )
{
this->importLibrary = importLibrary;
dependency = new FileLocation ( IntermediateDirectory,
output->relative_path,
HasImportLibrary () ? "lib" + name + ".a" : output->name );
}
File::File ( const string& _name, File::File ( const string& _name,
bool _first, bool _first,
std::string _switches, std::string _switches,
@ -1406,7 +1379,7 @@ Invoke::ProcessXMLSubElementInput ( const XMLElement& e )
if ( e.name == "inputfile" && e.value.size () > 0 ) if ( e.name == "inputfile" && e.value.size () > 0 )
{ {
input.push_back ( new InvokeFile ( input.push_back ( new InvokeFile (
e, FixSeparator ( module.path + cSep + e.value ) ) ); e, FixSeparator ( module.output->relative_path + cSep + e.value ) ) );
subs_invalid = true; subs_invalid = true;
} }
if ( subs_invalid && e.subElements.size() > 0 ) if ( subs_invalid && e.subElements.size() > 0 )
@ -1425,7 +1398,7 @@ Invoke::ProcessXMLSubElementOutput ( const XMLElement& e )
if ( e.name == "outputfile" && e.value.size () > 0 ) if ( e.name == "outputfile" && e.value.size () > 0 )
{ {
output.push_back ( new InvokeFile ( output.push_back ( new InvokeFile (
e, FixSeparator ( module.path + cSep + e.value ) ) ); e, FixSeparator ( module.output->relative_path + cSep + e.value ) ) );
subs_invalid = true; subs_invalid = true;
} }
if ( subs_invalid && e.subElements.size() > 0 ) if ( subs_invalid && e.subElements.size() > 0 )
@ -1603,7 +1576,7 @@ ImportLibrary::ImportLibrary ( const Project& project,
if ( index == string::npos ) if ( index == string::npos )
{ {
source = new FileLocation ( directory, source = new FileLocation ( directory,
module.GetBasePath (), module.output->relative_path,
definition->value ); definition->value );
} }
else else
@ -1611,7 +1584,7 @@ ImportLibrary::ImportLibrary ( const Project& project,
string dir = definition->value.substr ( 0, index ); string dir = definition->value.substr ( 0, index );
string name = definition->value.substr ( index + 1); string name = definition->value.substr ( index + 1);
source = new FileLocation ( directory, source = new FileLocation ( directory,
NormalizeFilename ( module.GetBasePath () + sSep + dir ), NormalizeFilename ( module.output->relative_path + sSep + dir ),
name ); name );
} }
} }

View file

@ -302,6 +302,15 @@ enum HostType
HostTrue HostTrue
}; };
enum DirectoryLocation
{
SourceDirectory,
IntermediateDirectory,
OutputDirectory,
InstallDirectory,
TemporaryDirectory,
};
class Module class Module
{ {
public: public:
@ -314,7 +323,6 @@ public:
std::string baseaddress; std::string baseaddress;
std::string payload; std::string payload;
std::string buildtype; std::string buildtype;
std::string path;
ModuleType type; ModuleType type;
ImportLibrary* importLibrary; ImportLibrary* importLibrary;
Metadata* metadata; Metadata* metadata;
@ -335,14 +343,15 @@ public:
bool cplusplus; bool cplusplus;
std::string prefix; std::string prefix;
HostType host; HostType host;
std::string installBase;
std::string installName;
std::string aliasedModuleName; std::string aliasedModuleName;
bool useWRC; bool useWRC;
bool allowWarnings; bool allowWarnings;
bool enabled; bool enabled;
bool useHostStdlib; bool useHostStdlib;
bool isStartupLib; bool isStartupLib;
FileLocation *output; // "path/foo.exe"
FileLocation *dependency; // "path/foo.exe" or "path/libfoo.a"
FileLocation *install;
Module ( const Project& project, Module ( const Project& project,
const XMLElement& moduleNode, const XMLElement& moduleNode,
@ -352,12 +361,6 @@ 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; // "foo.exe"
std::string GetDependencyPath () const; // "path/foo.exe" or "path/libfoo.a"
std::string GetDependencyTargetName () const; // "foo.exe" or "libfoo.a"
std::string GetBasePath () const; // "path"
std::string GetPath () const; // "path/foo.exe"
std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe" std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
std::string GetPathToBaseDir() const; // "../" offset to rootdirectory std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
std::string GetEntryPoint(bool leadingUnderscore) const; std::string GetEntryPoint(bool leadingUnderscore) const;
@ -366,9 +369,9 @@ public:
bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const; bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
void InvokeModule () const; void InvokeModule () const;
void ProcessXML (); void ProcessXML ();
void GetSourceFilenames ( string_list& list,
bool includeGeneratedFiles ) const;
private: private:
void SetImportLibrary ( ImportLibrary* importLibrary );
DirectoryLocation GetTargetDirectoryTree () const;
std::string GetDefaultModuleExtension () const; std::string GetDefaultModuleExtension () const;
std::string GetDefaultModuleEntrypoint () const; std::string GetDefaultModuleEntrypoint () const;
std::string GetDefaultModuleBaseaddress () const; std::string GetDefaultModuleBaseaddress () const;
@ -828,16 +831,6 @@ private:
}; };
enum DirectoryLocation
{
SourceDirectory,
IntermediateDirectory,
OutputDirectory,
InstallDirectory,
TemporaryDirectory,
};
class FileLocation class FileLocation
{ {
public: public:

View file

@ -65,7 +65,7 @@ SysSetupGenerator::Generate ()
string string
SysSetupGenerator::GetDirectoryId ( const Module& module ) SysSetupGenerator::GetDirectoryId ( const Module& module )
{ {
if ( ToLower ( module.installBase ) == "system32" ) if ( module.install && ToLower ( module.install->relative_path ) == "system32" )
return DIRECTORYID_SYSTEM32; return DIRECTORYID_SYSTEM32;
throw InvalidOperationException ( __FILE__, throw InvalidOperationException ( __FILE__,
__LINE__ ); __LINE__ );
@ -104,7 +104,7 @@ SysSetupGenerator::Generate ( HINF inf,
if ( 0 != InfHostAddLine ( context, NULL ) || if ( 0 != InfHostAddLine ( context, NULL ) ||
0 != InfHostAddField ( context, GetDirectoryId ( module ).c_str () ) || 0 != InfHostAddField ( context, GetDirectoryId ( module ).c_str () ) ||
0 != InfHostAddField ( context, "" ) || 0 != InfHostAddField ( context, "" ) ||
0 != InfHostAddField ( context, module.installName.c_str () ) || ( module.install && 0 != InfHostAddField ( context, module.install->name.c_str () ) ) ||
0 != InfHostAddField ( context, GetFlags ( module ).c_str () ) ) 0 != InfHostAddField ( context, GetFlags ( module ).c_str () ) )
{ {
InfHostFreeContext ( context ); InfHostFreeContext ( context );

View file

@ -69,7 +69,7 @@ TestSupportCode::GenerateTestSupportCodeForModule ( Module& module,
string string
TestSupportCode::GetHooksFilename ( Module& module ) TestSupportCode::GetHooksFilename ( Module& module )
{ {
return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.GetBasePath () + sSep + "_hooks.c" ); return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.output->relative_path + sSep + "_hooks.c" );
} }
char* char*
@ -135,7 +135,7 @@ TestSupportCode::WriteHooksFile ( Module& module )
string string
TestSupportCode::GetStubsFilename ( Module& module ) TestSupportCode::GetStubsFilename ( Module& module )
{ {
return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.GetBasePath () + sSep + "_stubs.S" ); return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.output->relative_path + sSep + "_stubs.S" );
} }
string string
@ -249,7 +249,7 @@ TestSupportCode::WriteStubsFile ( Module& module )
string string
TestSupportCode::GetStartupFilename ( Module& module ) TestSupportCode::GetStartupFilename ( Module& module )
{ {
return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.GetBasePath () + sSep + "_startup.c" ); return NormalizeFilename ( Environment::GetIntermediatePath () + sSep + module.output->relative_path + sSep + "_startup.c" );
} }
bool bool

View file

@ -103,8 +103,8 @@ WineResource::UnpackResourcesInModule ( Module& module,
module.name.c_str () ); module.name.c_str () );
} }
string relativeDirectory = module.GetBasePath (); string relativeDirectory = module.output->relative_path;
string outputDirectory = Environment::GetIntermediatePath() + sSep + module.GetBasePath (); string outputDirectory = Environment::GetIntermediatePath() + sSep + module.output->relative_path;
string parameters = ssprintf ( "-b %s -O %s -f -x %s", string parameters = ssprintf ( "-b %s -O %s -f -x %s",
NormalizeFilename ( relativeDirectory ).c_str (), NormalizeFilename ( relativeDirectory ).c_str (),
NormalizeFilename ( outputDirectory ).c_str (), NormalizeFilename ( outputDirectory ).c_str (),
@ -120,6 +120,6 @@ WineResource::UnpackResourcesInModule ( Module& module,
exitcode ); exitcode );
} }
module.non_if_data.includes.push_back( new Include ( module.project, module.non_if_data.includes.push_back( new Include ( module.project,
module.GetBasePath (), module.output->relative_path,
"$(INTERMEDIATE)" ) ); "$(INTERMEDIATE)" ) );
} }