Hello,
I have made some modifications to this plugin, to make it work on my linux projects.
I have also added some enhancements to it.
I have attached the patch file against rev 21.
Here is the list of changes:
1. This is the main fix:
In the method: cbMGMakefile::formFileForTarget, I have replaced the row starting with "-", with the one starting with "+":
Manager::Get()->GetLogManager()->DebugLog(wxString::Format( _("LinkerCmd: %s"), l_LinkerCmd.c_str()) );
l_pCompiler->GenerateCommandLine( l_LinkerCmd,
p_BuildTarget,
NULL,
l_OutFileName.GetFullPath(),
- _T("$$(") + l_TargetName + _T(")"),
+ _T("$$(") + l_ObjsName + _T(")"),
wxEmptyString,
wxEmptyString );
2. Changed the project file to put the cbMakeGen.zip and libcbMakeGen.so in ~/.codeblocks/share/codeblocks/, not in the previous ../../../devel/ala-bala
3. Added feature to replace the "$proj_name$" substring in the Makefile name in the options with the name of the project (example: project TestProj (option = Makefile.$proj_name$), result makefile: Makefile.TestPRoj)
4. Added mkdir -p command before the compile/link command. (My gcc doesn't create the folders for the object/result files)
*5. Added CFLAGS and LDFLAGS variables to the makefile. The values of this variables contain the non expanded options set by the user (for example: `pkg-config --cflags some_lib`). This way the makefile can be used on different machine with different distro/unix installed.
I know the patch is very raw and not 100% correct but it works. Any testing and opinions is appreciated.
***** Can some C::B dev explain the correct way to get the full compiler/linker options?
For the moment I use the following code:
void MakeOptions(wxString& result, wxArrayString const &options)
{
for(unsigned ii = 0; ii < options.Count(); ++ii)
result += _(" ") + options[ii];
}
and in the cbMGMakefile::formFileForTarget method:
wxString cflags, ldflags;
MakeOptions(cflags, p_BuildTarget->GetCompilerOptions());
MakeOptions(cflags, l_pCompiler->GetCompilerOptions());
MakeOptions(ldflags, p_BuildTarget->GetLinkerOptions());
MakeOptions(ldflags, l_pCompiler->GetLinkerOptions());
Best regards,
Teodor Petrov
[attachment deleted by admin]