Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » cdt autogenerated Makefile Script
cdt autogenerated Makefile Script [message #1723347] Sun, 14 February 2016 22:30 Go to next message
Arie Gu is currently offline Arie GuFriend
Messages: 3
Registered: February 2016
Junior Member
Hey, I made a C project in Eclipse for Atmel microcontroller (avr-gcc)
It is using Eclipse autogenerated Makefile.
Until now it was the best solution for me, but now I want to add custom logic to the Makefile.
Where can I find the script/rules that build the automatic Makefile?
Is there a tutorial to understand how to "move" from automatic Makefile to custom?

Re: cdt autogenerated Makefile Script [message #1723424 is a reply to message #1723347] Mon, 15 February 2016 14:51 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
What extra logic do you have in mind? You can always modify the make file built by Eclipse but you should turn off letting Eclipse continue to write one or it will step on your changes. Modifying the make file (actually could be several depending on your setup) or rolling your own is likely easier than trying to force Eclipse into doing what you want.
Re: cdt autogenerated Makefile Script [message #1723426 is a reply to message #1723424] Mon, 15 February 2016 14:56 Go to previous messageGo to next message
Arie Gu is currently offline Arie GuFriend
Messages: 3
Registered: February 2016
Junior Member
Hi,
Thanks for the answer.
I have a script that parsing information from the git commit and saving it into header file.
I want to run it before compiling the program.
I want to build a raw binary file and to run a crc on it, and to update the result to a new binary file.

But the bigger thing is that I want to understand better what are the things that the Eclipse does in the "background" and to do them by myself.
Re: cdt autogenerated Makefile Script [message #1723429 is a reply to message #1723426] Mon, 15 February 2016 15:37 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
It does what most anyone would do when creating a make file: identify the sources; add rules and recipes to create object and dependency files; do similar for linking them together. The tool chain is mostly for generating make file recipes. Eclipse basically expects all source files would be included in the final build. There isn't much additional processing applied. The commands in the tool chain become part of the make recipes.

You could try modifying the compiler command to do what you want prior to the actual compile. Another option might be a pre-build step. http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_build_settings_steps.htm Or you could use a script call in place of a compile command.

There's a post-build step as well which you can use as required but you can also change the linker command to be a script call as well.

One thing you should be aware of is that Eclipse tends to run make a lot and doesn't bother to see if it will result in making new files. So, pre- and post- build steps might happen when not necessary. I've personally chosen to avoid messing with Eclipse and build my own make files. It's amazing how much automation can be built into one of them. Often just needs a little thought.



[Updated on: Mon, 15 February 2016 15:37]

Report message to a moderator

Re: cdt autogenerated Makefile Script [message #1723524 is a reply to message #1723429] Tue, 16 February 2016 11:42 Go to previous messageGo to next message
Arie Gu is currently offline Arie GuFriend
Messages: 3
Registered: February 2016
Junior Member
David Vavra wrote on Mon, 15 February 2016 15:37
I've personally chosen to avoid messing with Eclipse and build my own make files. It's amazing how much automation can be built into one of them. Often just needs a little thought.


Thanks David,
It is the main reason I want to understand how to make this conversion to manual Makefile
Re: cdt autogenerated Makefile Script [message #1723602 is a reply to message #1723524] Tue, 16 February 2016 17:46 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Not sure if you are asking how to build a make file.
If so, here's one tutorial, not necessarily the best. Search Google for "gnu make tutorial"
http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
Eclipse has already provided you with another example.

You can get a download of the complete manual here
https://www.gnu.org/software/make/manual/
Online version:
http://www.gnu.org/software/make/manual/make.html

Other than how things are affected by CDT, this is off topic for this forum.
Unfortunately, make files aren't the easiest things to debug.

Previous Topic:No Make.exe
Next Topic:Dynamic link
Goto Forum:
  


Current Time: Fri Apr 26 20:01:17 GMT 2024

Powered by FUDForum. Page generated in 0.03224 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top