outputDirectory ( new Directory ( "$(OUTPUT)" ) ),
installDirectory ( new Directory ( "$(INSTALL)" ) )
{
+ compilerPrefix = "";
}
MingwBackend::~MingwBackend()
for ( i = 0; i < ProjectNode.modules.size (); i++ )
{
Module& module = *ProjectNode.modules[i];
+ if ( !module.enabled )
+ continue;
MingwModuleHandler* h = MingwModuleHandler::InstanciateHandler (
module,
this );
h.GenerateInvocations ();
h.GenerateCleanTarget ();
h.GenerateInstallTarget ();
+ h.GenerateDependsTarget ();
delete v[i];
}
printf ( "done\n" );
}
-
+
void
MingwBackend::Process ()
+{
+ if ( configuration.CheckDependenciesForModuleOnly )
+ CheckAutomaticDependenciesForModuleOnly ();
+ else
+ ProcessNormal ();
+}
+
+void
+MingwBackend::CheckAutomaticDependenciesForModuleOnly ()
+{
+ if ( configuration.AutomaticDependencies )
+ {
+ Module* module = ProjectNode.LocateModule ( configuration.CheckDependenciesForModuleOnlyModule );
+ if ( module == NULL )
+ {
+ printf ( "Module '%s' does not exist\n",
+ configuration.CheckDependenciesForModuleOnlyModule.c_str () );
+ return;
+ }
+
+ printf ( "Checking automatic dependencies for module '%s'...",
+ module->name.c_str () );
+ AutomaticDependency automaticDependency ( ProjectNode );
+ automaticDependency.CheckAutomaticDependencies ( *module,
+ configuration.Verbose );
+ printf ( "done\n" );
+ }
+}
+
+void
+MingwBackend::ProcessNormal ()
{
DetectCompiler ();
+ DetectNetwideAssembler ();
DetectPipeSupport ();
DetectPCHSupport ();
CreateMakefile ();
void
MingwBackend::GenerateGlobalVariables () const
{
+ fprintf ( fMakefile,
+ "PREFIX := %s\n",
+ compilerPrefix.c_str () );
+ fprintf ( fMakefile,
+ "nasm := %s\n",
+ nasmCommand.c_str () );
+
GenerateGlobalCFlagsAndProperties ( "=", ProjectNode.non_if_data );
GenerateProjectGccOptions ( "=", ProjectNode.non_if_data );
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{
Module& module = *ProjectNode.modules[i];
+ if ( !module.enabled )
+ continue;
if ( module.type == BuildTool )
{
if ( dependencies.length () > 0 )
fprintf ( fMakefile,
"REGTESTS_RUN_TARGET = regtests.dll\n" );
fprintf ( fMakefile,
- "$(REGTESTS_RUN_TARGET):\n" );
+ "$(REGTESTS_RUN_TARGET): $(REGTESTS_TARGET)\n" );
fprintf ( fMakefile,
"\t$(cp) $(REGTESTS_TARGET) $(REGTESTS_RUN_TARGET)\n" );
fprintf ( fMakefile, "\n" );
else
{
fprintf ( fMakefile,
- " \\\n",
- xmlbuildFilenames.c_str () );
+ " \\\n" );
}
xmlbuildFilenames.resize ( 0 );
}
printf ( "done\n" );
}
+string
+MingwBackend::GetProxyMakefileTree () const
+{
+ if ( configuration.GenerateProxyMakefilesInSourceTree )
+ return "";
+ else
+ return Environment::GetOutputPath ();
+}
+
void
MingwBackend::GenerateProxyMakefiles ()
{
printf ( "Generating proxy makefiles..." );
ProxyMakefile proxyMakefile ( ProjectNode );
- proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose );
+ proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose,
+ GetProxyMakefileTree () );
printf ( "done\n" );
}
{
printf ( "Checking automatic dependencies..." );
AutomaticDependency automaticDependency ( ProjectNode );
- automaticDependency.Process ();
automaticDependency.CheckAutomaticDependencies ( configuration.Verbose );
printf ( "done\n" );
}
MingwBackend::TryToDetectThisCompiler ( const string& compiler )
{
string command = ssprintf (
- "%s -v 2>%s",
+ "%s -v 1>%s 2>%s",
compiler.c_str (),
+ NUL,
NUL );
int exitcode = system ( command.c_str () );
return (exitcode == 0);
const string& ROS_PREFIXValue = Environment::GetVariable ( "ROS_PREFIX" );
if ( ROS_PREFIXValue.length () > 0 )
{
- compilerCommand = ROS_PREFIXValue + "-gcc";
+ compilerPrefix = ROS_PREFIXValue;
+ compilerCommand = compilerPrefix + "-gcc";
detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
}
#if defined(WIN32)
if ( !detectedCompiler )
{
+ compilerPrefix = "";
compilerCommand = "gcc";
detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
}
#endif
if ( !detectedCompiler )
{
- compilerCommand = "mingw32-gcc";
+ compilerPrefix = "mingw32";
+ compilerCommand = compilerPrefix + "-gcc";
detectedCompiler = TryToDetectThisCompiler ( compilerCommand );
}
if ( detectedCompiler )
printf ( "not detected\n" );
}
+bool
+MingwBackend::TryToDetectThisNetwideAssembler ( const string& assembler )
+{
+ string command = ssprintf (
+ "%s -h 1>%s 2>%s",
+ assembler.c_str (),
+ NUL,
+ NUL );
+ int exitcode = system ( command.c_str () );
+ return (exitcode == 0);
+}
+
+void
+MingwBackend::DetectNetwideAssembler ()
+{
+ printf ( "Detecting netwide assembler..." );
+
+ nasmCommand = "nasm";
+ bool detectedNasm = TryToDetectThisNetwideAssembler ( nasmCommand );
+#if defined(WIN32)
+ if ( !detectedNasm )
+ {
+ nasmCommand = "nasmw";
+ detectedNasm = TryToDetectThisNetwideAssembler ( nasmCommand );
+ }
+#endif
+ if ( detectedNasm )
+ printf ( "detected (%s)\n", nasmCommand.c_str () );
+ else
+ printf ( "not detected\n" );
+}
+
void
MingwBackend::DetectPipeSupport ()
{
string pipe_detectionObjectFilename = ReplaceExtension ( pipe_detection,
".o" );
string command = ssprintf (
- "%s -pipe -c %s -o %s 2>%s",
+ "%s -pipe -c %s -o %s 1>%s 2>%s",
compilerCommand.c_str (),
pipe_detection.c_str (),
pipe_detectionObjectFilename.c_str (),
+ NUL,
NUL );
int exitcode = system ( command.c_str () );
FILE* f = fopen ( pipe_detectionObjectFilename.c_str (), "rb" );
string path = "tools" SSEP "rbuild" SSEP "backend" SSEP "mingw" SSEP "pch_detection.h";
string cmd = ssprintf (
- "%s -c %s 2>%s",
+ "%s -c %s 1>%s 2>%s",
compilerCommand.c_str (),
path.c_str (),
+ NUL,
NUL );
system ( cmd.c_str () );
path += ".gch";
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{
const Module& module = *ProjectNode.modules[i];
+ if ( !module.enabled )
+ continue;
if ( module.installName.length () > 0 )
{
string targetFilenameNoFixup;
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{
const Module& module = *ProjectNode.modules[i];
+ if ( !module.enabled )
+ continue;
if ( module.installName.length () > 0 )
{
string sourceFilename = MingwModuleHandler::PassThruCacheDirectory (
NormalizeFilename ( module.GetPath () ),
outputDirectory );
OutputInstallTarget ( sourceFilename,
- module.installName,
- module.installBase );
+ module.installName,
+ module.installBase );
}
}
}
for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )
{
const Module& module = *ProjectNode.modules[i];
+ if ( !module.enabled )
+ continue;
if ( module.type == Test )
out.push_back ( module.name );
}