Author: cwittich Date: Tue Nov 28 22:40:03 2006 New Revision: 24933
URL: http://svn.reactos.org/svn/reactos?rev=24933&view=rev Log: -fix some linking issues -generate import libraries
Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/codebl... ============================================================================== --- trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp (original) +++ trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp Tue Nov 28 22:40:03 2006 @@ -417,7 +417,7 @@ const vector<Library*>& libs = data.libraries; for ( i = 0; i < libs.size(); i++ ) { - string libpath = outdir + "\" + libs[i]->importedModule->GetBasePath(); + string libpath = intdir + "\" + libs[i]->importedModule->GetBasePath(); libraries.push_back ( libs[i]->name ); libpaths.push_back ( libpath ); } @@ -482,12 +482,18 @@
if ( configuration.UseConfigurationInPath ) { - fprintf ( OUT, "\t\t\t\t<Option output="%s\%s%s\%s%s" prefix_auto="0" extension_auto="0" />\r\n", outdir.c_str (), module.GetBasePath ().c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str()); + if ( module.type == StaticLibrary ) + fprintf ( OUT, "\t\t\t\t<Option output="%s\%s%s\%s%s" prefix_auto="0" extension_auto="0" />\r\n", intdir.c_str (), module.GetBasePath ().c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str()); + else + fprintf ( OUT, "\t\t\t\t<Option output="%s\%s%s\%s%s" prefix_auto="0" extension_auto="0" />\r\n", outdir.c_str (), module.GetBasePath ().c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str()); fprintf ( OUT, "\t\t\t\t<Option object_output="%s\%s%s" />\r\n", intdir.c_str(), module.GetBasePath ().c_str (), cfg.name.c_str() ); } else { - fprintf ( OUT, "\t\t\t\t<Option output="%s\%s\%s%s" prefix_auto="0" extension_auto="0" />\r\n", outdir.c_str (), module.GetBasePath ().c_str (), module.name.c_str(), module_type.c_str() ); + if ( module.type == StaticLibrary ) + fprintf ( OUT, "\t\t\t\t<Option output="%s\%s\%s%s" prefix_auto="0" extension_auto="0" />\r\n", intdir.c_str (), module.GetBasePath ().c_str (), module.name.c_str(), module_type.c_str() ); + else + fprintf ( OUT, "\t\t\t\t<Option output="%s\%s\%s%s" prefix_auto="0" extension_auto="0" />\r\n", outdir.c_str (), module.GetBasePath ().c_str (), module.name.c_str(), module_type.c_str() ); fprintf ( OUT, "\t\t\t\t<Option object_output="%s\%s" />\r\n", intdir.c_str(), module.GetBasePath ().c_str () ); }
@@ -562,7 +568,7 @@ { fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--entry,%s%s" />\r\n", "_", module.GetEntryPoint(false) == "" ? "DriverEntry@8" : module.GetEntryPoint(false).c_str ()); fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--image-base,%s" />\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str () ); - fprintf ( OUT, "\t\t\t\t\t<Add option="-nostartfiles -nostdlib" />\r\n" ); + fprintf ( OUT, "\t\t\t\t\t<Add option="-nostartfiles -Wl,--nostdlib" />\r\n" ); } else if ( exe ) { @@ -575,18 +581,28 @@ { fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--entry,_NtProcessStartup@4" />\r\n" ); fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--image-base,%s" />\r\n", baseaddr.c_str () ); - fprintf ( OUT, "\t\t\t\t\t<Add option="-nostartfiles -nostdlib" />\r\n" ); + fprintf ( OUT, "\t\t\t\t\t<Add option="-nostartfiles -Wl,--nostdlib" />\r\n" ); } else { - fprintf ( OUT, "\t\t\t\t\t<Add option="%s" />\r\n", module.useHostStdlib ? "-nostartfiles -lgcc" : "-nostartfiles -nostdlib -lgcc" ); + fprintf ( OUT, "\t\t\t\t\t<Add option="%s" />\r\n", module.useHostStdlib ? "-nostartfiles" : "-nostartfiles -Wl,--nostdlib" ); + fprintf ( OUT, "\t\t\t\t\t<Add library="gcc" />\r\n" ); } } else if ( dll ) { fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--entry,%s%s" />\r\n", "_", module.GetEntryPoint(false).c_str () ); fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--image-base,%s" />\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str () ); - fprintf ( OUT, "\t\t\t\t\t<Add option="%s" />\r\n", module.useHostStdlib ? "-nostartfiles -lgcc" : "-nostartfiles -nostdlib -lgcc" ); + + if ( module.type == Win32DLL ) + fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--shared" />\r\n" ); + else if ( module.type == NativeDLL) + fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--shared" />\r\n" ); + else if ( module.type == NativeDLL) + fprintf ( OUT, "\t\t\t\t\t<Add option="-nostartfiles -Wl,--shared" />\r\n" ); + + fprintf ( OUT, "\t\t\t\t\t<Add option="%s" />\r\n", module.useHostStdlib ? "-nostartfiles" : "-nostartfiles -Wl,--nostdlib" ); + fprintf ( OUT, "\t\t\t\t\t<Add library="gcc" />\r\n" ); }
fprintf ( OUT, "\t\t\t\t\t<Add option="-Wl,--file-alignment,0x1000" />\r\n" ); @@ -611,12 +627,16 @@ fprintf ( OUT, "\t\t\t\t<ExtraCommands>\r\n" );
if ( module.type == StaticLibrary && module.importLibrary ) - fprintf ( OUT, "\t\t\t\t\t<Add after="dlltool --dllname %s --def %s --output-lib "$(TARGET_OUTPUT_DIR)lib$(TARGET_OUTPUT_BASENAME).a" %s -U" />\r\n", module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" ); + fprintf ( OUT, "\t\t\t\t\t<Add after="dlltool --dllname %s --def %s --output-lib $exe_output; %s -U" />\r\n", module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" ); + else if ( module.importLibrary != NULL ) + fprintf ( OUT, "\t\t\t\t\t<Add after="dlltool --dllname %s --def %s --output-lib "%s\%s\lib$(TARGET_OUTPUT_BASENAME).a" %s" />\r\n", module.GetTargetName ().c_str(), module.importLibrary->definition.c_str(), intdir.c_str(), module.GetBasePath().c_str(), module.mangledSymbols ? "" : "--kill-at" ); + //fprintf ( OUT, "\t\t\t\t\t<Add after="dlltool --dllname %s --def %s --output-lib "$(TARGET_OBJECT_DIR)lib$(TARGET_OUTPUT_BASENAME).a" %s" />\r\n", module.GetTargetName ().c_str(), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" );
if ( dll ) { - fprintf ( OUT, "\t\t\t\t\t<Add before="dlltool --dllname %s --def %s --output-exp %s.temp.exp %s" />\r\n", module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(), module.name.c_str(), module.mangledSymbols ? "" : "--kill-at" ); + fprintf ( OUT, "\t\t\t\t\t<Add before="dlltool --dllname %s --def %s --output-exp %s.temp.exp %s" />\r\n", module.GetTargetName ().c_str(), module.importLibrary->definition.c_str(), module.name.c_str(), module.mangledSymbols ? "" : "--kill-at" ); + fprintf ( OUT, "\t\t\t\t\t<Add after="%s\tools\pefixup $exe_output -exports" />\r\n", outdir.c_str() ); #ifdef WIN32 fprintf ( OUT, "\t\t\t\t\t<Add after="cmd /c del %s.temp.exp 2>NUL" />\r\n", module.name.c_str() ); #else