Author Topic: cbMakefileGen plugin  (Read 106366 times)

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
cbMakefileGen plugin
« on: June 22, 2007, 10:17:13 am »
cbMakefileGen plugin - is a very simple makefile generator.
Features:
 - Generate a simple makefile for current project and an active target
 - Configuration options:
   - Filename of Makefile
   - Overwrite if exists (checkbox) (Use it with care!)
   - Add '@' prefix for commands (checkbox)

ToDo list:
 - Add dependents for each source
 - Add dependents for project
 - Add all targets to Makefile

Sources and Makefile.am, cbmakegen.cbp, cbmakegen-unix.cbp, manifest.xml included.
I build this plugin in $(#cb)/plugins/contrib/cbmakegen directory.
I build and check this plugin for WinXP SP2 and Ubuntu 6.10 only.

cbMakefileGen plugin - is my first plugin for CodeBlocks then you must being used a generated Makefile with care.
When this plugin is new then may content a few bugs.
If you need this plugin and can test it, a lot thanks for you bug reports and suggestions.

Generated file example:

# A simple makefile generator by KiSoft, 2007. mailto: kisoft@rambler.ru

# Project Variables start
CPP=mingw32-g++.exe
CC=mingw32-gcc.exe
LD=mingw32-g++.exe
LIB=ar.exe
WINDRES=windres.exe
OBJS=..\..\..\.objs\plugins\contrib\cbmakegen\Rule.o ..\..\..\.objs\plugins\contrib\cbmakegen\Makefile.o ..\..\..\.objs\plugins\contrib\cbmakegen\cbMakefileGen.o ..\..\..\.objs\plugins\contrib\cbmakegen\cbmakefilecfg.o ..\..\..\.objs\plugins\contrib\cbmakegen\Variable.o
# Project Variables end

all: ..\..\..\devel\share\CodeBlocks\plugins\cbMakefileGen.dll commandsafterbuild

.PHONY: commandsafterbuild

commandsafterbuild:
   @zip -j9 ..\..\..\devel\share\CodeBlocks\cbMakefileGen.zip manifest.xml

..\..\..\devel\share\CodeBlocks\plugins\cbMakefileGen.dll: $(OBJS)
   @echo Building dynamic library ..\..\..\devel\share\CodeBlocks\plugins\cbMakefileGen.dll
   @mingw32-g++.exe -shared   -Wl,--dll -LC:\Devel\codeblocks\src\devel -LC:\Devel\wxWidgets-2.8.4\lib\gcc_dll -LC:\MinGW\lib  $(OBJS)  -o ..\..\..\devel\share\CodeBlocks\plugins\cbMakefileGen.dll -s  -lcodeblocks -lwxmsw28u

..\..\..\.objs\plugins\contrib\cbmakegen\Rule.o: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Rule.cpp
   @echo Compiling: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Rule.cpp
   @mingw32-g++.exe -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DTIXML_USE_STL -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DcbDEBUG  -IC:\Devel\codeblocks\src\include -IC:\Devel\codeblocks\src\include\wxscintilla\include -IC:\Devel\wxWidgets-2.8.4\include -IC:\Devel\wxWidgets-2.8.4\lib\gcc_dll\mswu -IC:\MinGW\include  -c C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Rule.cpp -o ..\..\..\.objs\plugins\contrib\cbmakegen\Rule.o

..\..\..\.objs\plugins\contrib\cbmakegen\Makefile.o: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Makefile.cpp
   @echo Compiling: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Makefile.cpp
   @mingw32-g++.exe -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DTIXML_USE_STL -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DcbDEBUG  -IC:\Devel\codeblocks\src\include -IC:\Devel\codeblocks\src\include\wxscintilla\include -IC:\Devel\wxWidgets-2.8.4\include -IC:\Devel\wxWidgets-2.8.4\lib\gcc_dll\mswu -IC:\MinGW\include  -c C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Makefile.cpp -o ..\..\..\.objs\plugins\contrib\cbmakegen\Makefile.o

..\..\..\.objs\plugins\contrib\cbmakegen\cbMakefileGen.o: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\cbMakefileGen.cpp
   @echo Compiling: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\cbMakefileGen.cpp
   @mingw32-g++.exe -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DTIXML_USE_STL -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DcbDEBUG  -IC:\Devel\codeblocks\src\include -IC:\Devel\codeblocks\src\include\wxscintilla\include -IC:\Devel\wxWidgets-2.8.4\include -IC:\Devel\wxWidgets-2.8.4\lib\gcc_dll\mswu -IC:\MinGW\include  -c C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\cbMakefileGen.cpp -o ..\..\..\.objs\plugins\contrib\cbmakegen\cbMakefileGen.o

..\..\..\.objs\plugins\contrib\cbmakegen\cbmakefilecfg.o: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\cbmakefilecfg.cpp
   @echo Compiling: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\cbmakefilecfg.cpp
   @mingw32-g++.exe -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DTIXML_USE_STL -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DcbDEBUG  -IC:\Devel\codeblocks\src\include -IC:\Devel\codeblocks\src\include\wxscintilla\include -IC:\Devel\wxWidgets-2.8.4\include -IC:\Devel\wxWidgets-2.8.4\lib\gcc_dll\mswu -IC:\MinGW\include  -c C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\cbmakefilecfg.cpp -o ..\..\..\.objs\plugins\contrib\cbmakegen\cbmakefilecfg.o

..\..\..\.objs\plugins\contrib\cbmakegen\Variable.o: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Variable.cpp
   @echo Compiling: C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Variable.cpp
   @mingw32-g++.exe -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DBUILDING_PLUGIN -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DTIXML_USE_STL -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DcbDEBUG  -IC:\Devel\codeblocks\src\include -IC:\Devel\codeblocks\src\include\wxscintilla\include -IC:\Devel\wxWidgets-2.8.4\include -IC:\Devel\wxWidgets-2.8.4\lib\gcc_dll\mswu -IC:\MinGW\include  -c C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Variable.cpp -o ..\..\..\.objs\plugins\contrib\cbmakegen\Variable.o

.PHONY: clean

clean:
   @echo Delete $(OBJS) ..\..\..\devel\share\CodeBlocks\plugins\cbMakefileGen.dll
   @del /f $(OBJS) ..\..\..\devel\share\CodeBlocks\plugins\cbMakefileGen.dll


Good luck for All!


[attachment deleted by admin]
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: cbMakefileGen plugin
« Reply #1 on: June 22, 2007, 11:02:39 am »
I haven't looked at this yet but thanks kisoft. I guess some people will be very happy with this ;).

(I was planning for something like this (for later though) but I would write a script, not a binary plugin.)
Be patient!
This bug will be fixed soon...

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #2 on: June 22, 2007, 11:21:00 am »
I haven't looked at this yet but thanks kisoft. I guess some people will be very happy with this ;).

(I was planning for something like this (for later though) but I would write a script, not a binary plugin.)
Some about script. When plugin is claim then it would do progress. Then this work (discussion) can help later for a script realization.
There is time for everything.
Good luck!
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: cbMakefileGen plugin
« Reply #3 on: July 11, 2007, 01:50:57 pm »
hi kisoft

I think such a plugin is really wanted here. I would love to use it. But you didnt provide an executable and I can't compile your project  :(
But I really need a written Makefile!!

Please help us...

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #4 on: July 11, 2007, 02:24:59 pm »
I think such a plugin is really wanted here. I would love to use it. But you didnt provide an executable and I can't compile your project  :(
I can create cbMakefileGen.plugin for Win (WinXP SP2 for me, see attached file), but I don't know how create this plugin for *nix (I have installed Ubuntu 6.10 now, but I being compiled this plugin with contrib plugins).


[attachment deleted by admin]
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: cbMakefileGen plugin
« Reply #5 on: July 11, 2007, 03:03:10 pm »
A Windows exe would be great, my target productive system is Solaris10 via tty. But Windows is my dev platform, so writing a portable Makefile will be much easier with your plugin. I'm thinking of using boost.jam or Premake to streamline Makefile construction.

Do you know if CB (under Windows) does optimize the order of the link libraries itself? This would be very helpfull indeed.

Just tried to add the binary from you into CB Ver.4256 and it fails saying that: your plugin was built for a different version of the CB::SDK  :(
« Last Edit: July 11, 2007, 03:08:40 pm by patlecat »

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #6 on: July 11, 2007, 04:01:04 pm »
I'm thinking of using boost.jam or Premake to streamline Makefile construction.

I taste Premake only. But it was a many times ago. For start is very nice.

Do you know if CB (under Windows) does optimize the order of the link libraries itself? This would be very helpfull indeed.

Sorry, I have no info for this. My be I don't understand your mind. "optimize order of link" - I can't understand for what.

Just tried to add the binary from you into CB Ver.4256 and it fails saying that: your plugin was built for a different version of the CB::SDK  :(
My C::B rev.4257, wxWidgets 2.8.4. Was compiled today 9 hours ago.
Hmm, I found for all plugins in manifest.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
    <SdkVersion major="1" minor="10" release="0" />

but my mainfest.xml file content this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
    <SdkVersion major="1" minor="11"  release="11" />

Try new attached file, please.
I being investigate this trouble tomorrow.


[attachment deleted by admin]
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: cbMakefileGen plugin
« Reply #7 on: July 11, 2007, 04:12:45 pm »
The order/sequence in which the needed libraries are linked to your program is important under *nix. And Premake can optimize that oder in case it isn't optimal. But does CB do that on Windows too?

Ok I tried ur new binary but it got me the exact same results  :? I attach the resulting DLL here, maybe this can help you find the problem.

Thanks again for your kind help  :P

[attachment deleted by admin]

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #8 on: July 13, 2007, 08:26:47 am »
Sorry for a long pause.
I do compiled my plugin again. I do clean all .objs directories and devel/devel too. Recompiled C::B and all contrib plugins with my plugin too. I attach new file now. Try it or wait for my experiments. I want download a lastest night build C::B and try install my plugin.
I try it and get a good result on Nightbuild rev 4261.


[attachment deleted by admin]
« Last Edit: July 13, 2007, 08:34:20 am by kisoft »
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: cbMakefileGen plugin
« Reply #9 on: July 17, 2007, 10:12:06 am »
No problem man, but your plugin still produces the exact same error :( And I've tried it both in the office and home.

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #10 on: July 17, 2007, 11:04:22 am »
No problem man, but your plugin still produces the exact same error :( And I've tried it both in the office and home.
I was found a reason. I being used wxmsw28u_gcc_custom.dll instead of wxmsw28u_gcc_cb.dll.
Anyway, I being recompile my project now and send this here after test on nightbuild C::B rev.4261.
Yeah, see this topic http://forums.codeblocks.org/index.php/topic,6450.0.html, may be "cmake" more usable for you

New .cbplugin attached now. Being normally installed on Nightbuilds C::B rev.4261.


[attachment deleted by admin]
« Last Edit: July 17, 2007, 12:40:21 pm by kisoft »
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: cbMakefileGen plugin
« Reply #11 on: July 18, 2007, 10:15:56 am »
Finally you made it man. You're the man man! :D
It works and looks fine, thank you. I'm using Premake now but for certain details I'm happy to see now how CB does it internally.

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #12 on: July 18, 2007, 11:38:34 am »
Finally you made it man. You're the man man! :D
It works and looks fine, thank you. I'm using Premake now but for certain details I'm happy to see now how CB does it internally.
Thank you! Your feedback being help me. :!:
Good luck!
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline kingfox

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: cbMakefileGen plugin
« Reply #13 on: July 22, 2007, 04:51:05 pm »
Thank you Kisoft ! It's a very nice plugin. :D

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: cbMakefileGen plugin
« Reply #14 on: July 27, 2007, 08:46:01 am »
Thank you Kisoft ! It's a very nice plugin. :D
Thank you.
I have no time now for update my plugin. But work is not stopped and to be continued later.
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen