"\t$(ECHO_WIDL)\n"
"\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext)_p.h -p -P $(intermediate_path_noext)_p.c $(source)\n"
"$(intermediate_path_noext)_p.o: $(intermediate_path_noext)_p.c $(intermediate_path_noext)_p.h$(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
+ "\t$(ECHO_CC)\n"
+ "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
"$(intermediate_path_noext)_p.h",
"$(intermediate_path_noext)_p.c",
"$(intermediate_path_noext)_p.o",
"$(intermediate_dir)$(SEP)", NULL );
Rule widlDlldataRule ( "$(source): $(dependencies) ${$(module_name)_precondition} $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WIDL)\n"
+ "\t$(ECHO_WIDL)\n"
"\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) --dlldata-only --dlldata=$(source) $(bare_dependencies)\n"
"$(intermediate_path_noext).o: $(source) $(dependencies) | $(intermediate_dir)\n"
"\t$(ECHO_CC)\n"
"\t$(ECHO_HOSTCC)\n"
"\t${host_gpp} -o $@ $($(module_name)_CXXFLAGS)$(compiler_flags) -c $<\n",
"$(intermediate_path_unique).o", NULL );
+Rule pchRule ( "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch: $(source)$(dependencies) | $(intermediate_dir)$(SEP).gch_$(module_name)\n"
+ "\t$(ECHO_PCH)\n"
+ "\t$(pch_cc) -o $@ $(pch_ccflags)$(compiler_flags) -x $(pch_language) -c $<\n",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch", NULL );
Rule emptyRule ( "", NULL );
void
void
MingwModuleHandler::GenerateObjectFileTargets ()
{
- const FileLocation *pchFilename = GetPrecompiledHeaderFilename ();
-
fprintf ( fMakefile, "# OBJECT FILE TARGETS\n" );
- if ( pchFilename )
+ if ( module.pch && use_pch )
{
- string cc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ? "${host_gcc}" : "${gcc}" );
- string cppc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ? "${host_gpp}" : "${gpp}" );
- const FileLocation& baseHeaderFile = *module.pch->file;
- CLEAN_FILE ( *pchFilename );
- string dependencies = backend->GetFullName ( baseHeaderFile );
+ std::map<string, string> vars;
+
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
+ vars["pch_cc"] = "${host_gcc}";
+ else
+ vars["pch_cc"] = "${gcc}";
+
+ if ( module.cplusplus )
+ {
+ vars["pch_language"] = "c++-header";
+ vars["pch_ccflags"] = cxxflagsMacro.c_str();
+ }
+ else
+ {
+ vars["pch_language"] = "c-header";
+ vars["pch_ccflags"] = cflagsMacro.c_str();
+ }
+
/* WIDL generated headers may be used */
+ string dependencies;
vector<FileLocation> rpcDependencies;
GetRpcHeaderDependencies ( rpcDependencies );
if ( rpcDependencies.size () > 0 )
- dependencies += " " + v2s ( backend, rpcDependencies, 5 );
- fprintf ( fMakefile,
- "%s: %s | %s\n",
- backend->GetFullName ( *pchFilename ).c_str(),
- dependencies.c_str(),
- backend->GetFullPath ( *pchFilename ).c_str() );
- fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );
- fprintf ( fMakefile,
- "\t%s -o %s %s %s -gstabs+ -x %s %s\n\n",
- cc.c_str(),
- backend->GetFullName ( *pchFilename ).c_str(),
- module.cplusplus ? cxxflagsMacro.c_str() : cflagsMacro.c_str(),
- GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags, module.cplusplus ? CompilerTypeCPP : CompilerTypeCC ).c_str(),
- module.cplusplus ? "c++-header" : "c-header",
- backend->GetFullName ( baseHeaderFile ).c_str() );
- delete pchFilename;
+ dependencies = v2s ( backend, rpcDependencies, 5 );
+
+ pchRule.Execute ( fMakefile,
+ backend,
+ module,
+ module.pch->file,
+ clean_files,
+ dependencies,
+ GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags, module.cplusplus ? CompilerTypeCPP : CompilerTypeCC ).c_str(),
+ vars );
+ fprintf ( fMakefile, "\n" );
}
GenerateObjectFileTargets ( module.non_if_data );
static std::string
FixString ( const string& str, Backend *backend, const Module& module, const FileLocation *source,
- const std::string& additional_dependencies, const std::string& compiler_flags )
+ const std::string& additional_dependencies, const std::string& compiler_flags,
+ const std::map<std::string, std::string>& custom_variables )
{
string ret = str;
+
+ for ( std::map<std::string, std::string>::const_iterator p = custom_variables.begin(); p != custom_variables.end(); ++ p )
+ {
+ ReplaceVariable ( ret, "$(" + p->first + ")", p->second );
+ }
+
string dep = additional_dependencies;
dep += " " + module.xmlbuildFile;
const FileLocation *source,
string_list& clean_files,
const std::string& additional_dependencies,
- const std::string& compiler_flags ) const
+ const std::string& compiler_flags,
+ const std::map<std::string, std::string>& custom_variables ) const
{
- string cmd = FixString ( command, backend, module, source, additional_dependencies, compiler_flags );
+ string cmd = FixString ( command, backend, module, source, additional_dependencies, compiler_flags, custom_variables );
fprintf ( outputFile, "%s", cmd.c_str () );
for ( size_t i = 0; i < generatedFiles.size (); i++ )
{
- string file = FixString ( generatedFiles[i], backend, module, source, "", "" );
+ string file = FixString ( generatedFiles[i], backend, module, source, "", "", custom_variables );
if ( file[file.length () - 1] != cSep )
{
clean_files.push_back ( file );
dir.c_str () );
}
}
+
+
+void Rule::Execute ( FILE *outputFile,
+ MingwBackend *backend,
+ const Module& module,
+ const FileLocation *source,
+ string_list& clean_files,
+ const std::string& additional_dependencies,
+ const std::string& compiler_flags ) const
+{
+ this->Execute ( outputFile,
+ backend,
+ module,
+ source,
+ clean_files,
+ additional_dependencies,
+ compiler_flags,
+ std::map<std::string, std::string>() );
+}