Author Topic: cbp2make - makefile generation tool  (Read 203366 times)

user601

  • Guest
Re: cbp2make - makefile generation tool
« Reply #15 on: January 11, 2011, 10:06:41 am »
Have you ever tried to compile this under windows (mingw)?

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #16 on: January 16, 2011, 08:59:23 pm »
Have you ever tried to compile this under windows (mingw)?

Yes, I did, but not the latest revison(s). Since I rewrote some platform-specific stuff after rev.38 and tested only Linux version, Windows part may become broken. Sorry for inconvenience, I will try fix Windows/MinGW issues as soon as I can.

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #17 on: January 20, 2011, 08:42:22 pm »
Update: (see rev.58) Fixed problem with compiling Windows-specific code rewritten and broken after rev.39.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: cbp2make - makefile generation tool
« Reply #18 on: January 20, 2011, 09:26:23 pm »
Update: (see rev.58) Fixed problem with compiling Windows-specific code rewritten and broken after rev.39.
Crashes immediately on Windows if the cbp file is not present (was a typo in my command line).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: cbp2make - makefile generation tool
« Reply #19 on: January 20, 2011, 09:40:31 pm »
Update: (see rev.58) Fixed problem with compiling Windows-specific code rewritten and broken after rev.39.
Crashes immediately on Windows if the cbp file is not present (was a typo in my command line).
..further information:
It crashes here:
Code
 result = getenv("HOME");
-> the assignment fails as getenv returns NULL. You cannot rely on envvars being present. The envvar HOME may exist on Windows but in many cases (as in mine) it does not. You probably want to use USERPROFILE instead. However, still you'll need to evaluate the return value getenv provides in any case. ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #20 on: January 21, 2011, 02:50:38 pm »
Update: (see rev.60) Fixed errors in Windows build.

Argh... I've changed only a part of wrong code. There are macros to detect OS at compile time and switch blocks of code. In few places, an inexistent OS_WINDOWS macro was used instead of correct OS_WIN. That's my fault. Some other modules were also affected by this error.

Quote from: MortenMacFly
It crashes here:
Code:
result = getenv("HOME");
-> the assignment fails as getenv returns NULL. You cannot rely on envvars being present. The envvar HOME may exist on Windows but in many cases (as in mine) it does not. You probably want to use USERPROFILE instead. However, still you'll need to evaluate the return value getenv provides in any case.

It was using "HOME" instead of "USERPROFILE" because the Unix version of code was compiled-in because of wrong macros. However, you are right, I have to insert some additional checks. I usually refer to Qt or WX for implementation of cross-platform stuff.
« Last Edit: January 21, 2011, 03:39:49 pm by mirai »

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #21 on: March 13, 2011, 09:36:21 pm »
Update: (see rev.66)

  • Implemented multi-line object file lists (use "--wrap-objects" option) which makes makefiles look more user- and cvs- friendly.
  • Added options to configure f77/f90 compilers in toolchains.
  • Added revision number to generated makefile header.


Also, I started a complete rewrite of makefile generation code to prepare less hard-coded and more flexible infrastructure to reflect more CB build system features. cbp2make still misses good support of wide range of compilers and other build tools while CB can do so much more.

Offline Revan

  • Single posting newcomer
  • *
  • Posts: 3
Re: cbp2make - makefile generation tool
« Reply #22 on: March 15, 2011, 04:58:15 pm »
I found one problem, when use without --wrap-object then sections OBJ_DEBUG, OBJ_RELEASE are missing. Compiled tdm-gcc 4.5.1.

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #23 on: March 15, 2011, 07:13:08 pm »
I found one problem, when use without --wrap-object then sections OBJ_DEBUG, OBJ_RELEASE are missing. Compiled tdm-gcc 4.5.1.
Just fixed that, see rev.72.

p.s. I was really surprised when I found that these macros are missing when I tried to update some of my makefiles because they were just fine [not so] many revisions ago.
« Last Edit: March 15, 2011, 09:44:48 pm by mirai »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: cbp2make - makefile generation tool
« Reply #24 on: March 16, 2011, 01:47:51 pm »
because they were just fine [not so] many revisions ago.
If you renamed your targets that that's the reason.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #25 on: March 23, 2011, 09:48:15 pm »
Update: (see rev.80)

  • Fixed commands-only type of targets so they no longer generate rules for object files and binary output, clean_* rules will not be generated for this type of targets either.
  • Doxygen-style documentation is in progress...



Offline blinde

  • Single posting newcomer
  • *
  • Posts: 4
Re: cbp2make - makefile generation tool
« Reply #26 on: March 24, 2011, 11:15:29 am »
Hi.

Just made a first test with cbp2make.
Generated makefile works but there is no .h dependencies management ?
Or I missed something ?

Thanks

Chris

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #27 on: March 24, 2011, 03:40:23 pm »
Just made a first test with cbp2make.
Generated makefile works but there is no .h dependencies management ?
Or I missed something ?
No, you haven't missed anything. I intentionally don't generate dependencies for non-compilable files. However, this may be wrong for some cases like forcing make to rebuild the project when a .h file changes. Just let me know if I'm really wrong at this point and I will fix the issue. I guess I have to (at least optionally) generate dependencies for all project files including non-compilable and/or especially treat C/C++ case with .h/.c pairs.

Offline blinde

  • Single posting newcomer
  • *
  • Posts: 4
Re: cbp2make - makefile generation tool
« Reply #28 on: March 24, 2011, 04:10:03 pm »
I intentionally don't generate dependencies for non-compilable files.

Hum... Don't understand.
I have a test.c file.
test.c include test.h

test.c is a compilable file.

I think that there should be a dependency between test.c & test.h.

I don't know what is the purpose of cbp2make
1- it is just a workaround to temporary build a CB project in console mode.
So we accept the requirement of doing make clean; make all when I want to rebuild.
In this case I understand that we can forget dependencies.

2- cbp2make shoud really generate some makefile that are fully usable and that will replace the build made in CB
In this case, dependencies are mandatory (make clean; make all take 20mn on my project...)


Thanks

Chris



Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: cbp2make - makefile generation tool
« Reply #29 on: March 24, 2011, 04:59:40 pm »
I intentionally don't generate dependencies for non-compilable files.
Hum... Don't understand.
I have a test.c file.
test.c include test.h
test.c is a compilable file.
I think that there should be a dependency between test.c & test.h.
test.h does not produce an object file, therefore, it is not a dependency for target binary.
However, it is a dependency of test.c ... and should be somehow taken into account.

I don't know what is the purpose of cbp2make
1- it is just a workaround to temporary build a CB project in console mode.
So we accept the requirement of doing make clean; make all when I want to rebuild.
In this case I understand that we can forget dependencies.
The purpose is to build CB projects when CB is missing and cannot (should not) be installed by any means.
It is not just a workaround, even if it may seem so, because one of requirements is not depending on CB presence at all.

I think that it is possible to even make a complete build system out of cbp2make, i.e.,
to eliminate use of 'make' tool at all in some cases and run other build tools directly.

2- cbp2make shoud really generate some makefile that are fully usable and that will replace the build made in CB
In this case, dependencies are mandatory (make clean; make all take 20mn on my project...)
Yes, that is my intention, i.e., fully usable makefiles.
Let me remind that cbp2make is still in alpha stage, and many necessary things are missing yet.

Never the less, thank you for paying attention to my efforts, I will try to fix this .h/.c problem.

One thing that bothers me about this kind of dependencies is that they are not contained in CB project.
I will probably have to scan source files and search for include directives and pay attention to other preprocessor directives... this may become a real problem.
« Last Edit: March 24, 2011, 05:01:41 pm by mirai »