[ros-diffs] [hpoussin] 32594: Don't mix host and targets include files Add HostStaticLibrary type

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Sun Mar 9 12:35:04 CET 2008


Author: hpoussin
Date: Fri Mar  7 10:17:12 2008
New Revision: 32594

URL: http://svn.reactos.org/svn/reactos?rev=3D32594&view=3Drev
Log:
Don't mix host and targets include files
Add HostStaticLibrary type

Modified:
    trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
    trunk/reactos/tools/rbuild/bootstrap.cpp
    trunk/reactos/tools/rbuild/module.cpp
    trunk/reactos/tools/rbuild/rbuild.h

Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/=
codeblocks/codeblocks.cpp?rev=3D32594&r1=3D32593&r2=3D32594&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp Fri Mar  7=
 10:17:12 2008
@@ -37,6 +37,7 @@
 #undef OUT
 #endif//OUT
 =

+#define IsStaticLibrary( module ) ( ( module.type =3D=3D StaticLibrary ) |=
| ( module.type =3D=3D HostStaticLibrary ) )
 =

 static class CBFactory : public Backend::Factory
 {
@@ -497,7 +498,7 @@
 	if ( !module.allowWarnings )
 		compiler_flags.push_back ( "-Werror" );
 =

-	if ( module.type =3D=3D StaticLibrary && module.isStartupLib )
+	if ( IsStaticLibrary ( module ) && module.isStartupLib )
 		compiler_flags.push_back ( "-Wno-main" );
 =

 =

@@ -524,7 +525,7 @@
 =

 		if ( configuration.UseConfigurationInPath )
 		{
-			if ( module.type =3D=3D StaticLibrary ||module.type =3D=3D ObjectLibrar=
y )
+			if ( IsStaticLibrary ( module ) ||module.type =3D=3D ObjectLibrary )
 				fprintf ( OUT, "\t\t\t\t<Option output=3D\"%s\\%s%s\\%s%s\" prefix_aut=
o=3D\"0\" extension_auto=3D\"0\" />\r\n", intdir.c_str (), module.output->r=
elative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c=
_str());
 			else
 				fprintf ( OUT, "\t\t\t\t<Option output=3D\"%s\\%s%s\\%s%s\" prefix_aut=
o=3D\"0\" extension_auto=3D\"0\" />\r\n", outdir.c_str (), module.output->r=
elative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c=
_str());
@@ -532,7 +533,7 @@
 		}
 		else
 		{
-			if ( module.type =3D=3D StaticLibrary || module.type =3D=3D ObjectLibra=
ry )
+			if ( IsStaticLibrary ( module ) || module.type =3D=3D ObjectLibrary )
 				fprintf ( OUT, "\t\t\t\t<Option output=3D\"%s\\%s\\%s%s\" prefix_auto=
=3D\"0\" extension_auto=3D\"0\" />\r\n", intdir.c_str (), module.output->re=
lative_path.c_str (), module.name.c_str(), module_type.c_str() );
 			else
 				fprintf ( OUT, "\t\t\t\t<Option output=3D\"%s\\%s\\%s%s\" prefix_auto=
=3D\"0\" extension_auto=3D\"0\" />\r\n", outdir.c_str (), module.output->re=
lative_path.c_str (), module.name.c_str(), module_type.c_str() );
@@ -672,7 +673,7 @@
 		fprintf ( OUT, "\t\t\t\t<ExtraCommands>\r\n" );
 =

 #if 0
-		if ( module.type =3D=3D StaticLibrary && module.importLibrary )
+		if ( IsStaticLibrary ( module ) && module.importLibrary )
 			fprintf ( OUT, "\t\t\t\t\t<Add after=3D\"dlltool --dllname %s --def %s =
--output-lib $exe_output; %s -U\" />\r\n", module.importLibrary->dllname.c_=
str (), module.importLibrary->definition.c_str(), module.mangledSymbols ? "=
" : "--kill-at" );
 		else if ( module.importLibrary !=3D NULL )
 			fprintf ( OUT, "\t\t\t\t\t<Add after=3D\"dlltool --dllname %s --def %s =
--output-lib &quot;$(TARGET_OBJECT_DIR)lib$(TARGET_OUTPUT_BASENAME).a&quot;=
 %s\" />\r\n", module.GetTargetName ().c_str(), module.importLibrary->defin=
ition.c_str(), module.mangledSymbols ? "" : "--kill-at" );

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/=
mingw/modulehandler.cpp?rev=3D32594&r1=3D32593&r2=3D32594&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Fri Mar  7 1=
0:17:12 2008
@@ -30,6 +30,7 @@
 using std::vector;
 =

 #define CLEAN_FILE(f) clean_files.push_back ( (f).name.length () > 0 ? bac=
kend->GetFullName ( f ) : backend->GetFullPath ( f ) );
+#define IsStaticLibrary( module ) ( ( module.type =3D=3D StaticLibrary ) |=
| ( module.type =3D=3D HostStaticLibrary ) )
 =

 MingwBackend*
 MingwModuleHandler::backend =3D NULL;
@@ -169,6 +170,9 @@
 			break;
 		case StaticLibrary:
 			handler =3D new MingwStaticLibraryModuleHandler ( module );
+			break;
+		case HostStaticLibrary:
+			handler =3D new MingwHostStaticLibraryModuleHandler ( module );
 			break;
 		case ObjectLibrary:
 			handler =3D new MingwObjectLibraryModuleHandler ( module );
@@ -359,7 +363,7 @@
 const FileLocation*
 MingwModuleHandler::GetModuleArchiveFilename () const
 {
-	if ( module.type =3D=3D StaticLibrary )
+	if ( IsStaticLibrary ( module ) )
 		return GetTargetFilename ( module, NULL );
 	return new FileLocation ( IntermediateDirectory,
 	                          module.output->relative_path,
@@ -1842,7 +1846,7 @@
 =

 	arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_file=
s );
 =

-	if ( module.type =3D=3D StaticLibrary && module.importLibrary )
+	if ( IsStaticLibrary ( module ) && module.importLibrary )
 	{
 		const FileLocation *definitionFilename =3D GetDefinitionFilename ();
 =

@@ -2016,11 +2020,14 @@
 		&module.linkerFlags,
 		used_defs );
 =

-	GenerateMacros (
-		"+=3D",
-		module.project.non_if_data,
-		NULL,
-		used_defs );
+	if ( module.host =3D=3D HostFalse )
+	{
+		GenerateMacros (
+			"+=3D",
+			module.project.non_if_data,
+			NULL,
+			used_defs );
+	}
 =

 	vector<FileLocation> s;
 	if ( module.importLibrary )
@@ -2048,7 +2055,12 @@
 		fprintf ( fMakefile, "\n" );
 	}
 =

-	string globalCflags =3D "-g";
+	string globalCflags =3D "";
+	if ( module.host =3D=3D HostFalse )
+		globalCflags +=3D " $(PROJECT_CFLAGS)";
+	else
+		globalCflags +=3D " -Wall -Wpointer-arith -D__REACTOS__";
+	globalCflags +=3D " -g";
 	if ( backend->usePipe )
 		globalCflags +=3D " -pipe";
 	if ( !module.allowWarnings )
@@ -2058,7 +2070,7 @@
 		if ( module.cplusplus )
 			globalCflags +=3D " $(HOST_CPPFLAGS)";
 		else
-			globalCflags +=3D " $(HOST_CFLAGS)";
+			globalCflags +=3D " -Wno-strict-aliasing $(HOST_CFLAGS)";
 	}
 	else
 	{
@@ -2077,25 +2089,35 @@
 =

 	fprintf (
 		fMakefile,
-		"%s +=3D $(PROJECT_CFLAGS) %s\n",
+		"%s +=3D%s\n",
 		cflagsMacro.c_str (),
 		globalCflags.c_str () );
 =

-	fprintf (
-		fMakefile,
-		"%s +=3D $(PROJECT_RCFLAGS)\n",
-		windresflagsMacro.c_str () );
-
-	fprintf (
-		fMakefile,
-		"%s +=3D $(PROJECT_WIDLFLAGS) -I%s\n",
-		widlflagsMacro.c_str (),
-		module.output->relative_path.c_str () );
-
-	fprintf (
-		fMakefile,
-		"%s_LFLAGS +=3D $(PROJECT_LFLAGS) -g\n",
-		module.name.c_str () );
+	if ( module.host =3D=3D HostFalse )
+	{
+		fprintf (
+			fMakefile,
+			"%s +=3D $(PROJECT_RCFLAGS)\n",
+			windresflagsMacro.c_str () );
+
+		fprintf (
+			fMakefile,
+			"%s +=3D $(PROJECT_WIDLFLAGS) -I%s\n",
+			widlflagsMacro.c_str (),
+			module.output->relative_path.c_str () );
+
+		fprintf (
+			fMakefile,
+			"%s_LFLAGS +=3D $(PROJECT_LFLAGS) -g\n",
+			module.name.c_str () );
+	}
+	else
+	{
+		fprintf (
+			fMakefile,
+			"%s_LFLAGS +=3D $(HOST_LFLAGS)\n",
+			module.name.c_str () );
+	}
 =

 	fprintf (
 		fMakefile,
@@ -2130,7 +2152,7 @@
 		          linkerflags.c_str () );
 	}
 =

-	if ( module.type =3D=3D StaticLibrary && module.isStartupLib )
+	if ( IsStaticLibrary ( module ) && module.isStartupLib )
 	{
 		fprintf ( fMakefile,
 		          "%s +=3D -Wno-main\n\n",
@@ -2596,6 +2618,26 @@
 }
 =

 =

+MingwHostStaticLibraryModuleHandler::MingwHostStaticLibraryModuleHandler (
+	const Module& module_ )
+
+	: MingwModuleHandler ( module_ )
+{
+}
+
+void
+MingwHostStaticLibraryModuleHandler::Process ()
+{
+	GenerateHostStaticLibraryModuleTarget ();
+}
+
+void
+MingwHostStaticLibraryModuleHandler::GenerateHostStaticLibraryModuleTarget=
 ()
+{
+	GenerateRules ();
+}
+
+
 MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler (
 	const Module& module_ )
 =


Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/=
mingw/modulehandler.h?rev=3D32594&r1=3D32593&r2=3D32594&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Fri Mar  7 10:=
17:12 2008
@@ -226,6 +226,17 @@
 };
 =

 =

+class MingwHostStaticLibraryModuleHandler : public MingwModuleHandler
+{
+public:
+	MingwHostStaticLibraryModuleHandler ( const Module& module );
+	virtual HostType DefaultHost() { return HostTrue; }
+	virtual void Process ();
+private:
+	void GenerateHostStaticLibraryModuleTarget ();
+};
+
+
 class MingwObjectLibraryModuleHandler : public MingwModuleHandler
 {
 public:

Modified: trunk/reactos/tools/rbuild/bootstrap.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/bootstra=
p.cpp?rev=3D32594&r1=3D32593&r2=3D32594&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/rbuild/bootstrap.cpp (original)
+++ trunk/reactos/tools/rbuild/bootstrap.cpp Fri Mar  7 10:17:12 2008
@@ -57,6 +57,7 @@
 			return true;
 		case BuildTool:
 		case StaticLibrary:
+		case HostStaticLibrary:
 		case ObjectLibrary:
 		case Iso:
 		case LiveIso:

Modified: trunk/reactos/tools/rbuild/module.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.c=
pp?rev=3D32594&r1=3D32593&r2=3D32594&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/rbuild/module.cpp (original)
+++ trunk/reactos/tools/rbuild/module.cpp Fri Mar  7 10:17:12 2008
@@ -880,6 +880,8 @@
 		return BuildTool;
 	if ( attribute.value =3D=3D "staticlibrary" )
 		return StaticLibrary;
+	if ( attribute.value =3D=3D "hoststaticlibrary" )
+		return HostStaticLibrary;
 	if ( attribute.value =3D=3D "objectlibrary" )
 		return ObjectLibrary;
 	if ( attribute.value =3D=3D "kernel" )
@@ -965,6 +967,7 @@
 		case ElfExecutable:
 			return OutputDirectory;
 		case StaticLibrary:
+		case HostStaticLibrary:
 		case ObjectLibrary:
 		case RpcServer:
 		case RpcClient:
@@ -990,6 +993,7 @@
 			return ExePostfix;
 		case BootProgram:
 		case StaticLibrary:
+		case HostStaticLibrary:
 			return ".a";
 		case ObjectLibrary:
 			return ".o";
@@ -1067,6 +1071,7 @@
 				return "WinMainCRTStartup";
 		case BuildTool:
 		case StaticLibrary:
+		case HostStaticLibrary:
 		case ObjectLibrary:
 		case BootLoader:
 		case BootSector:
@@ -1115,6 +1120,7 @@
 			return "0xe00000";
 		case BuildTool:
 		case StaticLibrary:
+		case HostStaticLibrary:
 		case ObjectLibrary:
 		case BootLoader:
 		case BootSector:
@@ -1140,7 +1146,7 @@
 bool
 Module::HasImportLibrary () const
 {
-	return importLibrary !=3D NULL && type !=3D StaticLibrary;
+	return importLibrary !=3D NULL && type !=3D StaticLibrary && type !=3D Ho=
stStaticLibrary;
 }
 =

 bool
@@ -1162,6 +1168,7 @@
 		case Win32GUI:
 		case BuildTool:
 		case StaticLibrary:
+		case HostStaticLibrary:
 		case ObjectLibrary:
 		case BootLoader:
 		case BootSector:
@@ -1613,7 +1620,7 @@
 =

 	if ( dllname )
 		this->dllname =3D dllname->value;
-	else if ( module.type =3D=3D StaticLibrary )
+	else if ( module.type =3D=3D StaticLibrary || module.type =3D=3D HostStat=
icLibrary )
 		throw XMLInvalidBuildFileException (
 		    node.location,
 		    "<importlibrary> dllname attribute required." );

Modified: trunk/reactos/tools/rbuild/rbuild.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h=
?rev=3D32594&r1=3D32593&r2=3D32594&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/rbuild/rbuild.h (original)
+++ trunk/reactos/tools/rbuild/rbuild.h Fri Mar  7 10:17:12 2008
@@ -300,6 +300,7 @@
 	EmbeddedTypeLib =3D 26,
 	ElfExecutable =3D 27,
 	RpcProxy,
+	HostStaticLibrary,
 	TypeDontCare,
 };
 =





More information about the Ros-diffs mailing list