Clean object files for static libraries

svn path=/branches/xmlbuildsystem/; revision=14736
This commit is contained in:
Casper Hornstrup
2005-04-22 09:19:18 +00:00
parent ef5b027655
commit 2f6df3a9cf
5 changed files with 101 additions and 51 deletions
@@ -427,6 +427,7 @@ MingwBackend::GenerateGlobalVariables () const
GenerateGlobalCFlagsAndProperties (
"=",
ProjectNode.non_if_data );
fprintf ( fMakefile, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS)\n" );
fprintf ( fMakefile, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS)\n" );
fprintf ( fMakefile, "PROJECT_LFLAGS := %s\n",
@@ -429,11 +429,11 @@ MingwModuleHandler::GenerateCleanTarget () const
if ( 0 == clean_files.size() )
return;
fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() );
fprintf ( fMakefile, "%s_clean:\n\t-@$(rm)", module.name.c_str() );
fprintf ( fMakefile, "%s_clean:\n\t-@${rm}", module.name.c_str() );
for ( size_t i = 0; i < clean_files.size(); i++ )
{
if ( 9==((i+1)%10) )
fprintf ( fMakefile, " 2>$(NUL)\n\t-@$(rm)" );
fprintf ( fMakefile, " 2>$(NUL)\n\t-@${rm}" );
fprintf ( fMakefile, " %s", clean_files[i].c_str() );
}
fprintf ( fMakefile, " 2>$(NUL)\n" );
@@ -1147,13 +1147,58 @@ MingwModuleHandler::GenerateBuildMapCode ()
}
void
MingwModuleHandler::GenerateCleanObjectsAsYouGoCode ( const string& files )
MergeStringVector ( const vector<string>& input,
vector<string>& output )
{
int wrap_at = 25;
string s;
int wrap_count = -1;
for ( size_t i = 0; i < input.size (); i++ )
{
if ( input[i].size () == 0 )
continue;
if ( wrap_count++ == wrap_at )
{
output.push_back ( s );
s = "";
wrap_count = 0;
}
else if ( s.size () > 0)
s += " ";
s += input[i];
}
if ( s.length () > 0 )
output.push_back ( s );
}
void
MingwModuleHandler::GetObjectsVector ( const IfableData& data,
vector<string>& objectFiles ) const
{
for ( size_t i = 0; i < data.files.size (); i++ )
{
File& file = *data.files[i];
objectFiles.push_back ( GetObjectFilename ( file.name, NULL ) );
}
}
void
MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const
{
if ( backend->cleanAsYouGo )
{
fprintf ( fMakefile,
"\t-@${rm} %s 2>$(NUL)\n",
files.c_str () );
vector<string> objectFiles;
GetObjectsVector ( module.non_if_data,
objectFiles );
vector<string> lines;
MergeStringVector ( objectFiles,
lines );
for ( size_t i = 0; i < lines.size (); i++ )
{
fprintf ( fMakefile,
"\t-@${rm} %s 2>$(NUL)\n",
lines[i].c_str () );
}
}
}
@@ -1226,7 +1271,7 @@ MingwModuleHandler::GenerateLinkerCommand (
"\t-@${rm} %s 2>$(NUL)\n",
temp_exp.c_str () );
GenerateCleanObjectsAsYouGoCode ( objectsMacro );
GenerateCleanObjectsAsYouGoCode ();
}
else
{
@@ -1239,7 +1284,7 @@ MingwModuleHandler::GenerateLinkerCommand (
libsMacro.c_str (),
GetLinkerMacro ().c_str () );
GenerateCleanObjectsAsYouGoCode ( objectsMacro );
GenerateCleanObjectsAsYouGoCode ();
}
GenerateBuildMapCode ();
@@ -1362,6 +1407,8 @@ MingwModuleHandler::GenerateArchiveTarget ( const string& ar,
ar.c_str (),
objs_macro.c_str ());
GenerateCleanObjectsAsYouGoCode ();
return archiveFilename;
}
@@ -38,6 +38,8 @@ public:
string_list* pclean_files );
std::string GetModuleTargets ( const Module& module );
void GetObjectsVector ( const IfableData& data,
std::vector<std::string>& objectFiles ) const;
void GenerateObjectMacro();
void GenerateTargetMacro();
void GenerateOtherMacros();
@@ -77,7 +79,7 @@ protected:
std::string GetLinkingDependenciesMacro () const;
std::string GetLibsMacro () const;
std::string GetLinkerMacro () const;
void GenerateCleanObjectsAsYouGoCode ( const std::string& files );
void GenerateCleanObjectsAsYouGoCode () const;
void GenerateLinkerCommand ( const std::string& dependencies,
const std::string& linker,
const std::string& linkerParameters,
+41
View File
@@ -0,0 +1,41 @@
RSYM_BASE = $(TOOLS_BASE)
RSYM_BASE_ = $(RSYM_BASE)$(SEP)
RSYM_INT = $(INTERMEDIATE_)$(RSYM_BASE)
RSYM_INT_ = $(RSYM_INT)$(SEP)
RSYM_OUT = $(OUTPUT_)$(RSYM_BASE)
RSYM_OUT_ = $(RSYM_OUT)$(SEP)
RSYM_TARGET = \
$(EXEPREFIX)$(RSYM_OUT_)rsym$(EXEPOSTFIX)
RSYM_SOURCES = \
$(RSYM_BASE_)rsym.c \
$(RSYM_BASE_)rsym_common.c
RSYM_OBJECTS = \
$(addprefix $(INTERMEDIATE_), $(RSYM_SOURCES:.c=.o))
RSYM_HOST_CFLAGS = -g -Werror -Wall
RSYM_HOST_LFLAGS = -g
.PHONY: rsym
rsym: $(RSYM_TARGET)
$(RSYM_TARGET): $(RSYM_OBJECTS) | $(RSYM_OUT)
$(ECHO_LD)
${host_gcc} $(RSYM_OBJECTS) $(RSYM_HOST_LFLAGS) -o $@
$(RSYM_INT_)rsym.o: $(RSYM_BASE_)rsym.c | $(RSYM_INT)
$(ECHO_CC)
${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
$(RSYM_INT_)rsym_common.o: $(RSYM_BASE_)rsym_common.c | $(RSYM_INT)
$(ECHO_CC)
${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
.PHONY: rsym_clean
rsym_clean:
-@$(nrm) $(RSYM_TARGET) $(RSYM_OBJECTS) 2>$(NUL)
clean: rsym_clean
+1 -42
View File
@@ -15,49 +15,8 @@ $(TOOLS_OUT): | $(OUTPUT)
${mkdir} $@
endif
RSYM_BASE = $(TOOLS_BASE)
RSYM_BASE_ = $(RSYM_BASE)$(SEP)
RSYM_INT = $(INTERMEDIATE_)$(RSYM_BASE)
RSYM_INT_ = $(RSYM_INT)$(SEP)
RSYM_OUT = $(OUTPUT_)$(RSYM_BASE)
RSYM_OUT_ = $(RSYM_OUT)$(SEP)
RSYM_TARGET = \
$(EXEPREFIX)$(RSYM_OUT_)rsym$(EXEPOSTFIX)
RSYM_SOURCES = \
$(RSYM_BASE_)rsym.c \
$(RSYM_BASE_)rsym_common.c
RSYM_OBJECTS = \
$(addprefix $(INTERMEDIATE_), $(RSYM_SOURCES:.c=.o))
RSYM_HOST_CFLAGS = -g -Werror -Wall
RSYM_HOST_LFLAGS = -g
.PHONY: rsym
rsym: $(RSYM_TARGET)
$(RSYM_TARGET): $(RSYM_OBJECTS) | $(RSYM_OUT)
$(ECHO_LD)
${host_gcc} $(RSYM_OBJECTS) $(RSYM_HOST_LFLAGS) -o $@
$(RSYM_INT_)rsym.o: $(RSYM_BASE_)rsym.c | $(RSYM_INT)
$(ECHO_CC)
${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
$(RSYM_INT_)rsym_common.o: $(RSYM_BASE_)rsym_common.c | $(RSYM_INT)
$(ECHO_CC)
${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
.PHONY: rsym_clean
rsym_clean:
-@$(rm) $(RSYM_TARGET) $(RSYM_OBJECTS) 2>$(NUL)
clean: rsym_clean
include tools/rsym.mak
include tools/bin2res/bin2res.mak
include tools/buildno/buildno.mak
include tools/cabman/cabman.mak