module.name.c_str () );
}
+static
+const char * const CompilerPrefixTable [ CompilerTypesCount ] =
+{
+ "C",
+ "CXX",
+ "CPP",
+ "AS",
+ "MIDL",
+ "RC",
+ "NASM",
+};
+
+/* static */ void
+MingwModuleHandler::GenerateParameters (
+ const char* prefix,
+ const char* assignmentOperation,
+ const IfableData& data )
+{
+ for ( unsigned type = CompilerTypeCC; type < CompilerTypesCount; ++ type )
+ {
+ CompilerType compiler = static_cast < CompilerType > ( type );
+
+ // Includes
+ std::string includes = GenerateIncludeParametersFromVector ( data.includes, compiler );
+
+ if ( includes.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sINCLUDES%s%s\n",
+ prefix,
+ CompilerPrefixTable [ compiler ],
+ assignmentOperation,
+ includes.c_str () );
+ }
+
+ // Defines
+ std::string defines = GenerateDefineParametersFromVector ( data.defines, compiler );
+
+ if ( defines.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sDEFINES%s%s\n",
+ prefix,
+ CompilerPrefixTable [ compiler ],
+ assignmentOperation,
+ defines.c_str () );
+ }
+
+ // Flags
+ std::string flags = GenerateCompilerParametersFromVector ( data.compilerFlags, compiler );
+
+ if ( flags.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sFLAGS%s%s\n",
+ prefix,
+ CompilerPrefixTable [ compiler ],
+ assignmentOperation,
+ flags.c_str () );
+ }
+ }
+}
+
/* static */ string
MingwModuleHandler::GenerateGccDefineParametersFromVector (
const vector<Define*>& defines,
Define& define = *defines[i];
if (used_defs.find(define.name) != used_defs.end())
continue;
+ if (define.redefine)
+ {
+ if (parameters.length () > 0)
+ parameters += " ";
+ parameters += "-U";
+ parameters += define.name;
+ }
if (parameters.length () > 0)
parameters += " ";
- if (define.name.find('(') != string::npos)
+ if (define.arguments.length ())
parameters += "$(QT)";
parameters += "-D";
parameters += define.name;
+ parameters += define.arguments;
if (define.value.length () > 0)
{
parameters += "=";
parameters += define.value;
}
- if (define.name.find('(') != string::npos)
+ if (define.arguments.length ())
parameters += "$(QT)";
used_defs.insert(used_defs.begin(),define.name);
}
return parameters;
}
+/* static */ string
+MingwModuleHandler::GenerateDefineParametersFromVector (
+ const std::vector<Define*>& defines,
+ CompilerType compiler )
+{
+ string parameters;
+
+ for ( size_t i = 0; i < defines.size (); i++ )
+ {
+ Define& define = *defines[i];
+ if (!define.IsCompilerSet (compiler))
+ continue;
+ if (define.redefine)
+ {
+ if (parameters.length () > 0)
+ parameters += " ";
+ parameters += "-U";
+ parameters += define.name;
+ }
+ if (parameters.length () > 0)
+ parameters += " ";
+ if (define.arguments.length ())
+ parameters += "$(QT)";
+ parameters += "-D";
+ parameters += define.name;
+ parameters += define.arguments;
+ if (define.value.length () > 0)
+ {
+ parameters += "=";
+ parameters += define.value;
+ }
+ if (define.arguments.length ())
+ parameters += "$(QT)";
+ }
+ return parameters;
+}
+
string
MingwModuleHandler::ConcatenatePaths (
const string& path1,
}
/* static */ string
-MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector<Include*>& includes )
+MingwModuleHandler::GenerateIncludeParametersFromVector ( const vector<Include*>& includes, const CompilerType type )
{
string parameters, path_prefix;
for ( size_t i = 0; i < includes.size (); i++ )
{
Include& include = *includes[i];
- if ( parameters.length () > 0 )
- parameters += " ";
- parameters += "-I" + backend->GetFullPath ( *include.directory );
+ if ( include.IsCompilerSet( type ) )
+ parameters += " -I" + backend->GetFullPath ( *include.directory );
}
return parameters;
}
-string
-MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const
+/* static */ string
+MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags, const CompilerType type )
{
string parameters;
for ( size_t i = 0; i < compilerFlags.size (); i++ )
{
CompilerFlag& compilerFlag = *compilerFlags[i];
- if ( compilerFlag.compiler == type )
+ if ( compilerFlag.IsCompilerSet( type ) )
parameters += " " + compilerFlag.flag;
}
return parameters;
return GenerateLinkerParametersFromVector ( module.linkerFlags );
}
-void
-MingwModuleHandler::GenerateMacro (
- const char* assignmentOperation,
- const string& macro,
- const IfableData& data,
- set<const Define *> *used_defs,
- bool generatingCompilerMacro )
-{
- size_t i;
- bool generateAssignment;
-
- generateAssignment = (use_pch && module.pch != NULL ) || data.includes.size () > 0 || data.defines.size () > 0;
- if ( generatingCompilerMacro )
- generateAssignment |= data.compilerFlags.size () > 0;
- if ( generateAssignment )
- {
- fprintf ( fMakefile,
- "%s %s",
- macro.c_str(),
- assignmentOperation );
- }
-
- const FileLocation *pchFilename = GetPrecompiledHeaderFilename ();
- if ( pchFilename )
- {
- fprintf ( fMakefile,
- " -I%s",
- backend->GetFullPath ( *pchFilename ).c_str () );
- delete pchFilename;
- }
-
- if ( generatingCompilerMacro )
- {
- string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags, CompilerTypeDontCare );
- if ( compilerParameters.size () > 0 )
- {
- fprintf (
- fMakefile,
- "%s",
- compilerParameters.c_str () );
- }
- }
- for ( i = 0; i < data.includes.size(); i++ )
- {
- const Include& include = *data.includes[i];
- const FileLocation* includeDirectory = include.directory;
- fprintf (
- fMakefile,
- " -I%s",
- backend->GetFullPath ( *includeDirectory ).c_str() );
- }
- for ( i = 0; i < data.defines.size(); i++ )
- {
- const Define& define = *data.defines[i];
- if ( used_defs )
- {
- set<const Define *>::const_iterator last_define;
- for (last_define = used_defs->begin ();
- last_define != used_defs->end ();
- last_define++)
- {
- if ( (*last_define)->name != define.name )
- continue;
- if ( !define.overridable )
- {
- throw InvalidOperationException ( (*last_define)->node->location.c_str (),
- 0,
- "Invalid override of define '%s', already defined at %s",
- define.name.c_str (),
- define.node->location.c_str () );
- }
- if ( backend->configuration.Verbose )
- printf("%s: Overriding '%s' already defined at %s\n",
- (*last_define)->node->location.c_str (), define.name.c_str (),
- define.node->location.c_str () );
- break;
- }
- if ( last_define != used_defs->end () )
- continue;
- }
- fprintf (
- fMakefile,
- " -D%s",
- define.name.c_str() );
- if (define.value.length () > 0)
- fprintf (
- fMakefile,
- "=%s",
- define.value.c_str() );
- if ( used_defs )
- used_defs->insert( used_defs->begin (), &define );
- }
- if ( generateAssignment )
- {
- fprintf ( fMakefile, "\n" );
- }
-}
-
void
MingwModuleHandler::GenerateMacros (
const char* assignmentOperation,
const vector<LinkerFlag*>* linkerFlags,
set<const Define *>& used_defs )
{
- fprintf ( fMakefile, "# MACROS\n" );
- GenerateMacro ( assignmentOperation,
- commonflagsMacro,
- data,
- &used_defs,
- true );
- GenerateMacro ( assignmentOperation,
- windresflagsMacro,
- data,
- NULL,
- false );
-
if ( linkerFlags != NULL )
{
string linkerParameters = GenerateLinkerParametersFromVector ( *linkerFlags );
{
size_t i;
- fprintf ( fMakefile, "# SOURCE MACROS\n" );
const vector<CompilationUnit*>& compilationUnits = data.compilationUnits;
vector<const FileLocation *> headers;
if ( compilationUnits.size () > 0 )
vector<const FileLocation *> headers;
vector<const FileLocation *> mcheaders;
vector<const FileLocation *> mcresources;
- fprintf ( fMakefile, "# OBJECT MACROS\n" );
if ( compilationUnits.size () > 0 )
{
for ( i = 0; i < compilationUnits.size (); i++ )
return new FileLocation( IntermediateDirectory, dlldata_path, module.name + ".dlldata.c" );
}
-/* caller needs to delete the returned object */
+const FileLocation*
+MingwModuleHandler::GetPrecompiledHeaderPath () const
+{
+ if ( !module.pch || !use_pch )
+ return NULL;
+ return new FileLocation ( IntermediateDirectory,
+ module.pch->file->relative_path,
+ ".gch_" + module.name );
+}
+
const FileLocation*
MingwModuleHandler::GetPrecompiledHeaderFilename () const
{
module.pch->file->name + ".gch" );
}
-Rule arRule1 ( "$(intermediate_path_noext).a: $($(module_name)_OBJS) $(dependencies) | $(intermediate_dir)\n",
- "$(intermediate_path_noext).a",
- "$(intermediate_dir)$(SEP)", NULL );
-Rule arRule2 ( "\t$(ECHO_AR)\n"
- "\t${ar} -rc $@ $($(module_name)_OBJS) \n",
- NULL );
-Rule arHostRule2 ( "\t$(ECHO_HOSTAR)\n"
- "\t${host_ar} -rc $@ $($(module_name)_OBJS)\n",
- NULL );
-Rule gasRule ( "$(source): ${$(module_name)_precondition}\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_unique).o.d: $(source) | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -x assembler-with-cpp -MF $@ -D__ASM__ $($(module_name)_CFLAGS) -M -MP -MT $@ $<\n"
- "-include $(intermediate_path_unique).o.d\n"
- "endif\n"
- "$(intermediate_path_unique).o: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).o.d) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_GAS)\n"
- "\t${gcc} -x assembler-with-cpp -o $@ -D__ASM__ $($(module_name)_CFLAGS) -c $<\n",
- "$(intermediate_path_unique).o",
- "$(intermediate_path_unique).o.d",
- "$(intermediate_dir)$(SEP)", NULL );
-Rule bootRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(module_output): $(source) $(dependencies) | $(OUTPUT)$(SEP)$(source_dir)\n"
- "\t$(ECHO_NASM)\n"
- "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
- "$(OUTPUT)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule nasmRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_unique).o: $(source) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_NASM)\n"
- "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
- "$(intermediate_path_unique).o",
- "$(intermediate_dir)$(SEP)", NULL );
-Rule windresRule ( "$(source): ${$(module_name)_precondition}\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_unique).coff.d: $(source) | $(intermediate_dir) $(TEMPORARY)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -xc -M -MP -MT $@ -DRC_INVOKED ${$(module_name)_RCFLAGS} $(source) -MF $@\n"
- "-include $(intermediate_path_unique).coff.d\n"
- "endif\n"
- "$(intermediate_path_unique).coff: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).coff.d) $(dependencies) $(WRC_TARGET) | $(intermediate_dir) $(TEMPORARY)\n"
- "\t$(ECHO_WRC)\n"
- "\t${gcc} -xc -E -DRC_INVOKED ${$(module_name)_RCFLAGS} $(source) > $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp\n"
- "\t$(Q)$(WRC_TARGET) ${$(module_name)_RCFLAGS} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp\n"
- "\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp 2>$(NUL)\n"
- "\t${windres} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp -o $@\n"
- "\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp 2>$(NUL)\n",
+Rule windresRule ( "$(eval $(call RBUILD_WRC_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
"$(intermediate_path_unique).coff",
- "$(intermediate_path_unique).coff.d",
+ "$(intermediate_path_unique).res",
+ "$(intermediate_path_unique).res.d",
"$(intermediate_dir)$(SEP)", NULL );
-Rule wmcRule ( "$(intermediate_path_noext).rc $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h: $(WMC_TARGET) $(source) | $(intermediate_dir)\n"
- "\t$(ECHO_WMC)\n"
- "\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h -o $(intermediate_path_noext).rc $(source)\n",
- "$(intermediate_path_noext).rc",
- "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h",
- "$(intermediate_dir)$(SEP)", NULL );
-Rule winebuildPDefRule ( "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_unique).spec.d: $(source) | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -xc -M -MP -MT $@ ${$(module_name)_RCFLAGS} $(source) -MF $@\n\n"
- "-include $(intermediate_path_unique).spec.d\n"
- "endif\n"
- "$(intermediate_path_unique).spec: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).spec.d) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CPP)\n"
- "\t${gcc} -xc -E ${$(module_name)_RCFLAGS} $(source) > $(intermediate_path_unique).spec\n\n"
- "$(intermediate_path_unique).auto.def: $(intermediate_path_unique).spec $(WINEBUILD_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WINEBLD)\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(intermediate_path_unique).auto.def --def -E $(intermediate_path_unique).spec --filename $(module_dllname)\n\n",
- "$(intermediate_path_unique).spec",
- "$(intermediate_path_unique).spec.d",
- "$(intermediate_path_unique).auto.def",
- "$(intermediate_dir)$(SEP)", NULL );
-Rule winebuildPRule ( "$(intermediate_path_unique).stubs.c: $(intermediate_path_unique).spec $(WINEBUILD_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WINEBLD)\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $@ --pedll $(intermediate_path_unique).spec --filename $(module_dllname)\n\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_unique).stubs.o.d: $(intermediate_path_unique).stubs.c | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
- "-include $(intermediate_path_unique).stubs.o.d\n"
- "endif\n"
- "$(intermediate_path_unique).stubs.o: $(intermediate_path_unique).stubs.c$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).stubs.o.d) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
+Rule winebuildPRule ( "$(eval $(call RBUILD_WINEBUILD_WITH_CPP_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags),$(module_dllname)))\n",
"$(intermediate_path_unique).spec",
+ "$(intermediate_path_unique).spec.d",
+ "$(intermediate_path_unique).auto.def",
"$(intermediate_path_unique).stubs.c",
"$(intermediate_path_unique).stubs.o",
"$(intermediate_path_unique).stubs.o.d",
"$(intermediate_dir)$(SEP)", NULL );
-Rule winebuildDefRule ( "$(intermediate_path_unique).auto.def: $(source) $(dependencies) $(WINEBUILD_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WINEBLD)\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(intermediate_path_unique).auto.def --def -E $(source) --filename $(module_dllname)\n\n",
- "$(intermediate_path_noext).spec",
- "$(intermediate_path_unique).auto.def",
- "$(intermediate_dir)$(SEP)", NULL );
-Rule winebuildRule ( "$(intermediate_path_unique).stubs.c: $(source) $(WINEBUILD_TARGET)\n"
- "\t$(ECHO_WINEBLD)\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $@ --pedll $(source) --filename $(module_dllname)\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_unique).stubs.o.d: $(intermediate_path_unique).stubs.c | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
- "-include $(intermediate_path_unique).stubs.o.d\n"
- "endif\n"
- "$(intermediate_path_unique).stubs.o: $(intermediate_path_unique).stubs.c$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).stubs.o.d) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
+Rule winebuildRule ( "$(eval $(call RBUILD_WINEBUILD_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags),$(module_dllname)))\n",
+ "$(intermediate_path_unique).auto.def",
"$(intermediate_path_unique).stubs.c",
"$(intermediate_path_unique).stubs.o",
"$(intermediate_path_unique).stubs.o.d",
"$(intermediate_dir)$(SEP)", NULL );
-Rule widlHeaderRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_noext).h: $(source) $(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext).h $(source)\n",
+Rule gasRule ( "$(eval $(call RBUILD_GAS_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_path_unique).o.d", NULL );
+Rule gccRule ( "$(eval $(call RBUILD_GCC_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_path_unique).o.d", NULL );
+Rule gccHostRule ( "$(eval $(call RBUILD_HOST_GCC_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o", NULL );
+Rule gppRule ( "$(eval $(call RBUILD_GPP_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_path_unique).o.d", NULL );
+Rule gppHostRule ( "$(eval $(call RBUILD_HOST_GPP_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o", NULL );
+Rule widlHeaderRule ( "$(eval $(call RBUILD_WIDL_HEADER_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
"$(intermediate_path_noext).h",
"$(intermediate_dir)$(SEP)", NULL );
-Rule widlInterfaceRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_noext)_i.c: $(source) $(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -u -U $(intermediate_path_noext)_i.c $(source)\n"
- "$(intermediate_path_noext)_i.o: $(intermediate_path_noext)_i.c $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
- "$(intermediate_path_noext)_i.c",
- "$(intermediate_path_noext)_i.o",
- "$(intermediate_dir)$(SEP)", NULL );
-Rule widlServerRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_noext)_s.c $(intermediate_path_noext)_s.h: $(source) $(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext)_s.h -s -S $(intermediate_path_noext)_s.c $(source)\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_noext)_s.o.d: $(intermediate_path_noext)_s.c | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -M -MP -MT $@ $<\n"
- "-include $(intermediate_path_noext)_s.o.d\n"
- "endif\n"
- "$(intermediate_path_noext)_s.o: $(intermediate_path_noext)_s.c $(intermediate_path_noext)_s.h$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext)_s.o.d) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
+Rule widlServerRule ( "$(eval $(call RBUILD_WIDL_SERVER_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
"$(intermediate_path_noext)_s.h",
"$(intermediate_path_noext)_s.c",
"$(intermediate_path_noext)_s.o",
- "$(intermediate_path_noext)_s.o.d",
"$(intermediate_dir)$(SEP)", NULL );
-Rule widlClientRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_noext)_c.c $(intermediate_path_noext)_c.h: $(source) $(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext)_c.h -c -C $(intermediate_path_noext)_c.c $(source)\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_noext)_c.o.d: $(intermediate_path_noext)_c.c | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -M -MP -MT $@ $<\n"
- "-include $(intermediate_path_noext)_c.o.d\n"
- "endif\n"
- "$(intermediate_path_noext)_c.o: $(intermediate_path_noext)_c.c $(intermediate_path_noext)_c.h$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext)_c.o.d) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
+Rule widlClientRule ( "$(eval $(call RBUILD_WIDL_CLIENT_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
"$(intermediate_path_noext)_c.h",
"$(intermediate_path_noext)_c.c",
"$(intermediate_path_noext)_c.o",
- "$(intermediate_path_noext)_c.o.d",
"$(intermediate_dir)$(SEP)", NULL );
-Rule widlProxyRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_noext)_p.c $(intermediate_path_noext)_p.h: $(source) $(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\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"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_noext)_p.o.d: $(intermediate_path_noext)_p.c | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -M -MP -MT $@ $<\n"
- "-include $(intermediate_path_noext)_p.o.d\n"
- "endif\n"
- "$(intermediate_path_noext)_p.o: $(intermediate_path_noext)_p.c $(intermediate_path_noext)_p.h$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext)_p.o.d) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
+Rule widlProxyRule ( "$(eval $(call RBUILD_WIDL_PROXY_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
"$(intermediate_path_noext)_p.h",
"$(intermediate_path_noext)_p.c",
"$(intermediate_path_noext)_p.o",
- "$(intermediate_path_noext)_p.o.d",
"$(intermediate_dir)$(SEP)", NULL );
-Rule widlDlldataRule ( "$(source): $(dependencies) ${$(module_name)_precondition} $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) --dlldata-only --dlldata=$(source) $(bare_dependencies)\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_path_noext).o.d: $(source) | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
- "-include $(intermediate_path_noext).o.d\n"
- "endif\n"
- "$(intermediate_path_noext).o: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext).o.d) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(intermediate_path_noext).o",
- "$(intermediate_path_noext).o.d", NULL );
-Rule widlTlbRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_dir)$(SEP)$(module_name).tlb: $(source) $(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -t -T $(intermediate_path_noext).tlb $(source)\n",
+Rule widlInterfaceRule ( "$(eval $(call RBUILD_WIDL_INTERFACE_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_noext)_i.c",
+ "$(intermediate_path_noext)_i.o",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule widlDlldataRule ( "$(eval $(call RBUILD_WIDL_DLLDATA_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags),$(bare_dependencies)))\n",
+ "$(intermediate_path_noext).o", NULL );
+Rule widlTlbRule ( "$(eval $(call RBUILD_WIDL_TLB_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
"$(intermediate_dir)$(SEP)", NULL );
-Rule gccRule ( "$(eval $(call RBUILD_GCC_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
- "$(intermediate_path_unique).o",
- "$(intermediate_path_unique).o.d", NULL );
-Rule gccHostRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_unique).o: $(source) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_HOSTCC)\n"
- "\t${host_gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(intermediate_path_unique).o", NULL );
-Rule gppRule ( "$(eval $(call RBUILD_GPP_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
- "$(intermediate_path_unique).o",
- "$(intermediate_path_unique).o.d", NULL );
-Rule gppHostRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(intermediate_path_unique).o: $(source) $(dependencies) | $(intermediate_dir)\n"
- "\t$(ECHO_HOSTCC)\n"
- "\t${host_gpp} -o $@ $($(module_name)_CXXFLAGS)$(compiler_flags) -c $<\n",
- "$(intermediate_path_unique).o", NULL );
-Rule pchRule ( "$(source): ${$(module_name)_precondition}\n"
- "ifeq ($(ROS_BUILDDEPS),full)\n"
- "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d: $(source) | $(intermediate_dir)\n"
- "\t$(ECHO_DEPENDS)\n"
- "\t$(pch_cc) -MF $@ $(pch_ccflags)$(compiler_flags) -x $(pch_language) -M -MP -MT $@ $<\n"
- "-include $(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d\n"
- "endif\n"
- "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d) $(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",
+Rule pchRule ( "$(eval $(call RBUILD_GCC_PCH_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
"$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch",
- "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d", NULL );
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)", NULL );
+Rule pchCxxRule ( "$(eval $(call RBUILD_GPP_PCH_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)", NULL );
+Rule bootRule ( "$(eval $(call RBUILD_NASM,$(module_name),$(source),$(dependencies),,$(module_output)))\n",
+ "$(module_output)",
+ "$(OUTPUT)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule nasmRule ( "$(eval $(call RBUILD_NASM,$(module_name),$(source),$(dependencies),,$(intermediate_path_unique).o))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_dir)$(SEP)", NULL );
+
+/* TODO: move these to rules.mak */
+Rule wmcRule ( "$(intermediate_path_noext).rc $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h: $(WMC_TARGET) $(source) | $(intermediate_dir)\n"
+ "\t$(ECHO_WMC)\n"
+ "\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h -o $(intermediate_path_noext).rc $(source)\n",
+ "$(intermediate_path_noext).rc",
+ "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h",
+ "$(intermediate_dir)$(SEP)", NULL );
+/* TODO: if possible, move these to rules.mak */
+Rule arRule1 ( "$(intermediate_path_noext).a: $($(module_name)_OBJS) $(dependencies) | $(intermediate_dir)\n",
+ "$(intermediate_path_noext).a",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule arRule2 ( "\t$(ECHO_AR)\n"
+ "\t${ar} -rc $@ $($(module_name)_OBJS)\n",
+ NULL );
+Rule arHostRule2 ( "\t$(ECHO_HOSTAR)\n"
+ "\t${host_ar} -rc $@ $($(module_name)_OBJS)\n",
+ NULL );
+
Rule emptyRule ( "", NULL );
void
const FileLocation *pchFilename = GetPrecompiledHeaderFilename ();
string dependencies = extraDependencies;
- string flags;
- string extension = GetExtension ( *sourceFile );
- if ( extension == ".cc" || extension == ".cpp" || extension == ".cxx" )
- flags = GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags, CompilerTypeCPP );
- else
- flags = GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags, CompilerTypeCC );
-
if ( pchFilename )
{
dependencies += " " + backend->GetFullName ( *pchFilename );
if ( rpcDependencies.size () > 0 )
dependencies += " " + v2s ( backend, rpcDependencies, 5 );
- rule->Execute ( fMakefile, backend, module, sourceFile, clean_files, dependencies, flags );
+ rule->Execute ( fMakefile, backend, module, sourceFile, clean_files, dependencies );
}
string
size_t i;
Rule *customRule = NULL;
- fprintf ( fMakefile, "# COMMANDS\n" );
-
for ( i = 0; i < sizeof ( rules ) / sizeof ( rules[0] ); i++ )
{
if ( rules[i].host != HostDontCare && rules[i].host != ModuleHandlerInformations[module.type].DefaultHost )
{
GenerateCommands ( *compilationUnits[i],
moduleDependencies );
- fprintf ( fMakefile,
- "\n" );
}
vector<CompilationUnit*> sourceCompilationUnits;
}
CleanupCompilationUnitVector ( sourceCompilationUnits );
- SpecFileType spec = IsSpecDefinitionFile ();
-
- if ( spec )
- {
- Rule * defRule;
-
- if (spec == PSpec)
- defRule = &winebuildPRule;
- else
- defRule = &winebuildRule;
-
- defRule->Execute ( fMakefile, backend, module, module.importLibrary->source, clean_files );
- }
-
if ( module.type == RpcProxy )
{
widlDlldataRule.Execute ( fMakefile,
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;
if ( rpcDependencies.size () > 0 )
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 );
+ if ( module.cplusplus )
+ pchCxxRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
+ else
+ pchRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
+
fprintf ( fMakefile, "\n" );
}
module.name.c_str () );
}
-string
-MingwModuleHandler::GetLinkingDependenciesMacro () const
-{
- return ssprintf ( "$(%s_LINKDEPS)", module.name.c_str () );
-}
-
string
MingwModuleHandler::GetLibsMacro () const
{
}
string
-MingwModuleHandler::GetDebugFormat () const
+MingwModuleHandler::GetDebugFormat ()
{
if (Environment::GetArch() == "amd64")
{
{
sourcesMacro = ssprintf ( "%s_SOURCES", module.name.c_str ());
- GenerateSourceMacros ( module.non_if_data );
+ if ( module.type == RpcProxy || module.type == Cabinet )
+ GenerateSourceMacros ( module.non_if_data );
// future references to the macro will be to get its values
sourcesMacro = ssprintf ("$(%s)", sourcesMacro.c_str ());
void
MingwModuleHandler::GenerateTargetMacro ()
{
- fprintf ( fMakefile, "# TARGET MACRO\n" );
fprintf ( fMakefile,
"%s := %s\n",
GetTargetMacro ( module, false ).c_str (),
{
set<const Define *> used_defs;
- fprintf ( fMakefile, "# OTHER MACROS\n" );
-
- commonflagsMacro = ssprintf ("%s_COMMONFLAGS", module.name.c_str ());
- cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());
- cxxflagsMacro = ssprintf ("%s_CXXFLAGS", module.name.c_str ());
- nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());
- windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());
- widlflagsMacro = ssprintf ("%s_WIDLFLAGS", module.name.c_str ());
linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());
libsMacro = ssprintf("%s_LIBS", module.name.c_str ());
- linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ());
- GenerateMacros (
- "=",
- module.non_if_data,
- &module.linkerFlags,
- used_defs );
+ const FileLocation * pchPath = GetPrecompiledHeaderPath ();
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
+ if ( pchPath )
{
- GenerateMacros("+=", module.project.host_non_if_data, NULL, used_defs);
- }
- else
- {
- GenerateMacros (
- "+=",
- module.project.non_if_data,
- NULL,
- used_defs );
- }
+ string pchPathStr = backend->GetFullName ( *pchPath );
+ delete pchPath;
- if ( IsSpecDefinitionFile() )
- {
- vector<FileLocation> s;
- GetSpecImplibDependencies ( s, module.importLibrary->source );
-
- fprintf (
- fMakefile,
- "%s +=",
- linkDepsMacro.c_str() );
- for ( size_t i = 0; i < s.size(); i++ )
- fprintf ( fMakefile,
- " %s",
- backend->GetFullName ( s[i] ).c_str () );
- fprintf ( fMakefile, "\n" );
- }
+ fprintf ( fMakefile,
+ "%s_%sINCLUDES+= -I%s\n",
+ module.name.c_str(),
+ CompilerPrefixTable[CompilerTypeCC],
+ pchPathStr.c_str() );
- string globalCflags = " ";
- globalCflags += ssprintf ("$(%s)", commonflagsMacro.c_str ());
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
- {
- if ( module.dynamicCRT )
- globalCflags += " -D_DLL -D__USE_CRTIMP";
- }
- else
- globalCflags += " -Wall -Wpointer-arith";
- globalCflags += " -g" + MingwModuleHandler::GetDebugFormat ();
- if ( backend->usePipe )
- globalCflags += " -pipe";
- if ( !module.allowWarnings )
- globalCflags += " -Werror";
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
- {
- if ( module.cplusplus )
- globalCflags += " $(HOST_CPPFLAGS)";
- else
- globalCflags += " -Wno-strict-aliasing $(HOST_CFLAGS)";
- }
- else
- {
- if ( module.cplusplus )
- {
- globalCflags += " $(TARGET_CPPFLAGS)";
- }
- else
- globalCflags += " -nostdinc";
+ fprintf ( fMakefile,
+ "%s_%sINCLUDES+= -I%s\n",
+ module.name.c_str(),
+ CompilerPrefixTable[CompilerTypeCXX],
+ pchPathStr.c_str() );
}
- // Always force disabling of sibling calls optimisation for GCC
- // (TODO: Move to version-specific once this bug is fixed in GCC)
- globalCflags += " -fno-optimize-sibling-calls";
+ const char * toolPrefix = "";
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
- {
- fprintf (
- fMakefile,
- "%s +=%s\n",
- cflagsMacro.c_str (),
- (" $(PROJECT_CFLAGS)" + globalCflags).c_str () );
-
- fprintf (
- fMakefile,
- "%s +=%s\n",
- cxxflagsMacro.c_str (),
- (" $(PROJECT_CXXFLAGS)" + globalCflags).c_str () );
-
- fprintf (
- fMakefile,
- "%s += $(PROJECT_RCFLAGS)\n",
- windresflagsMacro.c_str () );
-
- fprintf (
- fMakefile,
- "%s += $(PROJECT_WIDLFLAGS) -I%s\n",
- widlflagsMacro.c_str (),
- module.output->relative_path.c_str () );
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
+ toolPrefix = "HOST_";
- fprintf (
- fMakefile,
- "%s_LFLAGS := $(PROJECT_LFLAGS) $(%s_LFLAGS)\n",
- module.name.c_str (),
- module.name.c_str () );
- }
- else
+ // FIXME: this is very ugly and generates lots of useless entries
+ for ( unsigned type = CompilerTypeCC; type < CompilerTypesCount; ++ type )
{
- fprintf (
- fMakefile,
- "%s +=%s\n",
- cflagsMacro.c_str (),
- globalCflags.c_str () );
+ string flags;
- fprintf (
- fMakefile,
- "%s +=%s\n",
- cxxflagsMacro.c_str (),
- globalCflags.c_str () );
+ if ( module.dynamicCRT )
+ flags += ssprintf ( " $(%s%sFLAG_CRTDLL)", toolPrefix, CompilerPrefixTable[type] );
- fprintf (
- fMakefile,
- "%s_LFLAGS += $(HOST_LFLAGS)\n",
- module.name.c_str () );
- }
+ // FIXME: this duplicates the flag for CPP and C/CXX
+ if ( !module.allowWarnings )
+ flags += ssprintf ( " $(%s%sFLAG_WERROR)", toolPrefix, CompilerPrefixTable[type] );
- fprintf (
- fMakefile,
- "%s += $(%s)\n",
- linkDepsMacro.c_str (),
- libsMacro.c_str () );
+ if ( module.isUnicode )
+ flags += ssprintf ( " $(%s%sFLAG_UNICODE)", toolPrefix, CompilerPrefixTable[type] );
- const char *cflags = ModuleHandlerInformations[module.type].cflags;
- if ( strlen( cflags ) > 0 )
- {
- fprintf ( fMakefile,
- "%s += %s\n\n",
- cflagsMacro.c_str (),
- cflags );
- fprintf ( fMakefile,
- "%s += %s\n\n",
- cxxflagsMacro.c_str (),
- cflags );
+ if ( flags.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sFLAGS+=%s\n",
+ module.name.c_str(),
+ CompilerPrefixTable[type],
+ flags.c_str() );
+ }
}
- const char* nasmflags = ModuleHandlerInformations[module.type].nasmflags;
- if ( strlen( nasmflags ) > 0 )
- {
- fprintf ( fMakefile,
- "%s += %s\n\n",
- nasmflagsMacro.c_str (),
- nasmflags );
- }
+ GenerateParameters ( module.name.c_str(), "+=", module.non_if_data );
const char *linkerflags = ModuleHandlerInformations[module.type].linkerflags;
if ( strlen( linkerflags ) > 0 )
linkerflags );
}
- fprintf ( fMakefile, "\n\n" );
+ // FIXME: make rules for linker, move standard flags there
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
+ {
+ if ( module.cplusplus )
+ fprintf ( fMakefile,
+ "%s+= $(PROJECT_LPPFLAGS)\n\n",
+ linkerflagsMacro.c_str () );
+ else
+ fprintf ( fMakefile,
+ "%s+= $(PROJECT_LFLAGS)\n\n",
+ linkerflagsMacro.c_str () );
+ }
- // future references to the macros will be to get their values
- commonflagsMacro = ssprintf ("$(%s)", commonflagsMacro.c_str ());
- cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ());
- cxxflagsMacro = ssprintf ("$(%s)", cxxflagsMacro.c_str ());
- nasmflagsMacro = ssprintf ("$(%s)", nasmflagsMacro.c_str ());
- widlflagsMacro = ssprintf ("$(%s)", widlflagsMacro.c_str ());
+ GenerateMacros (
+ "+=",
+ module.non_if_data,
+ &module.linkerFlags,
+ used_defs );
+
+ fprintf ( fMakefile, "\n\n" );
}
void
Rule * defRule;
if (spec == PSpec)
- defRule = &winebuildPDefRule;
+ defRule = &winebuildPRule;
else
- defRule = &winebuildDefRule;
+ defRule = &winebuildRule;
defRule->Execute ( fMakefile, backend, module, module.importLibrary->source, clean_files );
}
GetBasename ( file->name ) + "_" + module.name + ".stubs.c" ) );
}
-void
-MingwModuleHandler::GetSpecImplibDependencies (
- vector<FileLocation>& dependencies,
- const FileLocation *file ) const
-{
- dependencies.push_back ( FileLocation ( IntermediateDirectory,
- file->relative_path,
- GetBasename ( file->name ) + "_" + module.name + ".auto.def" ) );
-}
-
void
MingwModuleHandler::GetMcObjectDependencies (
vector<FileLocation>& dependencies,
{
string targetMacro ( GetTargetMacro (module) );
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
string libsMacro = GetLibsMacro ();
GenerateRules ();
fprintf ( fMakefile, "%s: %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_HOSTLD)\n" );
fprintf ( fMakefile,
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ();
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=windows -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
void
MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
{
+ fprintf ( fMakefile, "# BOOT LOADER MODULE TARGET\n" );
string targetName ( module.output->name );
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ();
module.name + ".junk.tmp" );
CLEAN_FILE ( junk_tmp );
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateRules ();
- fprintf ( fMakefile, "# BOOT LOADER MODULE TARGET\n" );
-
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
"\t${gcc} -Wl,--subsystem,native -Wl,--section-start,startup=0x8000 -o %s %s %s %s\n",
backend->GetFullName ( junk_tmp ).c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
GetLinkerMacro ().c_str ());
}
else
"\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s\n",
backend->GetFullName ( junk_tmp ).c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
GetLinkerMacro ().c_str ());
}
fprintf ( fMakefile,
void
MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget ()
{
+ fprintf ( fMakefile, "# BOOT PROGRAM MODULE TARGET\n" );
+
string targetName ( module.output->name );
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ();
CLEAN_FILE ( junk_elf );
CLEAN_FILE ( junk_cpy );
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
const Module *payload = module.project.LocateModule ( module.payload );
GenerateRules ();
- fprintf ( fMakefile, "# BOOT PROGRAM MODULE TARGET\n" );
-
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: %s %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
payload->name.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
fprintf ( fMakefile, "\t${ld} $(%s_LINKFORMAT) %s %s -o %s\n",
module.buildtype.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullName ( junk_tmp ).c_str (),
backend->GetFullName ( junk_elf ).c_str () );
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
void
MingwCabinetModuleHandler::Process ()
{
+ fprintf ( fMakefile, "# CABINET MODULE TARGET\n" );
string targetMacro ( GetTargetMacro (module) );
GenerateRules ();
- fprintf ( fMakefile, "# CABINET MODULE TARGET\n" );
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: $(CABMAN_TARGET) | %s\n",
targetMacro.c_str (),
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ();
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
string libsMacro = GetLibsMacro ();
string debugFormat = GetDebugFormat ();
+ fprintf ( fMakefile, "# ELF EXECUTABLE TARGET\n" );
GenerateRules ();
- fprintf ( fMakefile, "# ELF EXECUTABLE TARGET\n" );
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_BOOTPROG)\n" );
targetMacro.c_str () );
delete target_file;
+ fprintf ( fMakefile, "#/ELF EXECUTABLE TARGET\n" );
}