Verbose mode
authorCasper Hornstrup <chorns@users.sourceforge.net>
Sun, 3 Apr 2005 11:57:34 +0000 (11:57 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Sun, 3 Apr 2005 11:57:34 +0000 (11:57 +0000)
svn path=/branches/xmlbuildsystem/; revision=14471

reactos/Makefile
reactos/tools/rbuild/automaticdependency.cpp
reactos/tools/rbuild/backend/backend.cpp
reactos/tools/rbuild/backend/backend.h
reactos/tools/rbuild/backend/devcpp/devcpp.cpp
reactos/tools/rbuild/backend/devcpp/devcpp.h
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/mingw.h
reactos/tools/rbuild/rbuild.cpp
reactos/tools/rbuild/rbuild.h

index d676637..f9041b9 100644 (file)
@@ -28,6 +28,9 @@
 #        without source code) or no (to not build any map files). The variable
 #        defaults to no.
 #
+#    ROS_RBUILDFLAGS
+#        Pass parameters to rbuild.
+#
 
 .PHONY: all
 .PHONY: clean
@@ -196,7 +199,7 @@ PREAUTO := \
 
 makefile.auto: $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
        $(ECHO_RBUILD)
-       $(Q)$(RBUILD_TARGET) mingw
+       $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
 
 
 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
index 9e7964c..4e33bec 100644 (file)
@@ -65,9 +65,6 @@ SourceFile::Open ()
                throw AccessDeniedException ( filename );\r
        }\r
        lastWriteTime = statbuf.st_mtime;\r
-/*     printf ( "lastWriteTime of %s is %s\n",\r
-                 filename.c_str (),\r
-                 ctime ( &lastWriteTime ) ); */\r
 \r
        unsigned long len = (unsigned long) filelen ( f );\r
        if ( len > MAX_BYTES_TO_READ )\r
@@ -219,7 +216,6 @@ SourceFile::Parse ()
        while ( p < end )\r
        {\r
                string includedFilename ( "" );\r
-               //printf ( "Parsing '%s'\n", filename.c_str () );\r
                \r
                bool includeNext;\r
                while ( ReadInclude ( includedFilename,\r
@@ -387,13 +383,12 @@ AutomaticDependency::RetrieveFromCache ( const string& filename )
 }\r
 \r
 void\r
-AutomaticDependency::CheckAutomaticDependencies ()\r
+AutomaticDependency::CheckAutomaticDependencies ( bool verbose )\r
 {\r
        struct utimbuf timebuf;\r
        for ( size_t mi = 0; mi < project.modules.size (); mi++ )\r
        {\r
                const vector<File*>& files = project.modules[mi]->non_if_data.files;\r
-               //Module& module = *project.modules[mi];\r
                for ( size_t fi = 0; fi < files.size (); fi++ )\r
                {\r
                        File& file = *files[fi];\r
@@ -406,20 +401,16 @@ AutomaticDependency::CheckAutomaticDependencies ()
                                assert ( sourceFile->youngestLastWriteTime != 0 );\r
                                if ( sourceFile->youngestLastWriteTime > sourceFile->lastWriteTime )\r
                                {\r
-                                       printf ( "Marking %s for rebuild due to younger file %s\n",\r
-                                                sourceFile->filename.c_str (),\r
-                                                sourceFile->youngestFile->filename.c_str () );\r
+                                       if ( verbose )\r
+                                       {\r
+                                               printf ( "Marking %s for rebuild due to younger file %s\n",\r
+                                                        sourceFile->filename.c_str (),\r
+                                                        sourceFile->youngestFile->filename.c_str () );\r
+                                       }\r
                                        timebuf.actime = sourceFile->youngestLastWriteTime;\r
                                        timebuf.modtime = sourceFile->youngestLastWriteTime;\r
                                        utime ( sourceFile->filename.c_str (),\r
                                                &timebuf );\r
-\r
-                                       /*printf ( "lastWriteTime of %s is %s\n",\r
-                                                sourceFile->filename.c_str (),\r
-                                                ctime ( &sourceFile->lastWriteTime ) );\r
-                                       printf ( "youngestLastWriteTime is %s with %s\n",\r
-                                                sourceFile->youngestFile->filename.c_str (),\r
-                                                ctime ( &sourceFile->youngestLastWriteTime ) );*/\r
                                }\r
                        }\r
                }\r
index f6081e2..858b00e 100644 (file)
@@ -22,7 +22,7 @@ Backend::Factory::Factory ( const std::string& name_ )
        (*factories)[name] = this;\r
 }\r
 \r
-Backend::Factory::~Factory()\r
+Backend::Factory::~Factory ()\r
 {\r
        if ( !--ref )\r
        {\r
@@ -33,22 +33,26 @@ Backend::Factory::~Factory()
 \r
 /*static*/ Backend*\r
 Backend::Factory::Create ( const string& name,\r
-                           Project& project )\r
+                           Project& project,\r
+                           bool verbose )\r
 {\r
        string sname ( name );\r
        strlwr ( &sname[0] );\r
-       if ( !factories || !factories->size() )\r
-               throw Exception ( "internal tool error: no registered factories" );\r
+       if ( !factories || !factories->size () )\r
+               throw InvalidOperationException ( __FILE__,\r
+                                                 __LINE__,\r
+                                                 "No registered factories" );\r
        Backend::Factory* f = (*factories)[sname];\r
        if ( !f )\r
        {\r
                throw UnknownBackendException ( sname );\r
                return NULL;\r
        }\r
-       return (*f) ( project );\r
+       return (*f) ( project, verbose );\r
 }\r
 \r
-Backend::Backend ( Project& project )\r
-       : ProjectNode ( project )\r
+Backend::Backend ( Project& project, bool verbose )\r
+       : ProjectNode ( project ),\r
+         verbose ( verbose )\r
 {\r
 }\r
index c265682..ef95c86 100644 (file)
@@ -5,7 +5,8 @@
 \r
 class Backend;\r
 \r
-typedef Backend* BackendFactory ( Project& project );\r
+typedef Backend* BackendFactory ( Project& project,\r
+                                  bool verbose );\r
 \r
 class Backend\r
 {\r
@@ -20,23 +21,23 @@ public:
                Factory ( const std::string& name_ );\r
                virtual ~Factory();\r
 \r
-               virtual Backend* operator() ( Project& ) = 0;\r
+               virtual Backend* operator() ( Project&, bool verbose ) = 0;\r
 \r
        public:\r
                static Backend* Create ( const std::string& name,\r
-                                        Project& project );\r
-\r
-       private:\r
+                                        Project& project,\r
+                                        bool verbose );\r
        };\r
 \r
 protected:\r
-       Backend ( Project& project );\r
+       Backend ( Project& project, bool verbose );\r
 \r
 public:\r
        virtual void Process () = 0;\r
 \r
 protected:\r
        Project& ProjectNode;\r
+       bool verbose;\r
 };\r
 \r
 #endif /* __BACKEND_H */\r
index 4d8de61..d834415 100644 (file)
-/*
- * Dev-C++ Backend
- * Copyright (C) 2005  Trevor McCort
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
+/*\r
+ * Dev-C++ Backend\r
+ * Copyright (C) 2005  Trevor McCort\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
+ */\r
 \r
 #ifdef _MSC_VER\r
 #pragma warning ( disable : 4786 )\r
 #endif//_MSC_VER\r
-
-#include <iostream>
-#include <fstream>
-#include <string>
-
-#include "devcpp.h"
-
-using namespace std;
-
-static class DevCppFactory : public Backend::Factory
-{
-       public:
-
-               DevCppFactory() : Factory("devcpp") {}
-               Backend *operator() (Project &project)
-               {
-                       return new DevCppBackend(project);
-               }
-               
-} factory;
-
-
-DevCppBackend::DevCppBackend(Project &project) : Backend(project)
-{
-       m_unitCount = 0;
-}
-
-void DevCppBackend::Process()
-{
-       string filename = ProjectNode.name + ".dev";
-       
-       cout << "Creating Dev-C++ project: " << filename << endl;
-
-       ProcessModules();
-
-       m_devFile.open(filename.c_str());
-
-       if(!m_devFile.is_open())
-       {
-               cout << "Could not open file." << endl;
-               return;
-       }
-
-       m_devFile << "[Project]" << endl;
-       
-       m_devFile       << "FileName="                          << filename             << endl
-                               << "Name="                                      << ProjectNode.name     << endl
-                               << "UnitCount="                         << m_unitCount          << endl
-                               << "Type=1"                                     << endl
-                               << "Ver=1"                                      << endl
-                               << "ObjFiles="                          << endl
-                               << "Includes="                          << endl
-                               << "Libs="                                      << endl
-                               << "PrivateResource="           << endl
-                               << "ResourceIncludes="          << endl
-                               << "MakeIncludes="                      << endl
-                               << "Compiler="                          << endl
-                               << "CppCompiler="                       << endl
-                               << "Linker="                            << endl
-                               << "IsCpp=1"                            << endl
-                               << "Icon="                                      << endl
-                               << "ExeOutput="                         << endl
-                               << "ObjectOutput="                      << endl
-                               << "OverrideOutput=0"           << endl
-                               << "OverrideOutputName="        << endl
-                               << "HostApplication="           << endl
-                               << "CommandLine="                       << endl
-                               << "UseCustomMakefile=1"        << endl
-                               << "CustomMakefile="            << ProjectNode.makefile << endl
-                               << "IncludeVersionInto=0"       << endl
-                               << "SupportXPThemes=0"          << endl
-                               << "CompilerSet=0"                      << endl
-                               
-                               << "CompilerSettings=0000000000000000000000" << endl;
-       
-       OutputFolders();
-
-       m_devFile << endl << endl;
-
-       OutputFileUnits();
-
-       m_devFile.close();
-       
-       // Dev-C++ needs a makefile, so use the MinGW backend to create one.
-       
-       cout << "Creating Makefile: " << ProjectNode.makefile << endl;
-       
-       Backend *backend = Backend::Factory::Create("mingw", ProjectNode);
-       backend->Process();
-       delete backend;
-
-       cout << "Done." << endl << endl;
-
-       cout    << "You may want to disable Class browsing (see below) before you open this project in Dev-C++, as the "
-                       << "parsing required for large projects can take quite awhile."
-                       << endl << endl
-                       << "(Tools->Editor Options->Class browsing->Enable class browsing check box)"
-                       << endl << endl;
-}
-
-void DevCppBackend::ProcessModules()
-{
-       for(size_t i = 0; i < ProjectNode.modules.size(); i++)
-       {
-               Module &module = *ProjectNode.modules[i];
-
-               for(size_t k = 0; k < module.non_if_data.files.size(); k++)
-               {
-                       File &file = *module.non_if_data.files[k];
-                       
-                       ProcessFile(file.name);
-               }
-       }
-}
-
-bool FileExists(string &filename)
-{
-       ifstream file(filename.c_str());
-
-       if(!file.is_open())
-               return false;
-
-       file.close();
-       return true;
-}
-
-void DevCppBackend::ProcessFile(string &filepath)
-{
-       // Remove the .\ at the start of the filenames
-       filepath.erase(0, 2);
-
-       if(!FileExists(filepath))
-               return;
-
-       // Change the \ to /
-       for(size_t i = 0; i < filepath.length(); i++)
-       {
-               if(filepath[i] == '\\')
-                       filepath[i] = '/';
-       }
-
-       // Remove the filename from the path
-       string folder = "";
-
-       size_t pos = filepath.rfind(string("/"), filepath.length() - 1);
-
-       if(pos != string::npos)
-       {
-               folder = filepath;
-               folder.erase(pos, folder.length() - pos);
-       }
-       
-       FileUnit fileUnit;
-       fileUnit.filename = filepath;
-       fileUnit.folder = folder;
-
-       m_fileUnits.push_back(fileUnit);
-
-       if(folder != "")
-               AddFolders(folder);
-
-       m_unitCount++;
-}
-
-bool DevCppBackend::CheckFolderAdded(string &folder)
-{
-       for(size_t i = 0; i < m_folders.size(); i++)
-       {
-               if(m_folders[i] == folder)
-                       return true;
-       }
-
-       return false;
-}
-
-void DevCppBackend::AddFolders(string &folder)
-{
-       // Check if this folder was already added. true if it was, false otherwise.
-       if(CheckFolderAdded(folder))
-               return;
-       
-       m_folders.push_back(folder);
-       
-       size_t pos = folder.rfind(string("/"), folder.length() - 1);
-
-       if(pos == string::npos)
-               return;
-
-       folder.erase(pos, folder.length() - pos);
-       AddFolders(folder);
-}
-
-void DevCppBackend::OutputFolders()
-{
-       m_devFile << "Folders=";
-
-       for(size_t i = 0; i < m_folders.size(); i++)
-       {
-               if(i > 0)
-                       m_devFile << ",";
-
-               m_devFile << m_folders[i];
-       }
-}
-
-void DevCppBackend::OutputFileUnits()
-{
-       for(size_t i = 0; i < m_fileUnits.size(); i++)
-       {
-               m_devFile << "[Unit" << i + 1 << "]" << endl;
-               
-
-               m_devFile << "FileName="                        << m_fileUnits[i].filename << endl;
-               m_devFile << "CompileCpp=1"             << endl;
-               m_devFile << "Folder="                          << m_fileUnits[i].folder << endl;
-               m_devFile << "Compile=1"                        << endl;
-               m_devFile << "Link=1"                           << endl;
-               m_devFile << "Priority=1000"            << endl;
-               m_devFile << "OverrideBuildCmd=0"       << endl;
-               m_devFile << "BuildCmd="                        << endl << endl;;
-       }
-}
+\r
+#include <iostream>\r
+#include <fstream>\r
+#include <string>\r
+\r
+#include "devcpp.h"\r
+\r
+using namespace std;\r
+\r
+static class DevCppFactory : public Backend::Factory\r
+{\r
+       public:\r
+\r
+               DevCppFactory() : Factory("devcpp") {}\r
+               Backend *operator() (Project &project, bool verbose)\r
+               {\r
+                       return new DevCppBackend(project, verbose);\r
+               }\r
+               \r
+} factory;\r
+\r
+\r
+DevCppBackend::DevCppBackend(Project &project, bool verbose) : Backend(project, verbose)\r
+{\r
+       m_unitCount = 0;\r
+}\r
+\r
+void DevCppBackend::Process()\r
+{\r
+       string filename = ProjectNode.name + ".dev";\r
+       \r
+       cout << "Creating Dev-C++ project: " << filename << endl;\r
+\r
+       ProcessModules();\r
+\r
+       m_devFile.open(filename.c_str());\r
+\r
+       if(!m_devFile.is_open())\r
+       {\r
+               cout << "Could not open file." << endl;\r
+               return;\r
+       }\r
+\r
+       m_devFile << "[Project]" << endl;\r
+       \r
+       m_devFile       << "FileName="                          << filename             << endl\r
+                               << "Name="                                      << ProjectNode.name     << endl\r
+                               << "UnitCount="                         << m_unitCount          << endl\r
+                               << "Type=1"                                     << endl\r
+                               << "Ver=1"                                      << endl\r
+                               << "ObjFiles="                          << endl\r
+                               << "Includes="                          << endl\r
+                               << "Libs="                                      << endl\r
+                               << "PrivateResource="           << endl\r
+                               << "ResourceIncludes="          << endl\r
+                               << "MakeIncludes="                      << endl\r
+                               << "Compiler="                          << endl\r
+                               << "CppCompiler="                       << endl\r
+                               << "Linker="                            << endl\r
+                               << "IsCpp=1"                            << endl\r
+                               << "Icon="                                      << endl\r
+                               << "ExeOutput="                         << endl\r
+                               << "ObjectOutput="                      << endl\r
+                               << "OverrideOutput=0"           << endl\r
+                               << "OverrideOutputName="        << endl\r
+                               << "HostApplication="           << endl\r
+                               << "CommandLine="                       << endl\r
+                               << "UseCustomMakefile=1"        << endl\r
+                               << "CustomMakefile="            << ProjectNode.makefile << endl\r
+                               << "IncludeVersionInto=0"       << endl\r
+                               << "SupportXPThemes=0"          << endl\r
+                               << "CompilerSet=0"                      << endl\r
+                               \r
+                               << "CompilerSettings=0000000000000000000000" << endl;\r
+       \r
+       OutputFolders();\r
+\r
+       m_devFile << endl << endl;\r
+\r
+       OutputFileUnits();\r
+\r
+       m_devFile.close();\r
+       \r
+       // Dev-C++ needs a makefile, so use the MinGW backend to create one.\r
+       \r
+       cout << "Creating Makefile: " << ProjectNode.makefile << endl;\r
+       \r
+       Backend *backend = Backend::Factory::Create("mingw", ProjectNode, verbose );\r
+       backend->Process();\r
+       delete backend;\r
+\r
+       cout << "Done." << endl << endl;\r
+\r
+       cout    << "You may want to disable Class browsing (see below) before you open this project in Dev-C++, as the "\r
+                       << "parsing required for large projects can take quite awhile."\r
+                       << endl << endl\r
+                       << "(Tools->Editor Options->Class browsing->Enable class browsing check box)"\r
+                       << endl << endl;\r
+}\r
+\r
+void DevCppBackend::ProcessModules()\r
+{\r
+       for(size_t i = 0; i < ProjectNode.modules.size(); i++)\r
+       {\r
+               Module &module = *ProjectNode.modules[i];\r
+\r
+               for(size_t k = 0; k < module.non_if_data.files.size(); k++)\r
+               {\r
+                       File &file = *module.non_if_data.files[k];\r
+                       \r
+                       ProcessFile(file.name);\r
+               }\r
+       }\r
+}\r
+\r
+bool FileExists(string &filename)\r
+{\r
+       ifstream file(filename.c_str());\r
+\r
+       if(!file.is_open())\r
+               return false;\r
+\r
+       file.close();\r
+       return true;\r
+}\r
+\r
+void DevCppBackend::ProcessFile(string &filepath)\r
+{\r
+       // Remove the .\ at the start of the filenames\r
+       filepath.erase(0, 2);\r
+\r
+       if(!FileExists(filepath))\r
+               return;\r
+\r
+       // Change the \ to /\r
+       for(size_t i = 0; i < filepath.length(); i++)\r
+       {\r
+               if(filepath[i] == '\\')\r
+                       filepath[i] = '/';\r
+       }\r
+\r
+       // Remove the filename from the path\r
+       string folder = "";\r
+\r
+       size_t pos = filepath.rfind(string("/"), filepath.length() - 1);\r
+\r
+       if(pos != string::npos)\r
+       {\r
+               folder = filepath;\r
+               folder.erase(pos, folder.length() - pos);\r
+       }\r
+       \r
+       FileUnit fileUnit;\r
+       fileUnit.filename = filepath;\r
+       fileUnit.folder = folder;\r
+\r
+       m_fileUnits.push_back(fileUnit);\r
+\r
+       if(folder != "")\r
+               AddFolders(folder);\r
+\r
+       m_unitCount++;\r
+}\r
+\r
+bool DevCppBackend::CheckFolderAdded(string &folder)\r
+{\r
+       for(size_t i = 0; i < m_folders.size(); i++)\r
+       {\r
+               if(m_folders[i] == folder)\r
+                       return true;\r
+       }\r
+\r
+       return false;\r
+}\r
+\r
+void DevCppBackend::AddFolders(string &folder)\r
+{\r
+       // Check if this folder was already added. true if it was, false otherwise.\r
+       if(CheckFolderAdded(folder))\r
+               return;\r
+       \r
+       m_folders.push_back(folder);\r
+       \r
+       size_t pos = folder.rfind(string("/"), folder.length() - 1);\r
+\r
+       if(pos == string::npos)\r
+               return;\r
+\r
+       folder.erase(pos, folder.length() - pos);\r
+       AddFolders(folder);\r
+}\r
+\r
+void DevCppBackend::OutputFolders()\r
+{\r
+       m_devFile << "Folders=";\r
+\r
+       for(size_t i = 0; i < m_folders.size(); i++)\r
+       {\r
+               if(i > 0)\r
+                       m_devFile << ",";\r
+\r
+               m_devFile << m_folders[i];\r
+       }\r
+}\r
+\r
+void DevCppBackend::OutputFileUnits()\r
+{\r
+       for(size_t i = 0; i < m_fileUnits.size(); i++)\r
+       {\r
+               m_devFile << "[Unit" << i + 1 << "]" << endl;\r
+               \r
+\r
+               m_devFile << "FileName="                        << m_fileUnits[i].filename << endl;\r
+               m_devFile << "CompileCpp=1"             << endl;\r
+               m_devFile << "Folder="                          << m_fileUnits[i].folder << endl;\r
+               m_devFile << "Compile=1"                        << endl;\r
+               m_devFile << "Link=1"                           << endl;\r
+               m_devFile << "Priority=1000"            << endl;\r
+               m_devFile << "OverrideBuildCmd=0"       << endl;\r
+               m_devFile << "BuildCmd="                        << endl << endl;;\r
+       }\r
+}\r
index 4ea724a..2d9a393 100644 (file)
@@ -19,7 +19,7 @@ class DevCppBackend : public Backend
 {\r
        public:\r
 \r
-               DevCppBackend(Project &project);\r
+               DevCppBackend(Project &project, bool verbose);\r
                virtual ~DevCppBackend() {}\r
 \r
                virtual void Process();\r
index 7ecf501..27482c3 100644 (file)
@@ -27,7 +27,8 @@ public:
        directory_map subdirs;\r
        Directory ( const string& name );\r
        void Add ( const char* subdir );\r
-       void GenerateTree ( const string& parent );\r
+       void GenerateTree ( const string& parent,\r
+                           bool verbose );\r
 private:\r
        bool mkdir_p ( const char* path );\r
        string ReplaceVariable ( string name,\r
@@ -139,7 +140,8 @@ Directory::ResolveVariablesInPath ( char* buf,
 }\r
 \r
 void\r
-Directory::GenerateTree ( const string& parent )\r
+Directory::GenerateTree ( const string& parent,\r
+                             bool verbose )\r
 {\r
        string path;\r
 \r
@@ -149,7 +151,7 @@ Directory::GenerateTree ( const string& parent )
                \r
                path = parent + SSEP + name;\r
                ResolveVariablesInPath ( buf, path );\r
-               if ( CreateDirectory ( buf ) )\r
+               if ( CreateDirectory ( buf ) && verbose )\r
                        printf ( "Created %s\n", buf );\r
        }\r
        else\r
@@ -159,7 +161,7 @@ Directory::GenerateTree ( const string& parent )
                i != subdirs.end();\r
                ++i )\r
        {\r
-               i->second->GenerateTree ( path );\r
+               i->second->GenerateTree ( path, verbose );\r
        }\r
 }\r
 \r
@@ -167,15 +169,15 @@ static class MingwFactory : public Backend::Factory
 {\r
 public:\r
        MingwFactory() : Factory ( "mingw" ) {}\r
-       Backend* operator() ( Project& project )\r
+       Backend* operator() ( Project& project, bool verbose )\r
        {\r
-               return new MingwBackend ( project );\r
+               return new MingwBackend ( project, verbose );\r
        }\r
 } factory;\r
 \r
 \r
-MingwBackend::MingwBackend ( Project& project )\r
-       : Backend ( project ),\r
+MingwBackend::MingwBackend ( Project& project, bool verbose )\r
+       : Backend ( project, verbose ),\r
          int_directories ( new Directory("$(INTERMEDIATE)") ),\r
          out_directories ( new Directory("$(OUTPUT)") )\r
 {\r
@@ -202,20 +204,12 @@ MingwBackend::AddDirectoryTarget ( const string& directory, bool out )
 }\r
 \r
 void\r
-MingwBackend::Process ()\r
+MingwBackend::ProcessModules ()\r
 {\r
-       size_t i;\r
-\r
-       DetectPipeSupport ();\r
-       DetectPCHSupport ();\r
-\r
-       CreateMakefile ();\r
-       GenerateHeader ();\r
-       GenerateGlobalVariables ();\r
-       GenerateXmlBuildFilesMacro();\r
+       printf ( "Processing modules..." );\r
 \r
        vector<MingwModuleHandler*> v;\r
-\r
+       size_t i;\r
        for ( i = 0; i < ProjectNode.modules.size (); i++ )\r
        {\r
                Module& module = *ProjectNode.modules[i];\r
@@ -255,6 +249,19 @@ MingwBackend::Process ()
                delete v[i];\r
        }\r
 \r
+       printf ( "done\n" );\r
+}\r
+       \r
+void\r
+MingwBackend::Process ()\r
+{\r
+       DetectPipeSupport ();\r
+       DetectPCHSupport ();\r
+       CreateMakefile ();\r
+       GenerateHeader ();\r
+       GenerateGlobalVariables ();\r
+       GenerateXmlBuildFilesMacro ();\r
+       ProcessModules ();\r
        GenerateDirectories ();\r
        CheckAutomaticDependencies ();\r
        CloseMakefile ();\r
@@ -488,9 +495,11 @@ MingwBackend::GenerateXmlBuildFilesMacro() const
 void\r
 MingwBackend::CheckAutomaticDependencies ()\r
 {\r
+       printf ( "Checking automatic dependencies..." );\r
        AutomaticDependency automaticDependency ( ProjectNode );\r
        automaticDependency.Process ();\r
-       automaticDependency.CheckAutomaticDependencies ();\r
+       automaticDependency.CheckAutomaticDependencies ( verbose );\r
+       printf ( "done\n" );\r
 }\r
 \r
 bool\r
@@ -505,8 +514,10 @@ MingwBackend::IncludeDirectoryTarget ( const string& directory ) const
 void\r
 MingwBackend::GenerateDirectories ()\r
 {\r
-       int_directories->GenerateTree ( "" );\r
-       out_directories->GenerateTree ( "" );\r
+       printf ( "Creating directories..." );\r
+       int_directories->GenerateTree ( "", verbose );\r
+       out_directories->GenerateTree ( "", verbose );\r
+       printf ( "done\n" );\r
 }\r
 \r
 string\r
index 9616212..696bc35 100644 (file)
@@ -15,7 +15,7 @@ class MingwModuleHandler;
 class MingwBackend : public Backend\r
 {\r
 public:\r
-       MingwBackend ( Project& project );\r
+       MingwBackend ( Project& project, bool verbose );\r
        virtual ~MingwBackend ();\r
        virtual void Process ();\r
        std::string AddDirectoryTarget ( const std::string& directory, bool out );\r
@@ -40,6 +40,7 @@ private:
        bool IncludeDirectoryTarget ( const std::string& directory ) const;\r
        void DetectPipeSupport ();\r
        void DetectPCHSupport ();\r
+       void ProcessModules ();\r
        FILE* fMakefile;\r
        bool use_pch;\r
        Directory *int_directories, *out_directories;\r
index 0645792..bd3a79a 100644 (file)
 using std::string;\r
 using std::vector;\r
 \r
+static string BuildSystem;\r
+static bool Verbose = false;\r
+\r
+bool\r
+ParseSwitch ( int argc, char** argv, int index )\r
+{\r
+       char switchChar = argv[index][1];\r
+       switch ( switchChar )\r
+       {\r
+               case 'v':\r
+                       Verbose = true;\r
+                       break;\r
+               default:\r
+                       printf ( "Unknown switch -%c",\r
+                                switchChar );\r
+                       return false;\r
+       }\r
+       return true;\r
+}\r
+\r
+bool\r
+ParseArguments ( int argc, char** argv )\r
+{\r
+       if ( argc < 2 )\r
+               return false;\r
+       \r
+       for ( int i = 1; i < argc; i++ )\r
+       {\r
+               if ( argv[i][0] == '-' )\r
+               {\r
+                       if ( !ParseSwitch ( argc, argv, i ) )\r
+                               return false;\r
+               }\r
+               else\r
+                       BuildSystem = argv[i];\r
+       }\r
+       \r
+       return true;\r
+}\r
+\r
 int\r
 main ( int argc, char** argv )\r
 {\r
-       if ( argc != 2 )\r
+       if ( !ParseArguments ( argc, argv ) )\r
        {\r
-               printf ( "syntax: rbuild {buildtarget}\n" );\r
+               printf ( "Generates project files for buildsystems\n\n" );\r
+               printf ( "  rbuild [-v] buildsystem\n\n" );\r
+               printf ( "Switches:\n" );\r
+               printf ( "  -v           Be verbose\n" );\r
+               printf ( "\n" );\r
+               printf ( "  buildsystem  Target build system. Can be one of:\n" );\r
+               printf ( "                 mingw   MinGW\n" );\r
+               printf ( "                 devcpp  DevC++\n" );\r
                return 1;\r
        }\r
-       string buildtarget ( argv[1] );\r
-       strlwr ( &buildtarget[0] );\r
        try\r
        {\r
                string projectFilename ( "ReactOS.xml" );\r
+               printf ( "Reading build files..." );\r
                Project project ( projectFilename );\r
+               printf ( "done\n" );\r
                project.WriteConfigurationFile ();\r
                project.ExecuteInvocations ();\r
-               Backend* backend = Backend::Factory::Create ( buildtarget,\r
-                                                             project );\r
+               Backend* backend = Backend::Factory::Create ( BuildSystem,\r
+                                                             project,\r
+                                                             Verbose );\r
                backend->Process ();\r
                delete backend;\r
 \r
@@ -41,8 +89,8 @@ main ( int argc, char** argv )
        }\r
        catch (Exception& ex)\r
        {\r
-               printf ( "%s: %s\n",\r
-                        typeid(ex).name(), ex.Message.c_str() );\r
+               printf ( "%s\n",\r
+                        ex.Message.c_str () );\r
                return 1;\r
        }\r
 }\r
index 4dd7c02..b7db6cf 100644 (file)
@@ -469,7 +469,7 @@ public:
                                               const std::string& filename,\r
                                               SourceFile* parentSourceFile );\r
        SourceFile* RetrieveFromCache ( const std::string& filename );\r
-       void CheckAutomaticDependencies ();\r
+       void CheckAutomaticDependencies ( bool verbose );\r
        void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );\r
 private:\r
        void ProcessModule ( Module& module );\r