Author Topic: Custom makefile problems  (Read 8751 times)

Offline tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Custom makefile problems
« on: March 16, 2011, 12:36:13 pm »
Hello everybody,
I am having troubles with compiling my project in CB. I have a directory SRC with all the source files and makefile. There is a subdirectory MAKE with makefiles (makefile.type) with different setting. When I compile the project from terminal in SRC I just type make type where type refers to one of the file in the MAKE directory.
In CB I put the project to the SRC directory, in compiling options checked the use custom make file. I am sure that for compiling I need to add the custom variables, but don't know how exactly. In the build/target project variables I have $make -f $makefile $target. I ve tried many ways how nad where to write type but without any success.
Any help would be really appreciated,
Thanks Tomas

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom makefile problems
« Reply #1 on: March 16, 2011, 12:48:22 pm »
It should work if you use "type" as target-name.
You can copy or rename the standard targets in "Project -> Properties -> Build targets".
And thee chose the correct target from the dropdown-list in the compiler toolbar.

Offline tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Re: Custom makefile problems
« Reply #2 on: March 18, 2011, 01:30:20 pm »
Thank you for you reply,
I changed the target to type and now the project compiles even though I got errors during compiling but the program is running. But unfortunately I am still having some problems
1) I can no run the program but cannot debug it - i.e. it doesn't stop on my breakpoints
2) I execute the program from command line like program <inputfile , where program is the generated program and inputfile is the file with the input for the program. Is there any way how to run it from CB so that is reads the specific inputfile? I can change the source code, but it is not very convenient as I still would like to have option to run it the normal way from terminal.
3) I am not able to run the clean command from CB. It is not a big problem as I can still do it from terminal with make clean-all or make clean-type but I am sure there is an option to do it from CB.
Thanks you once again for your help. Question number 1 is the most important the other two are not that crucial.
Tomas

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Custom makefile problems
« Reply #3 on: March 18, 2011, 01:35:31 pm »
1. Have you tried the debugger's nightly?
3. You can modify all make commands that are executed. It is in project -> build options or project -> properties, it is one of the last tabs and in most cases it is not visible.
(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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom makefile problems
« Reply #4 on: March 18, 2011, 02:07:39 pm »
Thank you for you reply,
I changed the target to type and now the project compiles even though I got errors during compiling but the program is running. But unfortunately I am still having some problems
1) I can no run the program but cannot debug it - i.e. it doesn't stop on my breakpoints
2) I execute the program from command line like program <inputfile , where program is the generated program and inputfile is the file with the input for the program. Is there any way how to run it from CB so that is reads the specific inputfile? I can change the source code, but it is not very convenient as I still would like to have option to run it the normal way from terminal.
3) I am not able to run the clean command from CB. It is not a big problem as I can still do it from terminal with make clean-all or make clean-type but I am sure there is an option to do it from CB.
Thanks you once again for your help. Question number 1 is the most important the other two are not that crucial.
Tomas
1. Do the makefiles set the -g option to create debugging-symbols ?
2. "Project -> Set programs's arguments.."
3. You have to fix the appropriate make-command in the projects/targets "Build options -> 'Make' arguments" for the cleaning process (in your case most likely a "-" between clean and $target .

Offline tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Re: Custom makefile problems
« Reply #5 on: March 18, 2011, 04:53:56 pm »
Hello,
1)No I don't use the -g argument in makefile. I thought I just need to have it checked in Compiler and Debugger settings.
2) Solved, thanks
3) That was a first thing I've tried but without success. I don't understand quite well how this works, but unfortunately I haven't found any documentation - I assume that the variable $makefile if the name of my makefile and $target is the target name - what is the $make variable? The command I need to execute is make clean-all
Thank you again for all your replies,
T.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom makefile problems
« Reply #6 on: March 18, 2011, 05:39:39 pm »
You should turn on full commandline logging to see which commands are executed: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

$make is the name of the make-executable as it is set in the "Toolchain executables" tab of the compiler you use,

$makefile is the name of the makefile as it is set in your project properties. It's needed, if the makefile is not named like the default makefile of your make-executable.

$target is the name of the target you currently compile.

Offline tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Re: Custom makefile problems
« Reply #7 on: March 18, 2011, 05:46:52 pm »
Thanks for explanation, but I am still struggling with the biggest issue - the debugging. Any suggestions?
Thank you,
T.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Custom makefile problems
« Reply #8 on: March 18, 2011, 05:56:47 pm »
Thanks for explanation, but I am still struggling with the biggest issue - the debugging. Any suggestions?
Thank you,
T.
Without -g (if it's gcc) you have no chance.
If you use custom makefiles, you have to set it in the makefile, because you bypass C::B's build-system.
Some makefiles also have debug-targets, but you have to search for it in your makefile or in the documentation yourself.

Offline tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Re: Custom makefile problems
« Reply #9 on: March 18, 2011, 06:41:12 pm »
Hello,
I am able to debug the program with gdb from terminal. It should means that I had compiled it correctly with the debug marks. But I am not able to debug using CB.
Thanks,
T.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Custom makefile problems
« Reply #10 on: March 18, 2011, 08:10:37 pm »
1. Have you tried the debugger's nightly?
(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 tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Re: Custom makefile problems
« Reply #11 on: March 18, 2011, 11:18:28 pm »
No,
I don't know what does debugger's nightly mean. Can you please explain?
T.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Custom makefile problems
« Reply #12 on: March 19, 2011, 12:22:18 am »
No,
I don't know what does debugger's nightly mean. Can you please explain?
T.

http://forums.codeblocks.org/index.php/topic,14334.0.html
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 tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Re: Custom makefile problems
« Reply #13 on: March 21, 2011, 06:50:35 pm »
Thanks,
I will have a look at it. So do you think that the new version of debugger should solve my problem? Are there some major differences between the new nightly versions and the official relase?
T.

Offline tomasbym

  • Single posting newcomer
  • *
  • Posts: 9
Re: Custom makefile problems
« Reply #14 on: March 21, 2011, 07:44:15 pm »
Hello,
I downloaded the latest version 7040, but still without success. I am able to debug the program from terminal using GDB but not from CB. Do you know what may be a problem??
Thanks T.