Generate object macros before target macros

svn path=/branches/xmlbuildsystem/; revision=14311
This commit is contained in:
Casper Hornstrup
2005-03-25 14:31:00 +00:00
parent 4aa22b18ad
commit 3756253ddf
5 changed files with 75 additions and 27 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ CABMAN_HOST_LFLAGS = -g $(CABMAN_HOST_LIBS)
.PHONY: cabman
cabman: $(CABMAN_TARGET)
$(CABMAN_TARGET): $(CABMAN_OBJECTS) $(CABMAN_HOST_LIBS) $(CABMAN_OUT)
$(CABMAN_TARGET1): $(CABMAN_OBJECTS) $(CABMAN_HOST_LIBS) $(CABMAN_OUT)
$(ECHO_LD)
${host_gpp} $(CABMAN_OBJECTS) $(CABMAN_HOST_LFLAGS) -o $@
+2 -20
View File
@@ -141,6 +141,8 @@ MingwBackend::Process ()
size_t iend = v.size ();
for ( i = 0; i < iend; i++ )
v[i]->GenerateObjectMacro();
for ( i = 0; i < iend; i++ )
v[i]->GenerateTargetMacro();
fprintf ( fMakefile, "\n" );
@@ -419,26 +421,6 @@ MingwBackend::GenerateDirectoryTargets ()
d.CreateRule ( fMakefile, "" );
if ( i ) fprintf ( fMakefile, "endif\n" );
}
/*if ( directories.size () == 0 )
return;
set_string::iterator i;
for ( i = directories.begin ();
i != directories.end ();
i++ )
{
if ( IncludeDirectoryTarget ( *i ) )
{
fprintf ( fMakefile,
"%s: $(RMKDIR_TARGET)\n",
i->c_str () );
fprintf ( fMakefile,
"\t${mkdir} %s\n\n",
i->c_str () );
}
}
directories.clear ();*/
}
string
@@ -614,6 +614,42 @@ MingwModuleHandler::GenerateMacros (
}
}
const vector<If*>& ifs = data.ifs;
for ( i = 0; i < ifs.size(); i++ )
{
If& rIf = *ifs[i];
if ( rIf.data.defines.size()
|| rIf.data.includes.size()
|| rIf.data.libraries.size()
|| rIf.data.files.size()
|| rIf.data.ifs.size() )
{
fprintf (
fMakefile,
"ifeq (\"$(%s)\",\"%s\")\n",
rIf.property.c_str(),
rIf.value.c_str() );
GenerateMacros (
"+=",
rIf.data,
NULL,
NULL );
fprintf (
fMakefile,
"endif\n\n" );
}
}
}
void
MingwModuleHandler::GenerateObjectMacros (
const char* assignmentOperation,
const IfableData& data,
const vector<CompilerFlag*>* compilerFlags,
const vector<LinkerFlag*>* linkerFlags )
{
size_t i;
const vector<File*>& files = data.files;
if ( files.size () > 0 )
{
@@ -666,7 +702,7 @@ MingwModuleHandler::GenerateMacros (
"ifeq (\"$(%s)\",\"%s\")\n",
rIf.property.c_str(),
rIf.value.c_str() );
GenerateMacros (
GenerateObjectMacros (
"+=",
rIf.data,
NULL,
@@ -887,7 +923,7 @@ MingwModuleHandler::GenerateLinkerCommand (
const string& libsMacro )
{
string target ( GetTargetMacro ( module ) );
string target_folder ( GetDirectory(GetTargetFilename(module,NULL)) );
string target_folder ( GetDirectory ( GetTargetFilename ( module, NULL ) ) );
fprintf ( fMakefile,
"%s: %s %s $(RSYM_TARGET)\n",
@@ -1107,13 +1143,37 @@ MingwModuleHandler::GetLinkerMacro () const
module.name.c_str () );
}
string
MingwModuleHandler::GetModuleTargets ( const Module& module )
{
if ( module.type == ObjectLibrary )
return GetObjectsMacro ( module );
else
return GetTargetFilename ( module, NULL );
}
void
MingwModuleHandler::GenerateObjectMacro ()
{
objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ());
GenerateObjectMacros (
"=",
module.non_if_data,
&module.compilerFlags,
&module.linkerFlags );
// future references to the macro will be to get its values
objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ());
}
void
MingwModuleHandler::GenerateTargetMacro ()
{
fprintf ( fMakefile,
"%s := %s\n",
GetTargetMacro(module,false).c_str (),
GetTargetFilename(module,NULL).c_str () );
GetTargetMacro ( module, false ).c_str (),
GetModuleTargets ( module ).c_str () );
}
void
@@ -1123,7 +1183,6 @@ MingwModuleHandler::GenerateOtherMacros ()
nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());
windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());
linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());
objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ());
libsMacro = ssprintf("%s_LIBS", module.name.c_str ());
linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ());
@@ -1202,7 +1261,6 @@ MingwModuleHandler::GenerateOtherMacros ()
// future references to the macros will be to get their values
cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ());
nasmflagsMacro = ssprintf ("$(%s)", nasmflagsMacro.c_str ());
objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ());
}
void
@@ -36,6 +36,8 @@ public:
const Module& module,
string_list* pclean_files );
std::string GetModuleTargets ( const Module& module );
void GenerateObjectMacro();
void GenerateTargetMacro();
void GenerateOtherMacros();
@@ -101,6 +103,10 @@ private:
const IfableData& data,
const std::vector<CompilerFlag*>* compilerFlags,
const std::vector<LinkerFlag*>* linkerFlags );
void GenerateObjectMacros ( const char* assignmentOperation,
const IfableData& data,
const std::vector<CompilerFlag*>* compilerFlags,
const std::vector<LinkerFlag*>* linkerFlags );
std::string GenerateGccIncludeParameters () const;
std::string GenerateGccParameters () const;
std::string GenerateNasmParameters () const;
+2
View File
@@ -5,11 +5,13 @@ TOOLS_INT_ = $(TOOLS_INT)$(SEP)
TOOLS_OUT = $(OUTPUT_)$(TOOLS_BASE)
TOOLS_OUT_ = $(TOOLS_OUT)$(SEP)
.LOW_RESOLUTION_TIME: $(TOOLS_INT)
$(TOOLS_INT): $(INTERMEDIATE)
$(ECHO_MKDIR)
${mkdir} $@
ifneq ($(INTERMEDIATE),$(OUTPUT))
.LOW_RESOLUTION_TIME: $(TOOLS_OUT)
$(TOOLS_OUT): $(OUTPUT)
$(ECHO_MKDIR)
${mkdir} $@