--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-05-29 11:42:46 UTC (rev 15655)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-05-29 11:51:37 UTC (rev 15656)
@@ -301,6 +301,7 @@
MingwBackend::Process ()
{
DetectCompiler ();
+ DetectNetwideAssembler ();
DetectPipeSupport ();
DetectPCHSupport ();
CreateMakefile ();
@@ -486,6 +487,9 @@
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 );
@@ -683,8 +687,9 @@
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);
@@ -723,7 +728,39 @@
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 ()
{
printf ( "Detecting compiler -pipe support..." );
@@ -732,10 +769,11 @@
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" );
@@ -761,9 +799,10 @@
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";
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-05-29 11:42:46 UTC (rev 15655)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-05-29 11:51:37 UTC (rev 15656)
@@ -53,6 +53,7 @@
Directory* directoryTree );
std::string compilerPrefix;
std::string compilerCommand;
+ std::string nasmCommand;
bool usePipe;
Directory* intermediateDirectory;
Directory* outputDirectory;
@@ -87,6 +88,8 @@
bool IncludeDirectoryTarget ( const std::string& directory ) const;
bool TryToDetectThisCompiler ( const std::string& compiler );
void DetectCompiler ();
+ bool TryToDetectThisNetwideAssembler ( const std::string& assembler );
+ void DetectNetwideAssembler ();
void DetectPipeSupport ();
void DetectPCHSupport ();
void ProcessModules ();