fixed some dependency issues, verbose support, 'make clean' gets more Modified: branches/xmlbuildsystem/reactos/Makefile Modified: branches/xmlbuildsystem/reactos/tools/Makefile Modified: branches/xmlbuildsystem/reactos/tools/buildno/makefile Modified: branches/xmlbuildsystem/reactos/tools/cdmake/makefile Modified: branches/xmlbuildsystem/reactos/tools/nci/makefile Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/unicode/makefile Modified: branches/xmlbuildsystem/reactos/tools/wmc/makefile Modified: branches/xmlbuildsystem/reactos/tools/wpp/Makefile Modified: branches/xmlbuildsystem/reactos/tools/wrc/makefile _____
Modified: branches/xmlbuildsystem/reactos/Makefile --- branches/xmlbuildsystem/reactos/Makefile 2005-03-09 08:04:40 UTC (rev 13898) +++ branches/xmlbuildsystem/reactos/Makefile 2005-03-09 08:12:30 UTC (rev 13899) @@ -1,37 +1,52 @@
-host_gcc = gcc -host_gpp = g++ -host_ld = ld -host_ar = ar -host_objcopy = objcopy +# Default to half-verbose mode +ifeq ($(VERBOSE),no) + Q = @ + HALFVERBOSEECHO = @: +else +ifeq ($(VERBOSE),yes) + Q = + HALFVERBOSEECHO = @: +else + Q = @ + HALFVERBOSEECHO = @echo +endif +endif + + +host_gcc = $(Q)gcc +host_gpp = $(Q)g++ +host_ld = $(Q)ld +host_ar = $(Q)ar +host_objcopy = $(Q)objcopy ifeq ($(HOST),mingw32-linux) EXEPREFIX = ./ EXEPOSTFIX = SEP = / - nmkdir = mkdir -p - gcc = mingw32-gcc - gpp = mingw32-g++ - ld = mingw32-ld - ar = mingw32-ar - objcopy = mingw32-objcopy - dlltool = mingw32-dlltool - windres = mingw32-windres + nmkdir = $(Q)mkdir -p + gcc = $(Q)mingw32-gcc + gpp = $(Q)mingw32-g++ + ld = $(Q)mingw32-ld + ar = $(Q)mingw32-ar + objcopy = $(Q)mingw32-objcopy + dlltool = $(Q)mingw32-dlltool + windres = $(Q)mingw32-windres rm = rm -f - cp = cp + cp = $(Q)cp NUL = /dev/null else # mingw32-windows EXEPREFIX = EXEPOSTFIX = .exe SEP = $(EMPTY_VAR) - nmkdir = mkdir - gcc = gcc - gpp = g++ - ld = ld - ar = ar - objcopy = objcopy - dlltool = dlltool - windres = windres + nmkdir = $(Q)mkdir + gcc = $(Q)gcc + gpp = $(Q)g++ + ld = $(Q)ld + ar = $(Q)ar + objcopy = $(Q)objcopy + dlltool = $(Q)dlltool + windres = $(Q)windres rm = del /f /q - cp = copy /y + cp = $(Q)copy /y NUL = NUL endif
@@ -62,7 +77,8 @@
Makefile.auto: $(RMKDIR_TARGET) $(BUILDNO_TARGET) $(NCI_SERVICE_FILES) $(WMC_TARGET) $(WRC_TARGET) \ $(RSYM_TARGET) $(CDMAKE_TARGET) $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES) - tools$(SEP)rbuild$(SEP)rbuild$(EXEPOSTFIX) mingw + $(HALFVERBOSEECHO) [RBUILD] makefile.auto + $(Q)tools$(SEP)rbuild$(SEP)rbuild$(EXEPOSTFIX) mingw
include$(SEP)reactos$(SEP)bugcodes.h ntoskrnl$(SEP)bugcodes.rc: $(WMC_TARGET) ntoskrnl$(SEP)ntoskrnl.mc _____
Modified: branches/xmlbuildsystem/reactos/tools/Makefile --- branches/xmlbuildsystem/reactos/tools/Makefile 2005-03-09 08:04:40 UTC (rev 13898) +++ branches/xmlbuildsystem/reactos/tools/Makefile 2005-03-09 08:12:30 UTC (rev 13899) @@ -14,9 +14,11 @@
RMKDIR_HOST_LFLAGS = -g
$(RMKDIR_TARGET): $(RMKDIR_OBJECTS) + $(HALFVERBOSEECHO) [LD] $@ ${host_gcc} $(RMKDIR_OBJECTS) $(RMKDIR_HOST_LFLAGS) -o $(RMKDIR_TARGET)
$(RMKDIR_OBJECTS): %.o : %.c + $(HALFVERBOSEECHO) [CC] $< ${host_gcc} $(RMKDIR_HOST_CFLAGS) -c $< -o $@
.PHONY: rmkdir_clean @@ -41,9 +43,11 @@ RSYM_HOST_LFLAGS = -g
$(RSYM_TARGET): $(RSYM_OBJECTS) + $(HALFVERBOSEECHO) [LD] $@ ${host_gcc} $(RSYM_OBJECTS) $(RSYM_HOST_LFLAGS) -o $(RSYM_TARGET)
$(RSYM_OBJECTS): %.o : %.c + $(HALFVERBOSEECHO) [CC] $< ${host_gcc} $(RSYM_HOST_CFLAGS) -c $< -o $@
.PHONY: rsym_clean _____
Modified: branches/xmlbuildsystem/reactos/tools/buildno/makefile --- branches/xmlbuildsystem/reactos/tools/buildno/makefile 2005-03-09 08:04:40 UTC (rev 13898) +++ branches/xmlbuildsystem/reactos/tools/buildno/makefile 2005-03-09 08:12:30 UTC (rev 13899) @@ -17,9 +17,11 @@
BUILDNO_HOST_LFLAGS = -g
$(BUILDNO_TARGET): $(BUILDNO_OBJECTS) + $(HALFVERBOSEECHO) [LD] $@ ${host_gpp} $(BUILDNO_OBJECTS) $(BUILDNO_HOST_CFLAGS) -o $(BUILDNO_TARGET)
$(BUILDNO_OBJECTS): %.o : %.cpp include$(SEP)reactos$(SEP)version.h + $(HALFVERBOSEECHO) [CC] $< ${host_gpp} $(BUILDNO_HOST_CFLAGS) -c $< -o $@
.PHONY: buildno_clean _____
Modified: branches/xmlbuildsystem/reactos/tools/cdmake/makefile --- branches/xmlbuildsystem/reactos/tools/cdmake/makefile 2005-03-09 08:04:40 UTC (rev 13898) +++ branches/xmlbuildsystem/reactos/tools/cdmake/makefile 2005-03-09 08:12:30 UTC (rev 13899) @@ -15,9 +15,11 @@
CDMAKE_HOST_LFLAGS = -g
$(CDMAKE_TARGET): $(CDMAKE_OBJECTS) + $(HALFVERBOSEECHO) [LD] $@ ${host_gcc} $(CDMAKE_OBJECTS) $(CDMAKE_HOST_CFLAGS) -o $(CDMAKE_TARGET)
$(CDMAKE_OBJECTS): %.o : %.c + $(HALFVERBOSEECHO) [CC] $< ${host_gcc} $(CDMAKE_CFLAGS) -c $< -o $@
.PHONY: cdmake_clean _____
Modified: branches/xmlbuildsystem/reactos/tools/nci/makefile --- branches/xmlbuildsystem/reactos/tools/nci/makefile 2005-03-09 08:04:40 UTC (rev 13898) +++ branches/xmlbuildsystem/reactos/tools/nci/makefile 2005-03-09 08:12:30 UTC (rev 13899) @@ -14,9 +14,11 @@
NCI_HOST_LFLAGS = -g
$(NCI_TARGET): $(NCI_OBJECTS) + $(HALFVERBOSEECHO) [LD] $@ ${host_gcc} $(NCI_OBJECTS) $(NCI_HOST_CFLAGS) -o $(NCI_TARGET)
$(NCI_OBJECTS): %.o : %.c + $(HALFVERBOSEECHO) [CC] $< ${host_gcc} $(NCI_HOST_CFLAGS) -c $< -o $@
.PHONY: nci_clean @@ -45,7 +47,8 @@ $(WIN32K_USER_STUBS)
$(NCI_SERVICE_FILES): $(NCI_TARGET) - @$(EXEPREFIX)$(NCI_TARGET) \ + $(HALFVERBOSEECHO) [NCI] $@ + $(Q)$(EXEPREFIX)$(NCI_TARGET) \ $(KERNEL_SVC_DB) \ $(WIN32K_SVC_DB) \ $(KERNEL_SERVICE_TABLE) \ _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-03-09 08:04:40 UTC (rev 13898) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-03-09 08:12:30 UTC (rev 13899) @@ -165,13 +165,13 @@
void MingwBackend::GenerateGlobalVariables () const { - fprintf ( fMakefile, "mkdir = tools" SSEP "rmkdir" EXEPOSTFIX "\n" ); - fprintf ( fMakefile, "winebuild = tools" SSEP "winebuild" SSEP "winebuild" EXEPOSTFIX "\n" ); - fprintf ( fMakefile, "bin2res = tools" SSEP "bin2res" SSEP "bin2res" EXEPOSTFIX "\n" ); - fprintf ( fMakefile, "cabman = tools" SSEP "cabman" SSEP "cabman" EXEPOSTFIX "\n" ); - fprintf ( fMakefile, "cdmake = tools" SSEP "cdmake" SSEP "cdmake" EXEPOSTFIX "\n" ); - fprintf ( fMakefile, "rsym = tools" SSEP "rsym" EXEPOSTFIX "\n" ); - fprintf ( fMakefile, "wrc = tools" SSEP "wrc" SSEP "wrc" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "mkdir = $(Q)tools" SSEP "rmkdir" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "winebuild = $(Q)tools" SSEP "winebuild" SSEP "winebuild" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "bin2res = $(Q)tools" SSEP "bin2res" SSEP "bin2res" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "cabman = $(Q)tools" SSEP "cabman" SSEP "cabman" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "cdmake = $(Q)tools" SSEP "cdmake" SSEP "cdmake" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "rsym = $(Q)tools" SSEP "rsym" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "wrc = $(Q)tools" SSEP "wrc" SSEP "wrc" EXEPOSTFIX "\n" ); fprintf ( fMakefile, "\n" ); GenerateGlobalCFlagsAndProperties ( "=", @@ -201,11 +201,14 @@ MingwBackend::GenerateAllTarget () const { fprintf ( fMakefile, "all:" ); + int wrap_count = 0; for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { Module& module = *ProjectNode.modules[i]; if ( IncludeInAllTarget ( module ) ) { + if ( wrap_count++ == 5 ) + fprintf ( fMakefile, " \\n\t\t" ), wrap_count = 0; fprintf ( fMakefile, " %s", FixupTargetFilename ( module.GetPath () ).c_str () ); @@ -316,7 +319,9 @@ MingwModuleHandler* h = MingwModuleHandler::LookupHandler ( module.node.location, module.type ); - h->Process ( module ); + MingwModuleHandler::string_list clean_files; + h->Process ( module, clean_files ); + h->GenerateCleanTarget ( module, clean_files ); h->GenerateDirectoryTargets (); }
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-03-09 08:04:40 UTC (rev 13898) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-03-09 08:12:30 UTC (rev 13899) @@ -12,6 +12,8 @@
typedef set<string> set_string;
+#define CLEAN_FILE(f) clean_files.push_back ( f ); /*if ( module.name == "crt" ) printf ( "%s(%i): clean: %s\n", __FILE__, __LINE__, f.c_str() )*/ + map<ModuleType,MingwModuleHandler*>* MingwModuleHandler::handler_map = NULL; set_string @@ -135,21 +137,6 @@ }
string -MingwModuleHandler::GetImportLibraryDependencies ( const Module& module ) const -{ - string dependencies ( "" ); - for ( size_t i = 0; i < module.libraries.size (); i++ ) - { - if ( dependencies.size () > 0 ) - dependencies += " "; - const Module* importedModule = module.project.LocateModule ( module.libraries[i]->name ); - assert ( importedModule != NULL ); - dependencies += GetImportLibraryDependency ( *importedModule ); - } - return dependencies; -} - -string MingwModuleHandler::GetModuleDependencies ( const Module& module ) const { if ( module.dependencies.size () == 0 ) @@ -172,10 +159,10 @@ return dependencies; }
-string +/*string MingwModuleHandler::GetAllDependencies ( const Module& module ) const { - string dependencies = GetImportLibraryDependencies ( module ); + string dependencies = GetImportMacro ( module ); string s = GetModuleDependencies ( module ); if ( s.length () > 0 ) { @@ -183,7 +170,7 @@ dependencies += s; } return dependencies; -} +}*/
string MingwModuleHandler::GetSourceFilenames ( const Module& module, @@ -241,6 +228,25 @@ return FixupTargetFilename ( ReplaceExtension ( sourceFilename, newExtension ) ); }
+void +MingwModuleHandler::GenerateCleanTarget ( + const Module& module, + const string_list& clean_files ) 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() ); + for ( size_t i = 0; i < clean_files.size(); i++ ) + { + if ( 9==((i+1)%10) ) + fprintf ( fMakefile, " 2>$(NUL)\n\t-@$(rm)" ); + fprintf ( fMakefile, " %s", clean_files[i].c_str() ); + } + fprintf ( fMakefile, " 2>$(NUL)\n" ); + fprintf ( fMakefile, "clean: %s_clean\n\n", module.name.c_str() ); +} + string MingwModuleHandler::GetObjectFilenames ( const Module& module ) const { @@ -272,32 +278,38 @@ if ( directory_set.size () == 0 ) return; - set_string::iterator i; + set_string::iterator it; + size_t wrap_count = 0; fprintf ( fMakefile, "directories::" );
- for ( i = directory_set.begin (); - i != directory_set.end (); - i++ ) + for ( it = directory_set.begin (); + it != directory_set.end (); + it++ ) { - if ( IncludeDirectoryTarget ( *i ) ) + if ( IncludeDirectoryTarget ( *it ) ) { + if ( wrap_count++ == 5 ) + fprintf ( fMakefile, " \\n\t\t" ), wrap_count = 0; fprintf ( fMakefile, " %s", - i->c_str () ); + it->c_str () ); } }
fprintf ( fMakefile, "\n\n" ); + wrap_count = 0;
- for ( i = directory_set.begin (); - i != directory_set.end (); - i++ ) + for ( it = directory_set.begin (); + it != directory_set.end (); + it++ ) { - if ( IncludeDirectoryTarget ( *i ) ) + if ( IncludeDirectoryTarget ( *it ) ) { + if ( wrap_count++ == 5 ) + fprintf ( fMakefile, " \\n\t\t" ), wrap_count = 0; fprintf ( fMakefile, "%s ", - i->c_str () ); + it->c_str () ); } }
@@ -409,6 +421,23 @@ }
string +MingwModuleHandler::GenerateImportLibraryDependenciesFromVector ( + const vector<Library*>& libraries ) const +{ + string dependencies ( "" ); + int wrap_count = 0; + for ( size_t i = 0; i < libraries.size (); i++ ) + { + if ( wrap_count++ == 5 ) + dependencies += " \\n\t\t", wrap_count = 0; + else if ( dependencies.size () > 0 ) + dependencies += " "; + dependencies += GetImportLibraryDependency ( *libraries[i]->imported_module ); + } + return dependencies; +} + +string MingwModuleHandler::GenerateLinkerParameters ( const Module& module ) const { return GenerateLinkerParametersFromVector ( module.linkerFlags ); @@ -470,6 +499,7 @@ const vector<File*>& files, const vector<Include*>& includes, const vector<Define*>& defines, + const vector<Library*>& libraries, const vector<CompilerFlag*>* compilerFlags, const vector<LinkerFlag*>* linkerFlags, const vector<If*>& ifs, @@ -477,7 +507,9 @@ const string& nasmflags_macro, const string& windresflags_macro, const string& linkerflags_macro, - const string& objs_macro) const + const string& objs_macro, + const string& libs_macro, + const string& linkdeps_macro ) const { size_t i;
@@ -508,7 +540,21 @@ linkerParameters.c_str() ); } } - + + if ( libraries.size () > 0 ) + { + string deps = GenerateImportLibraryDependenciesFromVector ( libraries ); + if ( deps.size () > 0 ) + { + fprintf ( + fMakefile, + "%s %s %s\n", + libs_macro.c_str(), + assignmentOperation, + deps.c_str() ); + } + } + if ( files.size () > 0 ) { for ( i = 0; i < files.size (); i++ ) @@ -544,7 +590,11 @@ for ( i = 0; i < ifs.size(); i++ ) { If& rIf = *ifs[i]; - if ( rIf.defines.size() || rIf.includes.size() || rIf.files.size() || rIf.ifs.size() ) + if ( rIf.defines.size() + || rIf.includes.size() + || rIf.libraries.size() + || rIf.files.size() + || rIf.ifs.size() ) { fprintf ( fMakefile, @@ -556,6 +606,7 @@ rIf.files, rIf.includes, rIf.defines, + rIf.libraries, NULL, NULL, rIf.ifs, @@ -563,7 +614,9 @@ nasmflags_macro, windresflags_macro, linkerflags_macro, - objs_macro ); + objs_macro, + libs_macro, + linkdeps_macro ); fprintf ( fMakefile, "endif\n\n" ); @@ -578,13 +631,16 @@ const string& nasmflags_macro, const string& windresflags_macro, const string& linkerflags_macro, - const string& objs_macro) const + const string& objs_macro, + const string& libs_macro, + const string& linkdeps_macro ) const { GenerateMacros ( "=", module.files, module.includes, module.defines, + module.libraries, &module.compilerFlags, &module.linkerFlags, module.ifs, @@ -592,23 +648,56 @@ nasmflags_macro, windresflags_macro, linkerflags_macro, - objs_macro ); - fprintf ( fMakefile, "\n" ); + objs_macro, + libs_macro, + linkdeps_macro );
+ if ( module.importLibrary ) + { + string s; + for ( size_t i = 0; i < module.files.size (); i++ ) + { + File& file = *module.files[i]; + string extension = GetExtension ( file.name ); + if ( extension == ".spec" || extension == ".SPEC" ) + { + if ( s.length () > 0 ) + s += " "; + s += GetSpecObjectDependencies ( file.name ); + } + } + if ( s.length () > 0 ) + { + fprintf ( + fMakefile, + "%s += %s\n", + linkdeps_macro.c_str(), + s.c_str() ); + } + } + fprintf ( fMakefile, - "%s += $(PROJECT_CFLAGS)\n\n", + "%s += $(PROJECT_CFLAGS)\n", cflags_macro.c_str () );
fprintf ( fMakefile, - "%s += $(PROJECT_RCFLAGS)\n\n", + "%s += $(PROJECT_RCFLAGS)\n", windresflags_macro.c_str () );
fprintf ( fMakefile, - "%s_LFLAGS += $(PROJECT_LFLAGS)\n\n", + "%s_LFLAGS += $(PROJECT_LFLAGS)\n", module.name.c_str () ); + + fprintf ( + fMakefile, + "%s += $(%s)", + linkdeps_macro.c_str (), + libs_macro.c_str () ); + + fprintf ( fMakefile, "\n" ); }
void @@ -622,6 +711,7 @@ "%s: %s\n", objectFilename.c_str (), sourceFilename.c_str () ); + fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [CC] $<\n" ); fprintf ( fMakefile, "\t%s -c %s -o %s %s\n", cc.c_str (), @@ -641,6 +731,7 @@ "%s: %s\n", objectFilename.c_str (), sourceFilename.c_str () ); + fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [GAS] $<\n" ); fprintf ( fMakefile, "\t%s -x assembler-with-cpp -c %s -o %s -D__ASM__ %s\n", cc.c_str (), @@ -659,9 +750,10 @@ "%s: %s\n", objectFilename.c_str (), sourceFilename.c_str () ); + fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [NASM] $<\n" ); fprintf ( fMakefile, "\t%s -f win32 %s -o %s %s\n", - "nasm", + "$(Q)nasm", sourceFilename.c_str (), objectFilename.c_str (), nasmflagsMacro.c_str () ); @@ -673,14 +765,15 @@ const string& windresflagsMacro ) const { string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) ); - string rciFilename = ReplaceExtension ( sourceFilename, - ".rci" ); - string resFilename = ReplaceExtension ( sourceFilename, - ".res" ); + string rciFilename = ReplaceExtension ( sourceFilename, + ".rci" ); + string resFilename = ReplaceExtension ( sourceFilename, + ".res" ); fprintf ( fMakefile, "%s: %s\n", objectFilename.c_str (), sourceFilename.c_str () ); + fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [WRC] $@\n" ); fprintf ( fMakefile, "\t${gcc} -xc -E -DRC_INVOKED ${%s} %s > %s\n", windresflagsMacro.c_str (), @@ -692,52 +785,66 @@ rciFilename.c_str (), resFilename.c_str () ); fprintf ( fMakefile, - "\t${rm} %s\n", + "\t-@${rm} %s\n", rciFilename.c_str () ); fprintf ( fMakefile, "\t${windres} %s -o %s\n", resFilename.c_str (), objectFilename.c_str () ); fprintf ( fMakefile, - "\t${rm} %s\n", + "\t-@${rm} %s\n", resFilename.c_str () ); }
void -MingwModuleHandler::GenerateWinebuildCommands ( const Module& module, - const string& sourceFilename ) const +MingwModuleHandler::GenerateWinebuildCommands ( + const Module& module, + const string& sourceFilename, + string_list& clean_files ) const { string basename = GetBasename ( sourceFilename ); + + string def_file = basename + ".spec.def"; + CLEAN_FILE ( def_file ); + + string stub_file = basename + ".stubs.c"; + CLEAN_FILE ( stub_file ); + fprintf ( fMakefile, - "%s.spec.def: %s\n", - basename.c_str (), + "%s: %s\n", + def_file.c_str (), sourceFilename.c_str () ); + fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [WINEBLD] $@\n" ); fprintf ( fMakefile, - "\t%s --def=%s -o %s.spec.def\n", + "\t%s --def=%s -o %s\n", "${winebuild}", sourceFilename.c_str (), - basename.c_str () ); + def_file.c_str () );
fprintf ( fMakefile, - "%s.stubs.c: %s\n", - basename.c_str (), + "%s: %s\n", + stub_file.c_str (), sourceFilename.c_str () ); + fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [WINEBLD] $@\n" ); fprintf ( fMakefile, - "\t%s --pedll=%s -o %s.stubs.c\n", + "\t%s --pedll=%s -o %s\n", "${winebuild}", sourceFilename.c_str (), - basename.c_str () ); + stub_file.c_str () ); }
void -MingwModuleHandler::GenerateCommands ( const Module& module, - const string& sourceFilename, - const string& cc, - const string& cppc, - const string& cflagsMacro, - const string& nasmflagsMacro, - const string& windresflagsMacro ) const +MingwModuleHandler::GenerateCommands ( + const Module& module, + const string& sourceFilename, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro, + string_list& clean_files ) const { + CLEAN_FILE ( GetObjectFilename(sourceFilename) ); string extension = GetExtension ( sourceFilename ); if ( extension == ".c" || extension == ".C" ) { @@ -782,7 +889,8 @@ else if ( extension == ".spec" || extension == ".SPEC" ) { GenerateWinebuildCommands ( module, - sourceFilename ); + sourceFilename, + clean_files ); GenerateGccCommand ( module, GetActualSourceFilename ( sourceFilename ), cc, @@ -798,20 +906,27 @@ }
void -MingwModuleHandler::GenerateLinkerCommand ( const Module& module, - const string& linker, - const string& linkerParameters, - const string& objectFilenames ) const +MingwModuleHandler::GenerateLinkerCommand ( + const Module& module, + const string& linker, + const string& linkerParameters, + const string& objectsMacro, + const string& libsMacro, + string_list& clean_files ) const { + fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [LD] $@\n" ); string targetName ( module.GetTargetName () ); string target ( FixupTargetFilename ( module.GetPath () ) ); - string importLibraryDependencies = GetImportLibraryDependencies ( module ); if ( module.importLibrary != NULL ) { static string ros_junk ( "$(ROS_TEMPORARY)" ); string base_tmp = ros_junk + module.name + ".base.tmp"; + CLEAN_FILE ( base_tmp ); string junk_tmp = ros_junk + module.name + ".junk.tmp"; + CLEAN_FILE ( junk_tmp ); string temp_exp = ros_junk + module.name + ".temp.exp"; + CLEAN_FILE ( temp_exp ); + string def_file = module.GetBasePath () + SSEP + module.importLibrary->definition;
fprintf ( fMakefile, "\t%s %s -Wl,--base-file,%s -o %s %s %s %s\n", @@ -819,12 +934,12 @@ linkerParameters.c_str (), base_tmp.c_str (), junk_tmp.c_str (), - objectFilenames.c_str (), - importLibraryDependencies.c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), GetLinkerMacro ( module ).c_str () );
fprintf ( fMakefile, - "\t${rm} %s\n", + "\t-@${rm} %s\n", junk_tmp.c_str () );
string killAt = module.mangledSymbols ? "" : "--kill-at"; @@ -832,26 +947,26 @@ "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s %s\n", targetName.c_str (), base_tmp.c_str (), - ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), + def_file.c_str (), temp_exp.c_str (), killAt.c_str () );
fprintf ( fMakefile, - "\t${rm} %s\n", + "\t-@${rm} %s\n", base_tmp.c_str () );
fprintf ( fMakefile, - "\t%s %s %s -o %s %s %s %s\n\n", + "\t%s %s %s -o %s %s %s %s\n", linker.c_str (), linkerParameters.c_str (), temp_exp.c_str (), target.c_str (), - objectFilenames.c_str (), - importLibraryDependencies.c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), GetLinkerMacro ( module ).c_str () );
fprintf ( fMakefile, - "\t${rm} %s\n\n", + "\t-@${rm} %s\n", temp_exp.c_str () ); } else @@ -861,26 +976,29 @@ linker.c_str (), linkerParameters.c_str (), target.c_str (), - objectFilenames.c_str (), - importLibraryDependencies.c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), GetLinkerMacro ( module ).c_str () ); }
+ fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [RSYM] $@\n" ); fprintf ( fMakefile, - "\t${rsym} %s %s\n\n", - target.c_str (), - target.c_str () ); + "\t${rsym} %s %s\n\n", + target.c_str (), + target.c_str () ); }
void -MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, - const vector<File*>& files, - const vector<If*>& ifs, - const string& cc, - const string& cppc, - const string& cflagsMacro, - const string& nasmflagsMacro, - const string& windresflagsMacro ) const +MingwModuleHandler::GenerateObjectFileTargets ( + const Module& module, + const vector<File*>& files, + const vector<If*>& ifs, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro, + string_list& clean_files ) const { size_t i;
@@ -893,7 +1011,8 @@ cppc, cflagsMacro, nasmflagsMacro, - windresflagsMacro ); + windresflagsMacro, + clean_files ); fprintf ( fMakefile, "\n" ); } @@ -907,17 +1026,20 @@ cppc, cflagsMacro, nasmflagsMacro, - windresflagsMacro ); + windresflagsMacro, + clean_files ); } }
void -MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, - const string& cc, - const string& cppc, - const string& cflagsMacro, - const string& nasmflagsMacro, - const string& windresflagsMacro ) const +MingwModuleHandler::GenerateObjectFileTargets ( + const Module& module, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro, + string_list& clean_files ) const { GenerateObjectFileTargets ( module, module.files, @@ -926,12 +1048,13 @@ cppc, cflagsMacro, nasmflagsMacro, - windresflagsMacro ); + windresflagsMacro, + clean_files ); fprintf ( fMakefile, "\n" ); }
void -MingwModuleHandler::GetCleanTargets ( vector<string>& out, +MingwModuleHandler::GetCleanTargets ( string_list& out, const vector<File*>& files, const vector<If*>& ifs ) const { @@ -956,6 +1079,8 @@ archiveFilename.c_str (), objs_macro.c_str ());
+ fprintf ( fMakefile, "\t$(HALFVERBOSEECHO) [AR] $@\n" ); + fprintf ( fMakefile, "\t%s -rc %s %s\n\n", ar.c_str (), @@ -980,12 +1105,24 @@ }
string +MingwModuleHandler::GetLinkingDependenciesMacro ( const Module& module ) const +{ + return ssprintf ( "$(%s_LINKDEPS)", module.name.c_str () ); +} + +string +MingwModuleHandler::GetLibsMacro ( const Module& module ) const +{ + return ssprintf ( "$(%s_LIBS)", module.name.c_str () ); +} + +string MingwModuleHandler::GetLinkerMacro ( const Module& module ) const { return ssprintf ( "$(%s_LFLAGS)", module.name.c_str () ); } - + void MingwModuleHandler::GenerateMacrosAndTargets ( const Module& module, @@ -993,20 +1130,25 @@ const string& cppc, const string& ar, const string* cflags, - const string* nasmflags ) const + const string* nasmflags, + string_list& clean_files ) const { string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ()); string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ()); string windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ()); string linkerFlagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ()); string objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ()); + string libsMacro = ssprintf("%s_LIBS", module.name.c_str ()); + string linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ());
GenerateMacros ( module, cflagsMacro, nasmflagsMacro, windresflagsMacro, linkerFlagsMacro, - objectsMacro ); + objectsMacro, + libsMacro, + linkDepsMacro );
if ( cflags != NULL ) { @@ -1042,55 +1184,59 @@ cppc, cflagsMacro, nasmflagsMacro, - windresflagsMacro ); + windresflagsMacro, + clean_files );
- vector<string> clean_files; - clean_files.push_back ( FixupTargetFilename(module.GetPath()) ); - clean_files.push_back ( ar_target ); - GetCleanTargets ( clean_files, module.files, module.ifs ); - - fprintf ( fMakefile, ".PHONY: %s_clean\n", 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++ ) + CLEAN_FILE ( ar_target ); + string tgt = FixupTargetFilename(module.GetPath()); + if ( tgt != ar_target ) { - if ( 9==(i%10) ) - fprintf ( fMakefile, " 2>$(NUL)\n\t-@$(rm)" ); - fprintf ( fMakefile, " %s", clean_files[i].c_str() ); + CLEAN_FILE ( tgt ); } - fprintf ( fMakefile, " 2>$(NUL)\n" ); - fprintf ( fMakefile, "clean: %s_clean\n\n", module.name.c_str() ); }
void -MingwModuleHandler::GenerateMacrosAndTargetsHost ( const Module& module ) const +MingwModuleHandler::GenerateMacrosAndTargetsHost ( + const Module& module, + string_list& clean_files ) const { - GenerateMacrosAndTargets ( module, - "${host_gcc}", - "${host_gpp}", - "${host_ar}", - NULL, - NULL ); + GenerateMacrosAndTargets ( + module, + "${host_gcc}", + "${host_gpp}", + "${host_ar}", + NULL, + NULL, + clean_files ); }
void -MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module ) const +MingwModuleHandler::GenerateMacrosAndTargetsTarget ( + const Module& module, + string_list& clean_files ) const { - GenerateMacrosAndTargetsTarget ( module, - NULL, - NULL ); + GenerateMacrosAndTargetsTarget ( + module, + NULL, + NULL, + clean_files ); }
void -MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module, - const string* cflags, - const string* nasmflags ) const +MingwModuleHandler::GenerateMacrosAndTargetsTarget ( + const Module& module, + const string* cflags, + const string* nasmflags, + string_list& clean_files ) const [truncated at 1000 lines; 1274 more skipped]