Author Topic: How to convert Makefile to Code::Blocks project  (Read 5511 times)

Offline umen

  • Multiple posting newcomer
  • *
  • Posts: 13
How to convert Makefile to Code::Blocks project
« on: January 15, 2021, 07:22:01 pm »
i have a simple makefile that looks like this :
Code
all:
gcc  fno-stack-protector -static -O2 test.c test1.S -o test.elf

i created project in C::B
i set build target to test.c test1.S and added in other compiler option :fno-stack-protector 

but no matter what i do the compiler flags as not like in the make file
the build log looks like this :
Code
g++  -o bin/Debug/payload obj/Debug/test.o obj/Debug/test1.o  -static


1 . why it is configured to use g++ Although i set gcc
2. how to make C::B to be as my make file ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to convert Makefile to Code::Blocks project
« Reply #1 on: January 15, 2021, 08:08:12 pm »
1. Search for "custom makefile project" on the wiki and in the forum.
2. If you want to use the C::B's build system, you'll have to read this: http://wiki.codeblocks.org/index.php/Adding_support_for_non_C/C%2B%2B_files_to_the_build_system
3. Are you using 20.03? There the g++ problem is fixed.
(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 umen

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: How to convert Makefile to Code::Blocks project
« Reply #2 on: January 15, 2021, 09:25:58 pm »
1 . Thanks, i found the answer here : and it compiles great  ( replace all with debug in the make file .. )
https://stackoverflow.com/questions/28542408/how-use-a-makefile-with-codeblocks

but when i try to debug it I'm getting (added -g)
Code
gcc  -g -fno-stack-protector -static -O2 test.c test1.S -o test.elf

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/vagrant/example/
Adding source dir: /home/vagrant/example/
Adding file: /home/vagrant/example/bin/Debug/example
Changing directory to: /home/vagrant/example/.
Set variable: LD_LIBRARY_PATH=.:
Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args /home/vagrant/example/bin/Debug/example
Setting SHELL to '/bin/sh'
done
Setting breakpoints
Debugger name and version: GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Starting the debuggee failed: No executable file specified.
Debugger finished with status 0



3 . yes I'm using 20.3 , what fix you talking about ?
« Last Edit: January 15, 2021, 09:28:46 pm by umen »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to convert Makefile to Code::Blocks project
« Reply #3 on: January 15, 2021, 09:53:45 pm »
3. Project -> Build options -> Linker settings -> Linker executable -> Auto detect.

For the debugger. Please post the full debugger log. Are you able to run your project? Are the executable and work dir paths setup correctly in Project -> Properties?
(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!]