Author: cfinck Date: Sun Feb 17 00:08:03 2008 New Revision: 32394
URL: http://svn.reactos.org/svn/reactos?rev=32394&view=rev Log: - Autogenerate the "architecture.h" header file, so we don't need to keep the same information up to date in two places. - Rename GetArchCdPath to GetArchCdRoot to be consistent with the name of the define in "architecture.h". - Add ARM to the rbuild architecture list (needed when the branch will be merged back to trunk).
Added: branches/rbuild/reactos/tools/rbuild/architectureheadergenerator.cpp (with props) Removed: branches/rbuild/reactos/include/reactos/architecture.h Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h branches/rbuild/reactos/tools/rbuild/backend/mingw/modulehandler.cpp branches/rbuild/reactos/tools/rbuild/project.cpp branches/rbuild/reactos/tools/rbuild/rbuild.h branches/rbuild/reactos/tools/rbuild/rbuild.mak branches/rbuild/reactos/tools/rbuild/rbuild.vcproj
Removed: branches/rbuild/reactos/include/reactos/architecture.h URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/include/reactos/a... ============================================================================== --- branches/rbuild/reactos/include/reactos/architecture.h (original) +++ branches/rbuild/reactos/include/reactos/architecture.h (removed) @@ -1,14 +1,0 @@ -// Simple header for defining architecture-dependent settings - -#ifndef _REACTOS_ARCHITECTURE_H -#define _REACTOS_ARCHITECTURE_H - -#if defined(_M_IX86) -# define ARCH_CD_ROOT "I386" -#elif defined(_M_PPC) -# define ARCH_CD_ROOT "PPC" -#else -# error Unsupported architecture -#endif - -#endif
Added: branches/rbuild/reactos/tools/rbuild/architectureheadergenerator.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/arch... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/architectureheadergenerator.cpp (added) +++ branches/rbuild/reactos/tools/rbuild/architectureheadergenerator.cpp Sun Feb 17 00:08:03 2008 @@ -1,0 +1,54 @@ +/* + * Copyright (C) 2008 Colin Finck + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "rbuild.h" + +ArchitectureHeaderGenerator::ArchitectureHeaderGenerator ( const Project& project ) + : project ( project ) +{ +} + +ArchitectureHeaderGenerator::~ArchitectureHeaderGenerator () +{ +} + +void +ArchitectureHeaderGenerator::Generate () +{ + char* buf; + char* s; + + buf = (char*)malloc ( 32*1024 ); + if(!buf) + throw OutOfMemoryException (); + + s = buf; + s = s + sprintf ( s, "/* Auto generated by rbuild */\n"); + s = s + sprintf ( s, "\n" ); + s = s + sprintf ( s, "#ifndef _REACTOS_ARCHITECTURE_H\n" ); + s = s + sprintf ( s, "#define _REACTOS_ARCHITECTURE_H\n" ); + s = s + sprintf ( s, "\n" ); + + s = s + sprintf ( s, "#define ARCH_CD_ROOT "%s"", Environment::GetArchCdRoot(project).c_str() ); + + s = s + sprintf ( s, "\n\n" ); + s = s + sprintf ( s, "#endif\n" ); + + FileSupportCode::WriteIfChanged ( buf, NormalizeFilename ( Environment::GetIntermediatePath () + sSep + "include" + sSep + "reactos" + sSep + "architecture.h" ) ); + + free ( s ); +}
Propchange: branches/rbuild/reactos/tools/rbuild/architectureheadergenerator.cpp ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/back... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp Sun Feb 17 00:08:03 2008 @@ -349,6 +349,7 @@ GenerateModulesManifests(); GenerateProxyMakefiles (); GenerateCreditsFile(); + GenerateArchitectureHeader(); CheckAutomaticDependencies (); CloseMakefile (); } @@ -783,6 +784,15 @@ printf ( "done\n" ); }
+void +MingwBackend::GenerateArchitectureHeader () +{ + printf ( "Generating architecture header file..." ); + ArchitectureHeaderGenerator archHeaderGenerator ( ProjectNode ); + archHeaderGenerator.Generate (); + printf ( "done\n" ); +} + string MingwBackend::GetProxyMakefileTree () const {
Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/back... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h (original) +++ branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h Sun Feb 17 00:08:03 2008 @@ -88,6 +88,7 @@ void GenerateModulesResources(); void GenerateModulesManifests(); void GenerateCreditsFile (); + void GenerateArchitectureHeader (); std::string GetProxyMakefileTree () const; void GenerateProxyMakefiles (); void CheckAutomaticDependencies ();
Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/modulehandler.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/back... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Sun Feb 17 00:08:03 2008 @@ -3698,7 +3698,7 @@ MingwLiveIsoModuleHandler::GenerateLiveIsoModuleTarget () { string livecdRootDirectory = module.name; - string livecdArchDirectory = module.name + sSep + Environment::GetArchCdPath( module.project ); + string livecdArchDirectory = module.name + sSep + Environment::GetArchCdRoot( module.project ); FileLocation livecd ( OutputDirectory, livecdRootDirectory, "" );
string bootloader;
Modified: branches/rbuild/reactos/tools/rbuild/project.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/proj... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/project.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/project.cpp Sun Feb 17 00:08:03 2008 @@ -78,10 +78,11 @@ }
string -Environment::GetArchCdPath ( const Project& project ) +Environment::GetArchCdRoot ( const Project& project ) { switch( project.architectureType ) { + case ARM: return "ARM"; case I386: return "I386"; case PowerPC: return "PPC"; } @@ -149,7 +150,7 @@ Environment::GetBootstrapCdOutputPath ( const Project& project ) { return GetEnvironmentVariablePathOrDefault ( "ROS_CDBOOTSTRAPOUTPUT", - GetArchCdPath(project) ); + GetArchCdRoot(project) ); }
/* static */ string
Modified: branches/rbuild/reactos/tools/rbuild/rbuild.h URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbui... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/rbuild.h (original) +++ branches/rbuild/reactos/tools/rbuild/rbuild.h Sun Feb 17 00:08:03 2008 @@ -211,7 +211,7 @@ public: static std::string GetVariable ( const std::string& name ); static std::string GetArchName (); - static std::string GetArchCdPath ( const Project& project ); + static std::string GetArchCdRoot ( const Project& project ); static std::string GetIntermediatePath (); static std::string GetOutputPath (); static std::string GetCdOutputPath (); @@ -266,6 +266,7 @@
enum ArchitectureType { + ARM, I386, PowerPC }; @@ -1258,6 +1259,16 @@ private: };
+class ArchitectureHeaderGenerator +{ +public: + const Project& project; + ArchitectureHeaderGenerator ( const Project& project ); + ~ArchitectureHeaderGenerator (); + void Generate(); +private: +}; + extern void InitializeEnvironment ();
Modified: branches/rbuild/reactos/tools/rbuild/rbuild.mak URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbui... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/rbuild.mak (original) +++ branches/rbuild/reactos/tools/rbuild/rbuild.mak Sun Feb 17 00:08:03 2008 @@ -267,6 +267,7 @@ modulesmanifestgenerator.cpp \ modulesresourcegenerator.cpp \ creditsgenerator.cpp \ + architectureheadergenerator.cpp \ wineresource.cpp \ xmlnode.cpp \ ) @@ -463,6 +464,10 @@ $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+$(RBUILD_INT_)architectureheadergenerator.o: $(RBUILD_BASE_)architectureheadergenerator.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + $(RBUILD_INT_)modulesmanifestgenerator.o: $(RBUILD_BASE_)modulesmanifestgenerator.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
Modified: branches/rbuild/reactos/tools/rbuild/rbuild.vcproj URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbui... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/rbuild.vcproj (original) +++ branches/rbuild/reactos/tools/rbuild/rbuild.vcproj Sun Feb 17 00:08:03 2008 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="8.00" + Version="8,00" Name="rbuild" ProjectGUID="{D9305AFB-499E-49F1-A865-99DD7E19E762}" RootNamespace="rbuild" @@ -512,6 +512,10 @@ Name="rbuild_sources" > <File + RelativePath=".\architectureheadergenerator.cpp" + > + </File> + <File RelativePath="automaticdependency.cpp" > <FileConfiguration