Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: dfatcb on January 19, 2016, 01:53:33 am

Title: Have code::blocks only run 'make'
Post by: dfatcb on January 19, 2016, 01:53:33 am
Hi,

So I want to use code::blocks to build a kernel module for convenience.  All I need it to do is run "make" from the directory (can also setup "make clean" since the Makefile can call the kbuild clean option).  How do I set that up?

TIA!!
Title: Re: Have code::blocks only run 'make'
Post by: stahta01 on January 19, 2016, 01:57:27 am
Two obvious ways.

1. Script only CB Project. Edit2: This would use CB Pre and/or Post build steps.
2. CB Custom makefile project.
Edit: The first Wiki link I found it is NOT one I recognized http://wiki.codeblocks.org/index.php/Code::Blocks_and_Makefiles (http://wiki.codeblocks.org/index.php/Code::Blocks_and_Makefiles)

But, I have no idea why you wish to use Code::Blocks to do this task.

I would choose option 1. and use a script only project; but, this is likely because in the past I used option 2 and would like to know if option one is better.

Tim S.
Title: Re: Have code::blocks only run 'make'
Post by: oBFusCATed on January 19, 2016, 02:19:15 am
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28general%29#Q:_My_project_should_be_compiled_with_a_custom_makefile._Is_it_possible_with_Code::Blocks.3F
Title: Re: Have code::blocks only run 'make'
Post by: dfatcb on January 19, 2016, 09:10:51 am
I checked that box, but also set the type to script only and also tried native.  neither would build? 
Title: Re: Have code::blocks only run 'make'
Post by: oBFusCATed on January 19, 2016, 09:12:50 am
Have you inspected the build log? When you open the build options you'll see what make commands are executed. You have to edit them to suit your makefile.
Title: Re: Have code::blocks only run 'make'
Post by: stahta01 on January 19, 2016, 06:39:25 pm
I checked that box, but also set the type to script only and also tried native.  neither would build?

You NEED to pick only one of the options I listed! You can NOT do both at the same time!

If using the "custom makefile" method.
Did you create a makefile or point the project to a makefile?
I would create a new makefile that uses the existing makefile.

You need to tell us which method you are trying to do!

Tim S.

Title: Re: Have code::blocks only run 'make'
Post by: Jenna on January 19, 2016, 08:13:29 pm
Here is a quote of my answer in another thread:

C::B can not convert from makefile to C::B build-system.
This has to be done manually.
The difficulty highly depends on the size and complexity of the project.

But you can
create a custom makefile project:

  • Create an empty project with the wizard,
  • add all files you might want to work on,
  • go to "Project -> Properties",
  • check "This is a custom makefile",
  • edit the makefile name if needed,
  • change the path to the makefile if needed,
  • fix the make commands in "Project -> Build options -> "Make " commands", for the target and/or the whole project.

For nested makefiles, just point to the root-makefile.
If you use the $make-variable, make sure the make-executable in the toolchain you use is correct.
You can also execute configure script or others instead of the make-executables in special targets.
I do it to compile wxWidgets (and me-tv)  on my Fedora box and it works smoothly.
Title: Re: Have code::blocks only run 'make'
Post by: dfatcb on January 20, 2016, 12:08:33 am
ok, so set compiler to gcc c, and targets console app.  changed the make commands to just have two, the "make" and "make clean".

kbuild seems to work.  If anyone knows if there is a way to have kbuild output to a different directory, that be great.   I use modules now for target, when I tried putting in a directory name, the build would say it does't know how to make the target ?