+/*
+ * Copyright (C) 2005 Casper S. Hornstrup
+ *
+ * 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 "../../pch.h"
#include <assert.h>
case RpcClient:
handler = new MingwRpcClientModuleHandler ( module );
break;
+ case Alias:
+ handler = new MingwAliasModuleHandler ( module );
+ break;
default:
throw UnknownModuleTypeException (
module.node.location,
return filename;
}
+string
+MingwModuleHandler::GetExtraDependencies (
+ const string& filename ) const
+{
+ string extension = GetExtension ( filename );
+ if ( extension == ".idl" || extension == ".IDL" )
+ {
+ string basename = GetBasename ( filename );
+ return GetRpcServerHeaderFilename ( basename ) + " " + GetRpcClientHeaderFilename ( basename );
+ }
+ else
+ return "";
+}
+
string
MingwModuleHandler::GetModuleArchiveFilename () const
{
return obj_file;
}
+string
+MingwModuleHandler::GetModuleCleanTarget ( const Module& module ) const
+{
+ return module.name + "_clean";
+}
+
+void
+MingwModuleHandler::GetReferencedObjectLibraryModuleCleanTargets ( vector<string>& moduleNames ) const
+{
+ for ( size_t i = 0; i < module.non_if_data.libraries.size (); i++ )
+ {
+ Library& library = *module.non_if_data.libraries[i];
+ if ( library.importedModule->type == ObjectLibrary )
+ moduleNames.push_back ( GetModuleCleanTarget ( *library.importedModule ) );
+ }
+}
+
void
MingwModuleHandler::GenerateCleanTarget () const
{
- if ( 0 == clean_files.size() )
+ if ( module.type == Alias )
return;
- fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() );
- fprintf ( fMakefile, "%s_clean:\n\t-@${rm}", module.name.c_str() );
+
+ fprintf ( fMakefile,
+ ".PHONY: %s_clean\n",
+ module.name.c_str() );
+ vector<string> referencedModuleNames;
+ GetReferencedObjectLibraryModuleCleanTargets ( referencedModuleNames );
+ fprintf ( fMakefile,
+ "%s: %s\n\t-@${rm}",
+ GetModuleCleanTarget ( module ).c_str(),
+ v2s ( referencedModuleNames, 10 ).c_str () );
for ( size_t i = 0; i < clean_files.size(); i++ )
{
if ( 9==((i+1)%10) )
dependencies += " \\\n\t\t", wrap_count = 0;
else if ( dependencies.size () > 0 )
dependencies += " ";
- dependencies += GetImportLibraryDependency ( *libraries[i]->imported_module );
+ dependencies += GetImportLibraryDependency ( *libraries[i]->importedModule );
}
return dependencies;
}
if ( use_pch && module.pch != NULL )
{
fprintf ( fMakefile,
- " -I %s",
+ " -I%s",
GetDirectory ( GetPrecompiledHeaderFilename () ).c_str () );
}
for ( i = 0; i < data.includes.size(); i++ )
{
+ const Include& include = *data.includes[i];
+ string includeDirectory;
+ if ( include.baseModule != NULL &&
+ ( include.baseModule->type == RpcServer ||
+ include.baseModule->type == RpcClient ) )
+ includeDirectory = PassThruCacheDirectory ( NormalizeFilename ( include.directory ),
+ backend->intermediateDirectory );
+ else
+ includeDirectory = include.directory;
fprintf (
fMakefile,
" -I%s",
- data.includes[i]->directory.c_str() );
+ includeDirectory.c_str() );
}
for ( i = 0; i < data.defines.size(); i++ )
{
void
MingwModuleHandler::GenerateGccCommand (
const string& sourceFilename,
+ const string& extraDependencies,
const string& cc,
const string& cflagsMacro )
{
string dependencies = sourceFilename;
+ if ( extraDependencies != "" )
+ dependencies += " " + extraDependencies;
if ( module.pch && use_pch )
dependencies += " " + GetPrecompiledHeaderFilename ();
/* WIDL generated headers may be used */
- dependencies += " " + GetLinkingDependenciesMacro ();
+ vector<string> rpcDependencies;
+ GetRpcHeaderDependencies ( rpcDependencies );
+ dependencies += " " + v2s ( rpcDependencies, 5 );
dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
string objectFilename = GetObjectFilename (
string
MingwModuleHandler::GetRpcServerHeaderFilename ( string basename ) const
{
- return basename + "_s.h";
+ return PassThruCacheDirectory ( basename + "_s.h",
+ backend->intermediateDirectory );
}
void
string basename = GetBasename ( file.name );
- /*string generatedHeaderFilename = PassThruCacheDirectory (
- basename + ".h",
- backend->intermediateDirectory );
- CLEAN_FILE(generatedHeaderFilename);
- */
string generatedHeaderFilename = GetRpcServerHeaderFilename ( basename );
CLEAN_FILE(generatedHeaderFilename);
string
MingwModuleHandler::GetRpcClientHeaderFilename ( string basename ) const
{
- return basename + "_c.h";
+ return PassThruCacheDirectory ( basename + "_c.h",
+ backend->intermediateDirectory );
}
void
string basename = GetBasename ( file.name );
- /*string generatedHeaderFilename = PassThruCacheDirectory (
- basename + ".h",
- backend->intermediateDirectory );
- CLEAN_FILE(generatedHeaderFilename);
- */
string generatedHeaderFilename = GetRpcClientHeaderFilename ( basename );
CLEAN_FILE(generatedHeaderFilename);
if ( extension == ".c" || extension == ".C" )
{
GenerateGccCommand ( file.name,
+ "",
cc,
cflagsMacro );
return;
extension == ".cxx" || extension == ".CXX" )
{
GenerateGccCommand ( file.name,
+ "",
cppc,
cflagsMacro );
return;
{
GenerateWinebuildCommands ( file.name );
GenerateGccCommand ( GetActualSourceFilename ( file.name ),
+ "",
cc,
cflagsMacro );
return;
GenerateWidlCommands ( file,
widlflagsMacro );
GenerateGccCommand ( GetActualSourceFilename ( file.name ),
+ GetExtraDependencies ( file.name ),
cc,
cflagsMacro );
return;
void
MergeStringVector ( const vector<string>& input,
- vector<string>& output )
+ vector<string>& output )
{
int wrap_at = 25;
string s;
string def_file = GetDefinitionFilename ();
fprintf ( fMakefile,
- "%s: %s %s $(RSYM_TARGET) | %s\n",
+ "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
target.c_str (),
def_file.c_str (),
dependencies.c_str (),
libsMacro.c_str (),
GetLinkerMacro ().c_str () );
+ fprintf ( fMakefile,
+ "\t$(Q)$(PEFIXUP_TARGET) %s -exports\n",
+ target.c_str () );
+
fprintf ( fMakefile,
"\t-@${rm} %s 2>$(NUL)\n",
temp_exp.c_str () );
void
MingwModuleHandler::GetRpcHeaderDependencies (
- string_list& dependencies ) const
+ vector<string>& dependencies ) const
{
for ( size_t i = 0; i < module.non_if_data.libraries.size (); i++ )
{
Library& library = *module.non_if_data.libraries[i];
- if ( library.imported_module->type == RpcServer ||
- library.imported_module->type == RpcClient )
+ if ( library.importedModule->type == RpcServer ||
+ library.importedModule->type == RpcClient )
{
-
- for ( size_t j = 0; j < library.imported_module->non_if_data.files.size (); j++ )
+ for ( size_t j = 0; j < library.importedModule->non_if_data.files.size (); j++ )
{
- File& file = *library.imported_module->non_if_data.files[j];
+ File& file = *library.importedModule->non_if_data.files[j];
string extension = GetExtension ( file.name );
if ( extension == ".idl" || extension == ".IDL" )
{
string basename = GetBasename ( file.name );
- if ( library.imported_module->type == RpcServer )
+ if ( library.importedModule->type == RpcServer )
dependencies.push_back ( GetRpcServerHeaderFilename ( basename ) );
- if ( library.imported_module->type == RpcClient )
+ if ( library.importedModule->type == RpcClient )
dependencies.push_back ( GetRpcClientHeaderFilename ( basename ) );
}
}
module.non_if_data,
&module.linkerFlags );
- string_list s;
+ vector<string> s;
if ( module.importLibrary )
{
const vector<File*>& files = module.non_if_data.files;
GetSpecObjectDependencies ( s, file.name );
}
}
- GetRpcHeaderDependencies ( s );
if ( s.size () > 0 )
{
fprintf (
const string& filename ) const
{
string basename = GetBasename ( filename );
- string serverDependency = PassThruCacheDirectory (
+ string serverSourceDependency = PassThruCacheDirectory (
NormalizeFilename ( basename + "_s.c" ),
backend->intermediateDirectory );
- dependencies.push_back ( serverDependency );
+ dependencies.push_back ( serverSourceDependency );
+ dependencies.push_back ( GetRpcServerHeaderFilename ( basename ) );
}
void
string dependencies = linkDepsMacro + " " + objectsMacro;
- string linkerParameters = ssprintf ( "-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll --dll",
+ string linkerParameters = ssprintf ( "-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
module.GetBasePath ().c_str (),
module.entrypoint.c_str (),
module.baseaddress.c_str () );
string dependencies = linkDepsMacro + " " + objectsMacro;
- string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll --dll",
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
module.entrypoint.c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
string dependencies = linkDepsMacro + " " + objectsMacro;
- string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll --dll",
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
module.entrypoint.c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
string dependencies = linkDepsMacro + " " + objectsMacro;
- string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll --dll",
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -shared",
module.entrypoint.c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
else
linker = "${gcc}";
- string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll --dll",
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -shared",
module.entrypoint.c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
continue;
if ( m.installName.length () > 0 )
{
+ const Module& aliasedModule = backend->GetAliasedModuleOrModule ( m );
string sourceFilename = MingwModuleHandler::PassThruCacheDirectory (
- NormalizeFilename ( m.GetPath () ),
+ NormalizeFilename ( aliasedModule.GetPath () ),
backend->outputDirectory );
OutputCopyCommand ( sourceFilename,
- m.installName,
- livecdDirectory + SSEP + reactosDirectory + SSEP + m.installBase );
+ m.installName,
+ livecdDirectory + SSEP + reactosDirectory + SSEP + m.installBase );
}
}
}
GenerateRules ();
}
+
MingwRpcClientModuleHandler::MingwRpcClientModuleHandler (
const Module& module_ )
{
GenerateRules ();
}
+
+
+MingwAliasModuleHandler::MingwAliasModuleHandler (
+ const Module& module_ )
+
+ : MingwModuleHandler ( module_ )
+{
+}
+
+void
+MingwAliasModuleHandler::Process ()
+{
+}