mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 07:22:43 +00:00
Verbose mode
svn path=/branches/xmlbuildsystem/; revision=14471
This commit is contained in:
parent
2c65178fde
commit
c4387e8d7d
10 changed files with 362 additions and 303 deletions
|
@ -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)
|
||||
|
|
|
@ -65,9 +65,6 @@ SourceFile::Open ()
|
|||
throw AccessDeniedException ( filename );
|
||||
}
|
||||
lastWriteTime = statbuf.st_mtime;
|
||||
/* printf ( "lastWriteTime of %s is %s\n",
|
||||
filename.c_str (),
|
||||
ctime ( &lastWriteTime ) ); */
|
||||
|
||||
unsigned long len = (unsigned long) filelen ( f );
|
||||
if ( len > MAX_BYTES_TO_READ )
|
||||
|
@ -219,7 +216,6 @@ SourceFile::Parse ()
|
|||
while ( p < end )
|
||||
{
|
||||
string includedFilename ( "" );
|
||||
//printf ( "Parsing '%s'\n", filename.c_str () );
|
||||
|
||||
bool includeNext;
|
||||
while ( ReadInclude ( includedFilename,
|
||||
|
@ -387,13 +383,12 @@ AutomaticDependency::RetrieveFromCache ( const string& filename )
|
|||
}
|
||||
|
||||
void
|
||||
AutomaticDependency::CheckAutomaticDependencies ()
|
||||
AutomaticDependency::CheckAutomaticDependencies ( bool verbose )
|
||||
{
|
||||
struct utimbuf timebuf;
|
||||
for ( size_t mi = 0; mi < project.modules.size (); mi++ )
|
||||
{
|
||||
const vector<File*>& files = project.modules[mi]->non_if_data.files;
|
||||
//Module& module = *project.modules[mi];
|
||||
for ( size_t fi = 0; fi < files.size (); fi++ )
|
||||
{
|
||||
File& file = *files[fi];
|
||||
|
@ -406,20 +401,16 @@ AutomaticDependency::CheckAutomaticDependencies ()
|
|||
assert ( sourceFile->youngestLastWriteTime != 0 );
|
||||
if ( sourceFile->youngestLastWriteTime > sourceFile->lastWriteTime )
|
||||
{
|
||||
printf ( "Marking %s for rebuild due to younger file %s\n",
|
||||
sourceFile->filename.c_str (),
|
||||
sourceFile->youngestFile->filename.c_str () );
|
||||
if ( verbose )
|
||||
{
|
||||
printf ( "Marking %s for rebuild due to younger file %s\n",
|
||||
sourceFile->filename.c_str (),
|
||||
sourceFile->youngestFile->filename.c_str () );
|
||||
}
|
||||
timebuf.actime = sourceFile->youngestLastWriteTime;
|
||||
timebuf.modtime = sourceFile->youngestLastWriteTime;
|
||||
utime ( sourceFile->filename.c_str (),
|
||||
&timebuf );
|
||||
|
||||
/*printf ( "lastWriteTime of %s is %s\n",
|
||||
sourceFile->filename.c_str (),
|
||||
ctime ( &sourceFile->lastWriteTime ) );
|
||||
printf ( "youngestLastWriteTime is %s with %s\n",
|
||||
sourceFile->youngestFile->filename.c_str (),
|
||||
ctime ( &sourceFile->youngestLastWriteTime ) );*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ Backend::Factory::Factory ( const std::string& name_ )
|
|||
(*factories)[name] = this;
|
||||
}
|
||||
|
||||
Backend::Factory::~Factory()
|
||||
Backend::Factory::~Factory ()
|
||||
{
|
||||
if ( !--ref )
|
||||
{
|
||||
|
@ -33,22 +33,26 @@ Backend::Factory::~Factory()
|
|||
|
||||
/*static*/ Backend*
|
||||
Backend::Factory::Create ( const string& name,
|
||||
Project& project )
|
||||
Project& project,
|
||||
bool verbose )
|
||||
{
|
||||
string sname ( name );
|
||||
strlwr ( &sname[0] );
|
||||
if ( !factories || !factories->size() )
|
||||
throw Exception ( "internal tool error: no registered factories" );
|
||||
if ( !factories || !factories->size () )
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__,
|
||||
"No registered factories" );
|
||||
Backend::Factory* f = (*factories)[sname];
|
||||
if ( !f )
|
||||
{
|
||||
throw UnknownBackendException ( sname );
|
||||
return NULL;
|
||||
}
|
||||
return (*f) ( project );
|
||||
return (*f) ( project, verbose );
|
||||
}
|
||||
|
||||
Backend::Backend ( Project& project )
|
||||
: ProjectNode ( project )
|
||||
Backend::Backend ( Project& project, bool verbose )
|
||||
: ProjectNode ( project ),
|
||||
verbose ( verbose )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
class Backend;
|
||||
|
||||
typedef Backend* BackendFactory ( Project& project );
|
||||
typedef Backend* BackendFactory ( Project& project,
|
||||
bool verbose );
|
||||
|
||||
class Backend
|
||||
{
|
||||
|
@ -20,23 +21,23 @@ public:
|
|||
Factory ( const std::string& name_ );
|
||||
virtual ~Factory();
|
||||
|
||||
virtual Backend* operator() ( Project& ) = 0;
|
||||
virtual Backend* operator() ( Project&, bool verbose ) = 0;
|
||||
|
||||
public:
|
||||
static Backend* Create ( const std::string& name,
|
||||
Project& project );
|
||||
|
||||
private:
|
||||
Project& project,
|
||||
bool verbose );
|
||||
};
|
||||
|
||||
protected:
|
||||
Backend ( Project& project );
|
||||
Backend ( Project& project, bool verbose );
|
||||
|
||||
public:
|
||||
virtual void Process () = 0;
|
||||
|
||||
protected:
|
||||
Project& ProjectNode;
|
||||
bool verbose;
|
||||
};
|
||||
|
||||
#endif /* __BACKEND_H */
|
||||
|
|
|
@ -1,244 +1,244 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif//_MSC_VER
|
||||
|
||||
#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;;
|
||||
}
|
||||
}
|
||||
|
||||
#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, bool verbose)
|
||||
{
|
||||
return new DevCppBackend(project, verbose);
|
||||
}
|
||||
|
||||
} factory;
|
||||
|
||||
|
||||
DevCppBackend::DevCppBackend(Project &project, bool verbose) : Backend(project, verbose)
|
||||
{
|
||||
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, verbose );
|
||||
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;;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class DevCppBackend : public Backend
|
|||
{
|
||||
public:
|
||||
|
||||
DevCppBackend(Project &project);
|
||||
DevCppBackend(Project &project, bool verbose);
|
||||
virtual ~DevCppBackend() {}
|
||||
|
||||
virtual void Process();
|
||||
|
|
|
@ -27,7 +27,8 @@ public:
|
|||
directory_map subdirs;
|
||||
Directory ( const string& name );
|
||||
void Add ( const char* subdir );
|
||||
void GenerateTree ( const string& parent );
|
||||
void GenerateTree ( const string& parent,
|
||||
bool verbose );
|
||||
private:
|
||||
bool mkdir_p ( const char* path );
|
||||
string ReplaceVariable ( string name,
|
||||
|
@ -139,7 +140,8 @@ Directory::ResolveVariablesInPath ( char* buf,
|
|||
}
|
||||
|
||||
void
|
||||
Directory::GenerateTree ( const string& parent )
|
||||
Directory::GenerateTree ( const string& parent,
|
||||
bool verbose )
|
||||
{
|
||||
string path;
|
||||
|
||||
|
@ -149,7 +151,7 @@ Directory::GenerateTree ( const string& parent )
|
|||
|
||||
path = parent + SSEP + name;
|
||||
ResolveVariablesInPath ( buf, path );
|
||||
if ( CreateDirectory ( buf ) )
|
||||
if ( CreateDirectory ( buf ) && verbose )
|
||||
printf ( "Created %s\n", buf );
|
||||
}
|
||||
else
|
||||
|
@ -159,7 +161,7 @@ Directory::GenerateTree ( const string& parent )
|
|||
i != subdirs.end();
|
||||
++i )
|
||||
{
|
||||
i->second->GenerateTree ( path );
|
||||
i->second->GenerateTree ( path, verbose );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,15 +169,15 @@ static class MingwFactory : public Backend::Factory
|
|||
{
|
||||
public:
|
||||
MingwFactory() : Factory ( "mingw" ) {}
|
||||
Backend* operator() ( Project& project )
|
||||
Backend* operator() ( Project& project, bool verbose )
|
||||
{
|
||||
return new MingwBackend ( project );
|
||||
return new MingwBackend ( project, verbose );
|
||||
}
|
||||
} factory;
|
||||
|
||||
|
||||
MingwBackend::MingwBackend ( Project& project )
|
||||
: Backend ( project ),
|
||||
MingwBackend::MingwBackend ( Project& project, bool verbose )
|
||||
: Backend ( project, verbose ),
|
||||
int_directories ( new Directory("$(INTERMEDIATE)") ),
|
||||
out_directories ( new Directory("$(OUTPUT)") )
|
||||
{
|
||||
|
@ -202,20 +204,12 @@ MingwBackend::AddDirectoryTarget ( const string& directory, bool out )
|
|||
}
|
||||
|
||||
void
|
||||
MingwBackend::Process ()
|
||||
MingwBackend::ProcessModules ()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
DetectPipeSupport ();
|
||||
DetectPCHSupport ();
|
||||
|
||||
CreateMakefile ();
|
||||
GenerateHeader ();
|
||||
GenerateGlobalVariables ();
|
||||
GenerateXmlBuildFilesMacro();
|
||||
printf ( "Processing modules..." );
|
||||
|
||||
vector<MingwModuleHandler*> v;
|
||||
|
||||
size_t i;
|
||||
for ( i = 0; i < ProjectNode.modules.size (); i++ )
|
||||
{
|
||||
Module& module = *ProjectNode.modules[i];
|
||||
|
@ -255,6 +249,19 @@ MingwBackend::Process ()
|
|||
delete v[i];
|
||||
}
|
||||
|
||||
printf ( "done\n" );
|
||||
}
|
||||
|
||||
void
|
||||
MingwBackend::Process ()
|
||||
{
|
||||
DetectPipeSupport ();
|
||||
DetectPCHSupport ();
|
||||
CreateMakefile ();
|
||||
GenerateHeader ();
|
||||
GenerateGlobalVariables ();
|
||||
GenerateXmlBuildFilesMacro ();
|
||||
ProcessModules ();
|
||||
GenerateDirectories ();
|
||||
CheckAutomaticDependencies ();
|
||||
CloseMakefile ();
|
||||
|
@ -488,9 +495,11 @@ MingwBackend::GenerateXmlBuildFilesMacro() const
|
|||
void
|
||||
MingwBackend::CheckAutomaticDependencies ()
|
||||
{
|
||||
printf ( "Checking automatic dependencies..." );
|
||||
AutomaticDependency automaticDependency ( ProjectNode );
|
||||
automaticDependency.Process ();
|
||||
automaticDependency.CheckAutomaticDependencies ();
|
||||
automaticDependency.CheckAutomaticDependencies ( verbose );
|
||||
printf ( "done\n" );
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -505,8 +514,10 @@ MingwBackend::IncludeDirectoryTarget ( const string& directory ) const
|
|||
void
|
||||
MingwBackend::GenerateDirectories ()
|
||||
{
|
||||
int_directories->GenerateTree ( "" );
|
||||
out_directories->GenerateTree ( "" );
|
||||
printf ( "Creating directories..." );
|
||||
int_directories->GenerateTree ( "", verbose );
|
||||
out_directories->GenerateTree ( "", verbose );
|
||||
printf ( "done\n" );
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -15,7 +15,7 @@ class MingwModuleHandler;
|
|||
class MingwBackend : public Backend
|
||||
{
|
||||
public:
|
||||
MingwBackend ( Project& project );
|
||||
MingwBackend ( Project& project, bool verbose );
|
||||
virtual ~MingwBackend ();
|
||||
virtual void Process ();
|
||||
std::string AddDirectoryTarget ( const std::string& directory, bool out );
|
||||
|
@ -40,6 +40,7 @@ private:
|
|||
bool IncludeDirectoryTarget ( const std::string& directory ) const;
|
||||
void DetectPipeSupport ();
|
||||
void DetectPCHSupport ();
|
||||
void ProcessModules ();
|
||||
FILE* fMakefile;
|
||||
bool use_pch;
|
||||
Directory *int_directories, *out_directories;
|
||||
|
|
|
@ -16,24 +16,72 @@
|
|||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
static string BuildSystem;
|
||||
static bool Verbose = false;
|
||||
|
||||
bool
|
||||
ParseSwitch ( int argc, char** argv, int index )
|
||||
{
|
||||
char switchChar = argv[index][1];
|
||||
switch ( switchChar )
|
||||
{
|
||||
case 'v':
|
||||
Verbose = true;
|
||||
break;
|
||||
default:
|
||||
printf ( "Unknown switch -%c",
|
||||
switchChar );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ParseArguments ( int argc, char** argv )
|
||||
{
|
||||
if ( argc < 2 )
|
||||
return false;
|
||||
|
||||
for ( int i = 1; i < argc; i++ )
|
||||
{
|
||||
if ( argv[i][0] == '-' )
|
||||
{
|
||||
if ( !ParseSwitch ( argc, argv, i ) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
BuildSystem = argv[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main ( int argc, char** argv )
|
||||
{
|
||||
if ( argc != 2 )
|
||||
if ( !ParseArguments ( argc, argv ) )
|
||||
{
|
||||
printf ( "syntax: rbuild {buildtarget}\n" );
|
||||
printf ( "Generates project files for buildsystems\n\n" );
|
||||
printf ( " rbuild [-v] buildsystem\n\n" );
|
||||
printf ( "Switches:\n" );
|
||||
printf ( " -v Be verbose\n" );
|
||||
printf ( "\n" );
|
||||
printf ( " buildsystem Target build system. Can be one of:\n" );
|
||||
printf ( " mingw MinGW\n" );
|
||||
printf ( " devcpp DevC++\n" );
|
||||
return 1;
|
||||
}
|
||||
string buildtarget ( argv[1] );
|
||||
strlwr ( &buildtarget[0] );
|
||||
try
|
||||
{
|
||||
string projectFilename ( "ReactOS.xml" );
|
||||
printf ( "Reading build files..." );
|
||||
Project project ( projectFilename );
|
||||
printf ( "done\n" );
|
||||
project.WriteConfigurationFile ();
|
||||
project.ExecuteInvocations ();
|
||||
Backend* backend = Backend::Factory::Create ( buildtarget,
|
||||
project );
|
||||
Backend* backend = Backend::Factory::Create ( BuildSystem,
|
||||
project,
|
||||
Verbose );
|
||||
backend->Process ();
|
||||
delete backend;
|
||||
|
||||
|
@ -41,8 +89,8 @@ main ( int argc, char** argv )
|
|||
}
|
||||
catch (Exception& ex)
|
||||
{
|
||||
printf ( "%s: %s\n",
|
||||
typeid(ex).name(), ex.Message.c_str() );
|
||||
printf ( "%s\n",
|
||||
ex.Message.c_str () );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -469,7 +469,7 @@ public:
|
|||
const std::string& filename,
|
||||
SourceFile* parentSourceFile );
|
||||
SourceFile* RetrieveFromCache ( const std::string& filename );
|
||||
void CheckAutomaticDependencies ();
|
||||
void CheckAutomaticDependencies ( bool verbose );
|
||||
void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
|
||||
private:
|
||||
void ProcessModule ( Module& module );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue