Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

cbMakefileGen plugin

<< < (20/29) > >>

oBFusCATed:
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 "+":

--- Code: ---             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 );

--- End code ---

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:

--- Code: ---void MakeOptions(wxString& result, wxArrayString const &options)
{
    for(unsigned ii = 0; ii < options.Count(); ++ii)
        result += _(" ") + options[ii];
}

--- End code ---
and in the cbMGMakefile::formFileForTarget method:

--- Code: ---    wxString cflags, ldflags;
    MakeOptions(cflags, p_BuildTarget->GetCompilerOptions());
    MakeOptions(cflags, l_pCompiler->GetCompilerOptions());

    MakeOptions(ldflags, p_BuildTarget->GetLinkerOptions());
    MakeOptions(ldflags, l_pCompiler->GetLinkerOptions());

--- End code ---

Best regards,
Teodor Petrov

[attachment deleted by admin]

kisoft:

--- Quote from: oBFusCATed on May 09, 2008, 12:10:25 am ---1. This is the main fix:
In the method: cbMGMakefile::formFileForTarget, I have replaced the row starting with "-", with the one starting with "+":

--- Code: ---             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 );

--- End code ---


--- End quote ---

Seen like a bug. I fetch this patch.


--- Quote from: oBFusCATed on May 09, 2008, 12:10:25 am ---2. Changed the project file to put the cbMakeGen.zip and libcbMakeGen.so in ~/.codeblocks/share/codeblocks/, not in the previous ../../../devel/ala-bala

--- End quote ---

Ok.


--- Quote from: oBFusCATed on May 09, 2008, 12:10:25 am ---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)

--- End quote ---

I rename $proj_name$ to $(proj_title). Ok.


--- Quote from: oBFusCATed on May 09, 2008, 12:10:25 am ---4. Added mkdir -p command before the compile/link command. (My gcc doesn't create the folders for the object/result files)

--- End quote ---

I can't check it now. I will check it later.


--- Quote from: oBFusCATed on May 09, 2008, 12:10:25 am ---*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.

--- End quote ---

I can't check it now. I will check it later.


--- Quote from: oBFusCATed on May 09, 2008, 12:10:25 am ---I know the patch is very raw and not 100% correct but it works. Any testing and opinions is appreciated.

--- End quote ---

Thanks you for patch! Great work!


--- Quote from: oBFusCATed on May 09, 2008, 12:10:25 am ---***** Can some C::B dev explain the correct way to get the full compiler/linker options?

--- End quote ---

I being used Compiler::GenerateCommandLine for get full command line. I can't found another way.

Patch file I does download. Some fixes I apply, another I will see later.

Source repository I do will update later.

Thanks and good luck!

kisoft:
Big Thanks to pasgui for binaries & sdk for codeblocks for Linux x86-64. I install codeblocks on my KUbuntu64 7.10 now.

cbMakefeilGen binaries (cbMakefeilGen-0.3.cbplugin) for Linux x86-64 available now on BerliOS (see URL in my sign).

This binaries is my first binaries on Linux. Sorry if what wrong.

Big thanks for bugreports! I test this plugin on my KUbuntu64 7.10 only.

Info: You can subscribe to mail list "Cbmakegen-news" for get an email news about my plugin.

Good luck!

kisoft:
Source repository updated. v0.3.12.2

# Changes into setup dialog:
  + Added $(prog_title) macro for filename and changes in unix.cbp file (thanks oBFusCATed)
     for example you can set filename for Makefile to: Makefile.$(prog_title)
     it was changed to Makefile.cbMakefileGen (for my plugin project)
# Added AnnoyingDialog for check Dependencies function

This repository was used for build Linux x86-64 binaries.

Later I will update Windows version too.

Good luck!

JGM:
great news !  :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version