Author Topic: cbMakefileGen plugin  (Read 152466 times)

locky

  • Guest
Re: cbMakefileGen plugin
« Reply #90 on: March 30, 2008, 05:19:24 pm »
I'm trying to compile cbMakefileGen under Linux using codeblocks_8.02-0ubuntu1.deb and last cbMakefileGen svn but I get this  error :

Code
/tmp/branches/alltargets/Makefile.hpp:60: error: «Compiler" has not been declared
/tmp/branches/alltargets/Makefile.hpp:61: error: «Compiler" has not been declared
/tmp/branches/alltargets/Makefile.cpp:82: error: prototype for «bool cbMGMakefile::reLoadDependecies(const wxString&, ProjectBuildTarget*, Compiler*)" does not match any in class «cbMGMakefile"
/tmp/branches/alltargets/Makefile.hpp:61: error: candidate is: bool cbMGMakefile::reLoadDependecies(const wxString&, ProjectBuildTarget*, int*)
/tmp/branches/alltargets/Makefile.cpp:171: error: prototype for «bool cbMGMakefile::getDependencies(ProjectBuildTarget*, Compiler*)" does not match any in class «cbMGMakefile"
/tmp/branches/alltargets/Makefile.hpp:60: error: candidate is: bool cbMGMakefile::getDependencies(ProjectBuildTarget*, int*)
/tmp/branches/alltargets/version.h:7: warning : «AutoVersion::DATE" defined but not used
/tmp/branches/alltargets/version.h:8: warning : «AutoVersion::MONTH" defined but not used
/tmp/branches/alltargets/version.h:9: warning : «AutoVersion::YEAR" defined but not used
/tmp/branches/alltargets/version.h:10: warning : «AutoVersion::UBUNTU_VERSION_STYLE" defined but not used
/tmp/branches/alltargets/version.h:13: warning : «AutoVersion::STATUS" defined but not used
/tmp/branches/alltargets/version.h:14: warning : «AutoVersion::STATUS_SHORT" defined but not used
/tmp/branches/alltargets/version.h:23: warning : «AutoVersion::BUILDS_COUNT" defined but not used
/tmp/branches/alltargets/version.h:26: warning : «AutoVersion::FULLVERSION_STRING" defined but not used
/tmp/branches/alltargets/version.h:29: warning : «AutoVersion::SVN_REVISION" defined but not used
/tmp/branches/alltargets/version.h:30: warning : «AutoVersion::SVN_DATE" defined but not used


Any tips ?

P.S = I have installed codeblocks-dev_8.02-0ubuntu1_i386.deb and libwxsmithlib0-dev_8.02-0ubuntu1_i386.deb

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: cbMakefileGen plugin
« Reply #91 on: March 30, 2008, 07:44:34 pm »
Try this patch, I had similar issue under windows on NON PCH build.

Tim S

Code
Index: Makefile.hpp
===================================================================
--- Makefile.hpp (revision 20)
+++ Makefile.hpp (working copy)
@@ -7,6 +7,7 @@
 #include "Variable.hpp"
 
 class cbProject;
+class Compiler;
 
 #include <wx/arrimpl.cpp>
 
« Last Edit: March 30, 2008, 07:46:20 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #92 on: March 31, 2008, 09:32:11 am »
stahta01 Thanks for patch. I apply this patch and commit Makefile.hpp to repository HEAD.
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

d-_-b

  • Guest
Re: cbMakefileGen plugin
« Reply #93 on: April 24, 2008, 06:01:42 pm »
First off, Thanks for the plugin. After getting it running on ubuntu 7.10 with Code::Blocks 8.02 it created my make file with ease. But I needed to do the following to get it working:

- Create a new "Code::Blocks plugin" project for wxWidgets 2.8
- Fetched the code from the cbMakeGen SVN repository
- Added the cbMakeGen files recursively to my new project
- In "Project build options" I selected "default" and "other options" and changed "`wx-config --cflags`" to "`wx-config --cxxflags`"
- Build and it worked.

I could install the plugin but when I restarted Code::Blocks it gave me a error "could not find cbmakegen.zip" but the "Generate Makefile" menu option is under "Projects" and it works.

I hope this helps someone trying to get cbMakeGen running on linux, like it helped me.

Regards,

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #94 on: April 25, 2008, 08:37:47 am »
After check out sources of cbMakefileGen project (I put it to C:\Devel\CodeBlocks\src\plugins\contrib\cbmakegen on Windows), you can see file: cbmakegen-unix.cbp. You can open this file into CodeBlocks and rebuid plugin.
Another way, do add extra commands after compile, into .cbp file you can see this code:
Code
   				<ExtraCommands>
<Add after="zip -j9 ../../../devel/share/codeblocks/cbMakefileGen.zip manifest.xml" />
    <Mode after="always" />
</ExtraCommands>
Good luck!
« Last Edit: April 25, 2008, 08:41:12 am by kisoft »
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: cbMakefileGen plugin
« Reply #95 on: May 09, 2008, 12:10:25 am »
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 );

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];
}
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());

Best regards,
Teodor Petrov

[attachment deleted by admin]
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #96 on: May 12, 2008, 12:38:37 pm »
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 );


Seen like a bug. I fetch this patch.

2. Changed the project file to put the cbMakeGen.zip and libcbMakeGen.so in ~/.codeblocks/share/codeblocks/, not in the previous ../../../devel/ala-bala

Ok.

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)

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

4. Added mkdir -p command before the compile/link command. (My gcc doesn't create the folders for the object/result files)

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

*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 can't check it now. I will check it later.

I know the patch is very raw and not 100% correct but it works. Any testing and opinions is appreciated.

Thanks you for patch! Great work!

***** Can some C::B dev explain the correct way to get the full compiler/linker options?

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!
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #97 on: June 04, 2008, 10:37:52 am »
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!
« Last Edit: June 04, 2008, 12:20:50 pm by kisoft »
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #98 on: June 04, 2008, 05:17:13 pm »
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!
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline JGM

  • Lives here!
  • ****
  • Posts: 518
  • Got to practice :)
Re: cbMakefileGen plugin
« Reply #99 on: June 04, 2008, 10:23:00 pm »
great news !  :D

Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: cbMakefileGen plugin
« Reply #100 on: June 22, 2008, 12:31:48 am »
Hi kisoft
Your plugin is just great, but here is a simple, nasty bug to it: you mistook prerequisite syntax for standard string syntax.
Prerequisites needn't be quoted, because the method to escape whitespace in them is a backlash, not quotes (either simple or double) as in shell string syntax. So for instance:

foo.o: "/path/to/my sofware sources/bar.c"
    commands

yields a crash, and same thing with simple quotes.
You should patch your app to get this instead:

TARGET: path/to/my\ sofware\ sources/bar.c
   commands

a good way to avoid the headache is just to use advanced make syntax (notably string filter functions).

Another hint/request: it would be great to implement the "dependency" feature in your plugin, so that when I compile a project that depends on a library compiled by another project, this lib gets compiled first. This could be done by translating .workspace CB files into make syntax, I think.

Good luck with your work.

PS: attached is a patched Makefile, for a concrete example


[attachment deleted by admin]

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #101 on: June 23, 2008, 08:19:53 am »
Thank you for bugreport. I will see for convert filenames to normal form.

Source repository updated. Binaries was updated too (Win32, Dapper x86_64).

v 3.12.3
+ unix.cbp added cb_sdk variable to project file
+ add function ConvertToMakefileFriendly (copyright by mandrav)
# filenames with spaces converted to makefele friendly form (thanks to libfab)

No fullfunctional testing was executed! Simpy testing only on WinXPSP2 & Ubuntu 6.06 x86_64.

Good luck!
« Last Edit: June 23, 2008, 12:56:09 pm by kisoft »
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: cbMakefileGen plugin
« Reply #102 on: June 23, 2008, 11:58:32 pm »
Another suggestion/request: your makefile presumes the build tree is there to be found, unlike CB's standard build system, which builds ./obj/Release/src and ./bin/Release if required.
I would suggest that you should tweak your code so that the Makefile output has one more do: TARGET like this:

##====================

do:   
   @if test ! -d ./obj ; \
   then\
       echo "Making directory ./obj";\
       mkdir ./obj;\
   else\
       echo "Nothing to be done for directory ./obj";\
   fi;\
   if test ! -d ./obj/Release ; \
   then\
       echo "Making directory ./obj/Release";\
       mkdir ./obj/Release;\
   else\
       echo "Nothing to be done for directory ./obj/Release";\
   fi;\
   if test ! -d ./obj/Release/src/ ; \
   then\
       echo "Making directory ./obj/Release/src";\
       mkdir ./obj/Release/src/;\
   else\
       echo "Nothing to be done for directory ./obj/Release/src";\
   fi;\
   if test ! -d ./bin ; \
   then\
       echo "Making directory ./bin";\
       mkdir ./bin;\
   else\
       echo "Nothing to be done for directory ./bin";\
   fi;\
   if test ! -d ./bin/Release ; \
   then\
       echo "Making directory ./bin/Release";\
       mkdir ./bin/Release;\
   else\
       echo "Nothing to be done for directory ./bin/Release";\
   fi
## ============================

and you should prepend the prerequisites of the Release target with do like this:

## ============================

Release: do bin/Release/(name of program)

## ============================

This shell patch was tested to work fine. I don't have time to make a c++ patch right now but it should be fairly easy I think.

Best, Fab

PS: You'll find the whole patched Makefile.gen attached
   


[attachment deleted by admin]
« Last Edit: June 24, 2008, 12:06:57 am by libfab »

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #103 on: June 24, 2008, 08:36:40 am »
You right, I can copy this block from makefilegenerator.cpp (author mandrav). hmm..
I can do this later, I have a lot work now.

Can you test a last changes? How work?

Good luck!
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: cbMakefileGen plugin
« Reply #104 on: June 24, 2008, 01:29:48 pm »
Your latest svn release to date works fine. I just have two suggestions (see my messages above), one about dependency-tracking and one about building trees.
Best, Fab