Patches welcomed of course. But I have a local repository only. I am ready create global repository if required.
License: GPL. Open source.
I think it would help if you uploaded the zip file to a site to download from instead using a attachment in this thread.
Or, it would be better if you did an SVN or CVS repository, but I think for now just a file download would be enough.
I myself use http://www.savefile.com to share files, but they is many other free sites.
Tim S
Simple patch to add Virtual "All" Target
diff --unified=3 --recursive --ignore-file-name-case --ignore-space-change --ignore-blank-lines --exclude='*.bak' cbmakegen.orig/cbmakegen.cbp cbmakegen/cbmakegen.cbp
--- cbmakegen.orig/cbmakegen.cbp 2007-06-22 11:11:48.000000000 -0400
+++ cbmakegen/cbmakegen.cbp 2007-08-01 20:50:44.890625000 -0400
@@ -46,6 +46,9 @@
</ExtraCommands>
</Target>
</Build>
+ <VirtualTargets>
+ <Add alias="All" targets="default;" />
+ </VirtualTargets>
<Unit filename="Makefile.cpp">
<Option weight="30" />
</Unit>
FYI:
I had to remove the path C:\utility\7-Zip\
Tim S
Index: cbmakegen.cbp
===================================================================
--- cbmakegen.cbp (revision 1)
+++ cbmakegen.cbp (working copy)
@@ -83,7 +83,7 @@
<ExtraCommands>
<Add after="zip -j9 ..\..\..\devel\share\CodeBlocks\cbMakefileGen.zip manifest.xml" />
<Add after="zip -j9 cbMakefileGen.cbplugin ..\..\..\devel\share\CodeBlocks\cbMakefileGen.zip ..\..\..\devel\share\CodeBlocks\plugins\cbMakefileGen.dll" />
- <Add after="C:\utility\7-Zip\7z.exe a cbMakefileGen.7z cbMakefileGen.cbplugin" />
+ <Add after="7z.exe a cbMakefileGen.7z cbMakefileGen.cbplugin" />
<Mode after="always" />
</ExtraCommands>
</Target>
The easiest way to find dependencies is to let g++ to tell you what are they by using -MT, -MD & -MM flags.
For example, lets say you have a project with 2 files, test.cpp and main.cpp, and they both link into an executable, so the makefile
that can handle dependencies is something like this:
Objects=Debug\test.o Debug\main.o
IncludePath=-I.
TestExec: $(Objects)
g++ -o TestExec $(Objects)
Debug\test.o: test.cpp Debug\test.o.d
g++ -c test.cpp -g -o Debug\test.o $(IncludePath)
Debug\test.o.d:
@g++ -g $(IncludePath) -MTDebug\test.o -MFDebug\test.o.d -MM test.cpp
Debug\main.o: main.cpp Debug\main.o.d
g++ -c main.cpp -g -o Debug\main.o $(IncludePath)
Debug\main.o.d:
@g++ -g $(IncludePath) -MTDebug\main.o -MFDebug\main.o.d -MM main.cpp
clean:
-if exist Debug\test.o del Debug\test.o
-if exist Debug\test.o.d del Debug\test.o.d
-if exist Debug\main.o del Debug\main.o
-if exist Debug\main.o.d del Debug\main.o.d
-if exist $(OutputFile) del $(OutputFile)
-if exist $(OutputFile).exe del $(OutputFile).exe
-include Debug/*.d
Note that for every object, I am adding another dependencie: <object_name>.d, for example:
Debug\test.o: test.cpp Debug\test.o.d
Now, the rule for 'Debug\test.o.d', is:
Debug\test.o.d:
@g++ -g $(IncludePath) -MTDebug\test.o -MFDebug\test.o.d -MM test.cpp
which invokes g++ preprocessor to create it. Open the .d file (it is a text file), and you will see there a single makefile rule generated by g++ for Debug\test.o, which includes all the dependencies required for test.o (I used here MM to omit system dependencies, such as stdio.h etc)
By chagning any of the file that test.cpp is including, the makefile will recompile it.
HTH,
Eran
*
* I does realized alpha version for Win32 with dependencies.
*
Sources saved into cbmakegen/branches/dependencies svn repository on BerliOS (trunk has old release 0.1 now).
You can found binary for Win32 only on my project page on BerliOS (project URL see below).
No configs changed now.
Russian cbmakegen.mo included too.
For example, piece of makefile.gen:
..\..\..\.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
C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Rule.cpp: Rule.hpp
C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Makefile.cpp: Makefile.hpp
C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Makefile.hpp: Rule.hpp Variable.hpp
C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\cbmakefilecfg.cpp: cbmakefilecfg.h
C:\Devel\codeblocks\src\plugins\contrib\cbmakegen\Variable.cpp: Variable.hpp
Can't build plugin from SVN. Build process stops with message:
D:\GCC\CodeBlocksPlugins\MakefileGen\Makefile.cpp: In member function 'bool cbMGMakefile::SaveMakefile()':
D:\GCC\CodeBlocksPlugins\MakefileGen\Makefile.cpp:181: error: 'ctInvalid' was not declared in this scope
It really seems to work - I tried today another time with another project and it worked from scratch. Well done. Hence one thing I am missing: The plugin does overwrite existing Makefile's without any warning. This is no good. I lost an old Makefile that way. :-( Any chance for an improvement accordingly?! ;-(
You should do configure the Overwrite option into Settings/Environment/cbMakefileGen dialog.
Overwrite is true by default, hmm. :(
Now I being changed default values to:
FileName: "Makefile.gen"
Overwrite: "false"
I will tests and do commit this changes to repository and binary distributive later.
I have idea for add an execution dialog for show options, error messages and other logs.
This dialog would content all options and filename of Makefile and an file existance flag.
Big sorry.
Patch that might help someone using C::B Svn.
Tim S
Index: cbMakefileGen.cpp
===================================================================
--- cbMakefileGen.cpp (revision 17)
+++ cbMakefileGen.cpp (working copy)
@@ -6,7 +6,7 @@
#include "cbmakefilecfg.h"
#include <cbproject.h>
#include <projectmanager.h>
-#include <messagemanager.h>
+#include <logmanager.h>
#include <configmanager.h>
int MakefileGenId = wxNewId();
@@ -120,7 +120,7 @@
msg = _("You need to open a project\nbefore using the plugin!\n"
"C::B MakefileGen could not complete the operation.");
cbMessageBox(msg, _("Error"), wxICON_ERROR | wxOK, Manager::Get()->GetAppWindow());
- Manager::Get()->GetMessageManager()->DebugLog(msg);
+ Manager::Get()->GetLogManager()->DebugLog(msg);
return;
}
Index: Makefile.cpp
===================================================================
--- Makefile.cpp (revision 17)
+++ Makefile.cpp (working copy)
@@ -2,7 +2,7 @@
#include <wx/textfile.h>
#include "Makefile.hpp"
#include <globals.h>
-#include <messagemanager.h>
+#include <logmanager.h>
#include <compiler.h>
#include <compilerfactory.h>
#include <macrosmanager.h>
@@ -104,7 +104,7 @@
wxString l_Msg = _( "Can't found an active target!\n"
"C::B MakefileGen could not complete the operation." );
cbMessageBox( l_Msg, _( "Error" ), wxICON_ERROR | wxOK, (wxWindow *)Manager::Get()->GetAppWindow() );
- Manager::Get()->GetMessageManager()->DebugLog( l_Msg );
+ Manager::Get()->GetLogManager()->DebugLog( l_Msg );
return l_Ret;
}
@@ -178,7 +178,7 @@
l_Rule.SetPrerequisites( objs );
wxString kind_of_output = _T( "unknown" );
- CommandType ct = ctInvalid; // get rid of compiler warning
+ CommandType ct = ctCount; // ctInvalid; // get rid of compiler warning
switch ( l_pTarget->GetTargetType() )
{
case ttConsoleOnly:
I'm trying to compile cbMakefileGen under Linux using codeblocks_8.02-0ubuntu1.deb and last cbMakefileGen svn but I get this error :
/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
Try this patch, I had similar issue under windows on NON PCH build.
Tim S
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>
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:
<ExtraCommands>
<Add after="zip -j9 ../../../devel/share/codeblocks/cbMakefileGen.zip manifest.xml" />
<Mode after="always" />
</ExtraCommands>
Good luck!
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]
I check this problem on cbMakefileGen version: 0.3.12.3. C::B rev.5435.
I have no problem.
History:
I does loading my cbMakefileGen project (cbmakegen.cbp).
"Build target: default" was selected after loading. (I don't change it).
I does select from menu: Project / Generate Makefile
Ok. Makefile was created normally.
If you have problem, send me (on email) your project WITHOUT source files. (file .cbp only) I will try help you.
Good luck!
Sorry,it is no problem after I rebuild cbMakefileGen in the rev5435 of codeblocks.
Other question.
I try to output a makefile of codeblocks.cbp(codeblocks project file).
I get a crash.
Thank you for your reply.
:D
Error occured on Tuesday, February 3, 2009 at 19:43:19.
D:\CB_Pack\codeblocks_debug\codeblocks.exe caused an Access Violation at location 61a1b446 in module D:\CB_Pack\codeblocks_debug\codeblocks.dll Reading from location 0000002c.
Registers:
eax=0000002c ebx=00000001 ecx=11b5b52c edx=0023e940 esi=001e0344 edi=0023fa0c
eip=61a1b446 esp=0023e760 ebp=0023e760 iopl=0 nv up ei pl nz ac po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010216
Call stack:
61A1B446 D:\CB_Pack\codeblocks_debug\codeblocks.dll:61A1B446 _ZNK12wxStringBase13GetStringDataEv
619BF636 D:\CB_Pack\codeblocks_debug\codeblocks.dll:619BF636 _ZN12wxStringBaseC2ERKS_
61A144CE D:\CB_Pack\codeblocks_debug\codeblocks.dll:61A144CE _ZN8wxStringC1ERKS_
61886E5F D:\CB_Pack\codeblocks_debug\codeblocks.dll:61886E5F UnixFilename(wxString const&) D:/CB_Pack/codeblocks_debug/SDK/CodeBlocks_src/src/sdk/globals.cpp:164
0A2C2CAE D:\CB_Pack\codeblocks_debug\share\codeblocks\plugins\cbMakefileGen.dll:0A2C2CAE
0A2C353C D:\CB_Pack\codeblocks_debug\share\codeblocks\plugins\cbMakefileGen.dll:0A2C353C
0A2C5723 D:\CB_Pack\codeblocks_debug\share\codeblocks\plugins\cbMakefileGen.dll:0A2C5723
0A2C8CEF D:\CB_Pack\codeblocks_debug\share\codeblocks\plugins\cbMakefileGen.dll:0A2C8CEF
0A2C9C25 D:\CB_Pack\codeblocks_debug\share\codeblocks\plugins\cbMakefileGen.dll:0A2C9C25