Author Topic: Have code::blocks only run 'make'  (Read 3104 times)

Offline dfatcb

  • Multiple posting newcomer
  • *
  • Posts: 67
Have code::blocks only run 'make'
« 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!!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Have code::blocks only run 'make'
« Reply #1 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

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.
« Last Edit: January 19, 2016, 02:01:22 am by stahta01 »
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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(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 dfatcb

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Have code::blocks only run 'make'
« Reply #3 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? 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Have code::blocks only run 'make'
« Reply #4 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.
(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 stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Have code::blocks only run 'make'
« Reply #5 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.

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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Have code::blocks only run 'make'
« Reply #6 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.

Offline dfatcb

  • Multiple posting newcomer
  • *
  • Posts: 67
Re: Have code::blocks only run 'make'
« Reply #7 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 ?