From 083a71c9f24eaf4cee85d71ca38314c8e0583137 Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Thu, 19 May 2005 19:53:01 +0000 Subject: [PATCH] Option to disable automatic dependencies svn path=/branches/xmlbuildsystem/; revision=15413 --- reactos/tools/rbuild/backend/backend.cpp | 11 +++--- reactos/tools/rbuild/backend/backend.h | 14 +++----- .../tools/rbuild/backend/devcpp/devcpp.cpp | 11 +++--- reactos/tools/rbuild/backend/devcpp/devcpp.h | 3 +- reactos/tools/rbuild/backend/mingw/mingw.cpp | 36 +++++++++---------- reactos/tools/rbuild/backend/mingw/mingw.h | 3 +- .../rbuild/backend/mingw/modulehandler.cpp | 2 +- reactos/tools/rbuild/configuration.cpp | 15 ++++++++ reactos/tools/rbuild/rbuild.cpp | 14 ++++---- reactos/tools/rbuild/rbuild.h | 10 ++++++ reactos/tools/rbuild/rbuild.mak | 5 +++ 11 files changed, 72 insertions(+), 52 deletions(-) create mode 100644 reactos/tools/rbuild/configuration.cpp diff --git a/reactos/tools/rbuild/backend/backend.cpp b/reactos/tools/rbuild/backend/backend.cpp index c898ed37d60..0211d657ddb 100644 --- a/reactos/tools/rbuild/backend/backend.cpp +++ b/reactos/tools/rbuild/backend/backend.cpp @@ -34,8 +34,7 @@ Backend::Factory::~Factory () /*static*/ Backend* Backend::Factory::Create ( const string& name, Project& project, - bool verbose, - bool cleanAsYouGo ) + Configuration& configuration ) { string sname ( name ); strlwr ( &sname[0] ); @@ -49,14 +48,12 @@ Backend::Factory::Create ( const string& name, throw UnknownBackendException ( sname ); return NULL; } - return (*f) ( project, verbose, cleanAsYouGo ); + return (*f) ( project, configuration ); } Backend::Backend ( Project& project, - bool verbose, - bool cleanAsYouGo ) + Configuration& configuration ) : ProjectNode ( project ), - verbose ( verbose ), - cleanAsYouGo ( cleanAsYouGo ) + configuration ( configuration ) { } diff --git a/reactos/tools/rbuild/backend/backend.h b/reactos/tools/rbuild/backend/backend.h index 51a7861c348..c1ab033f314 100644 --- a/reactos/tools/rbuild/backend/backend.h +++ b/reactos/tools/rbuild/backend/backend.h @@ -6,7 +6,7 @@ class Backend; typedef Backend* BackendFactory ( Project& project, - bool verbose ); + Configuration& configuration ); class Backend { @@ -22,26 +22,22 @@ public: virtual ~Factory(); virtual Backend* operator() ( Project&, - bool verbose, - bool cleanAsYouGo ) = 0; + Configuration& configuration ) = 0; public: static Backend* Create ( const std::string& name, Project& project, - bool verbose, - bool cleanAsYouGo ); + Configuration& configuration ); }; protected: Backend ( Project& project, - bool verbose, - bool cleanAsYouGo ); + Configuration& configuration ); public: virtual void Process () = 0; Project& ProjectNode; - bool verbose; - bool cleanAsYouGo; + Configuration& configuration; }; #endif /* __BACKEND_H */ diff --git a/reactos/tools/rbuild/backend/devcpp/devcpp.cpp b/reactos/tools/rbuild/backend/devcpp/devcpp.cpp index 83ec32d7775..f156ceb73c3 100644 --- a/reactos/tools/rbuild/backend/devcpp/devcpp.cpp +++ b/reactos/tools/rbuild/backend/devcpp/devcpp.cpp @@ -35,18 +35,16 @@ static class DevCppFactory : public Backend::Factory DevCppFactory() : Factory("devcpp") {} Backend *operator() (Project &project, - bool verbose, - bool cleanAsYouGo) + Configuration& configuration) { - return new DevCppBackend(project, verbose, cleanAsYouGo); + return new DevCppBackend(project, configuration); } } factory; DevCppBackend::DevCppBackend(Project &project, - bool verbose, - bool cleanAsYouGo) : Backend(project, verbose, cleanAsYouGo) + Configuration& configuration) : Backend(project, configuration) { m_unitCount = 0; } @@ -113,8 +111,7 @@ void DevCppBackend::Process() Backend *backend = Backend::Factory::Create("mingw", ProjectNode, - verbose, - cleanAsYouGo ); + configuration ); backend->Process(); delete backend; diff --git a/reactos/tools/rbuild/backend/devcpp/devcpp.h b/reactos/tools/rbuild/backend/devcpp/devcpp.h index 21a3f1c57b8..d798e9ac7d9 100644 --- a/reactos/tools/rbuild/backend/devcpp/devcpp.h +++ b/reactos/tools/rbuild/backend/devcpp/devcpp.h @@ -20,8 +20,7 @@ class DevCppBackend : public Backend public: DevCppBackend(Project &project, - bool verbose, - bool cleanAsYouGo); + Configuration& configuration); virtual ~DevCppBackend() {} virtual void Process(); diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 11e022f56ec..44050f9e08e 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -212,20 +212,17 @@ static class MingwFactory : public Backend::Factory public: MingwFactory() : Factory ( "mingw" ) {} Backend* operator() ( Project& project, - bool verbose, - bool cleanAsYouGo ) + Configuration& configuration ) { return new MingwBackend ( project, - verbose, - cleanAsYouGo ); + configuration ); } } factory; MingwBackend::MingwBackend ( Project& project, - bool verbose, - bool cleanAsYouGo ) - : Backend ( project, verbose, cleanAsYouGo ), + Configuration& configuration ) + : Backend ( project, configuration ), intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ), outputDirectory ( new Directory ( "$(OUTPUT)" ) ), installDirectory ( new Directory ( "$(INSTALL)" ) ) @@ -622,7 +619,7 @@ MingwBackend::UnpackWineResources () printf ( "Unpacking WINE resources..." ); WineResource wineResource ( ProjectNode, GetBin2ResExecutable () ); - wineResource.UnpackResources ( verbose ); + wineResource.UnpackResources ( configuration.Verbose ); printf ( "done\n" ); } @@ -631,7 +628,7 @@ MingwBackend::GenerateTestSupportCode () { printf ( "Generating test support code..." ); TestSupportCode testSupportCode ( ProjectNode ); - testSupportCode.GenerateTestSupportCode ( verbose ); + testSupportCode.GenerateTestSupportCode ( configuration.Verbose ); printf ( "done\n" ); } @@ -640,18 +637,21 @@ MingwBackend::GenerateProxyMakefiles () { printf ( "Generating proxy makefiles..." ); ProxyMakefile proxyMakefile ( ProjectNode ); - proxyMakefile.GenerateProxyMakefiles ( verbose ); + proxyMakefile.GenerateProxyMakefiles ( configuration.Verbose ); printf ( "done\n" ); } void MingwBackend::CheckAutomaticDependencies () { - printf ( "Checking automatic dependencies..." ); - AutomaticDependency automaticDependency ( ProjectNode ); - automaticDependency.Process (); - automaticDependency.CheckAutomaticDependencies ( verbose ); - printf ( "done\n" ); + if ( configuration.AutomaticDependencies ) + { + printf ( "Checking automatic dependencies..." ); + AutomaticDependency automaticDependency ( ProjectNode ); + automaticDependency.Process (); + automaticDependency.CheckAutomaticDependencies ( configuration.Verbose ); + printf ( "done\n" ); + } } bool @@ -667,9 +667,9 @@ void MingwBackend::GenerateDirectories () { printf ( "Creating directories..." ); - intermediateDirectory->GenerateTree ( "", verbose ); - outputDirectory->GenerateTree ( "", verbose ); - installDirectory->GenerateTree ( "", verbose ); + intermediateDirectory->GenerateTree ( "", configuration.Verbose ); + outputDirectory->GenerateTree ( "", configuration.Verbose ); + installDirectory->GenerateTree ( "", configuration.Verbose ); printf ( "done\n" ); } diff --git a/reactos/tools/rbuild/backend/mingw/mingw.h b/reactos/tools/rbuild/backend/mingw/mingw.h index 88380d76d5d..57ba775837f 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.h +++ b/reactos/tools/rbuild/backend/mingw/mingw.h @@ -46,8 +46,7 @@ class MingwBackend : public Backend { public: MingwBackend ( Project& project, - bool verbose, - bool cleanAsYouGo ); + Configuration& configuration ); virtual ~MingwBackend (); virtual void Process (); std::string AddDirectoryTarget ( const std::string& directory, diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index bb7ec44c28e..cc08990ac3f 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -1280,7 +1280,7 @@ MingwModuleHandler::GetObjectsVector ( const IfableData& data, void MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const { - if ( backend->cleanAsYouGo ) + if ( backend->configuration.CleanAsYouGo ) { vector objectFiles; GetObjectsVector ( module.non_if_data, diff --git a/reactos/tools/rbuild/configuration.cpp b/reactos/tools/rbuild/configuration.cpp new file mode 100644 index 00000000000..64bd3b76063 --- /dev/null +++ b/reactos/tools/rbuild/configuration.cpp @@ -0,0 +1,15 @@ +#include "pch.h" +#include + +#include "rbuild.h" + +Configuration::Configuration () +{ + Verbose = false; + CleanAsYouGo = false; + AutomaticDependencies = true; +} + +Configuration::~Configuration () +{ +} diff --git a/reactos/tools/rbuild/rbuild.cpp b/reactos/tools/rbuild/rbuild.cpp index eefcf144ebe..65021458600 100644 --- a/reactos/tools/rbuild/rbuild.cpp +++ b/reactos/tools/rbuild/rbuild.cpp @@ -18,8 +18,7 @@ using std::vector; static string BuildSystem; static string RootXmlFile = "ReactOS.xml"; -static bool Verbose = false; -static bool CleanAsYouGo = false; +static Configuration configuration; bool ParseSwitch ( int argc, char** argv, int index ) @@ -28,10 +27,13 @@ ParseSwitch ( int argc, char** argv, int index ) switch ( switchChar ) { case 'v': - Verbose = true; + configuration.Verbose = true; break; case 'c': - CleanAsYouGo = true; + configuration.CleanAsYouGo = true; + break; + case 'd': + configuration.AutomaticDependencies = false; break; case 'r': RootXmlFile = string(&argv[index][2]); @@ -74,6 +76,7 @@ main ( int argc, char** argv ) printf ( "Switches:\n" ); printf ( " -v Be verbose\n" ); printf ( " -c Clean as you go. Delete generated files as soon as they are not needed anymore\n" ); + printf ( " -d Disable automatic dependencies.\n" ); printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml\n" ); printf ( "\n" ); printf ( " buildsystem Target build system. Can be one of:\n" ); @@ -91,8 +94,7 @@ main ( int argc, char** argv ) project.ExecuteInvocations (); Backend* backend = Backend::Factory::Create ( BuildSystem, project, - Verbose, - CleanAsYouGo ); + configuration ); backend->Process (); delete backend; diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 7174a92a266..5e8c982c89f 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -68,6 +68,16 @@ class StubbedSymbol; class SourceFileTest; +class Configuration +{ +public: + Configuration (); + ~Configuration (); + bool Verbose; + bool CleanAsYouGo; + bool AutomaticDependencies; +}; + class Environment { public: diff --git a/reactos/tools/rbuild/rbuild.mak b/reactos/tools/rbuild/rbuild.mak index 7f2f79907df..0b975995f05 100644 --- a/reactos/tools/rbuild/rbuild.mak +++ b/reactos/tools/rbuild/rbuild.mak @@ -115,6 +115,7 @@ RBUILD_COMMON_SOURCES = \ bootstrap.cpp \ cdfile.cpp \ compilerflag.cpp \ + configuration.cpp \ define.cpp \ exception.cpp \ filesupportcode.cpp \ @@ -225,6 +226,10 @@ $(RBUILD_INT_)compilerflag.o: $(RBUILD_BASE_)compilerflag.cpp $(RBUILD_HEADERS) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ +$(RBUILD_INT_)configuration.o: $(RBUILD_BASE_)configuration.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + $(RBUILD_INT_)define.o: $(RBUILD_BASE_)define.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@