Society of Robots - Robot Forum

General Misc => Misc => Topic started by: chelmi on July 16, 2009, 09:18:22 AM

Title: Who is interested in a Makefile tutorial?
Post by: chelmi on July 16, 2009, 09:18:22 AM
Hi all,

I noticed that Makefile related issues come up regularly in the forum. Makefile is a wonderful tool but can be really tricky and confusing. As I said in another topic, I use make everyday and if people show interest, I can write a Makefile tutorial for SoR. A few thoughts:
- I don't use winAVR, so my tutorial would be more general than just fixing makefiles generated by winAVR. But if you understand Makefiles, you could be able to fix the problem by yourself.
- I will probably have a section about compilation and the different phases (It's always good to know the general principle behind the gui)
- In the final section I will present my project "template" for command line AVR development under Linux and probably Windows+cygwin. I.e. a directory structure and a easily customizable Makefile.
- As you've probably guessed, English is not my first language and my tut will probably needs some proof-reading ;)

What do you think?

Chelmi.
Title: Re: Who is interested in a Makefile tutorial?
Post by: kpmcgurk on July 16, 2009, 09:46:35 AM
I would read it, I do agree that makefiles do tend to be confusing!
Title: Re: Who is interested in a Makefile tutorial?
Post by: sonictj on July 16, 2009, 10:35:52 AM
I'm interested
Title: Re: Who is interested in a Makefile tutorial?
Post by: SmAsH on July 16, 2009, 04:50:42 PM
it would be a great tutorial to have on the site, i agree that it would help some people who are confused like me :P
Title: Re: Who is interested in a Makefile tutorial?
Post by: Miles on July 16, 2009, 07:31:07 PM
I would read it and benefit from it. It's one of the things stopping me from writing my own code from scratch
Title: Re: Who is interested in a Makefile tutorial?
Post by: Ro-Bot-X on July 16, 2009, 09:39:01 PM
I would read it and benefit from it. It's one of the things stopping me from writing my own code from scratch

Yep, same here with code in AVR GCC. That and the non english style of coding. Things like rprintf("%d\r\n",variable) stuff that wasn't easy enough to just write serial.print(variable, DEC).
Title: Re: Who is interested in a Makefile tutorial?
Post by: Joker94 on July 16, 2009, 09:44:44 PM
i think it would help every one
Title: Re: Who is interested in a Makefile tutorial?
Post by: sonictj on July 16, 2009, 11:19:21 PM
Quote
I would read it and benefit from it. It's one of the things stopping me from writing my own code from scratch

I'm all for the tutorial, but I don't know why make files should stop you.  You can simply let GCC generate them for you just adjust three parameters in configuration options in AVR Studio.  Those parameters are your clock frequency, the device, and the level of optimization.
Title: Re: Who is interested in a Makefile tutorial?
Post by: chelmi on July 17, 2009, 10:01:49 AM
Quote
I would read it and benefit from it. It's one of the things stopping me from writing my own code from scratch

I'm all for the tutorial, but I don't know why make files should stop you.  You can simply let GCC generate them for you just adjust three parameters in configuration options in AVR Studio.  Those parameters are your clock frequency, the device, and the level of optimization.

What do you mean by "You can simply let GCC generate them for you"? Makefiles?

Anyway I agree with you, makefiles are not mandatory; but they become almost necessary when you split your application in multiple files (I'll talk about that in my tutorial).

I feel motivated enough and it's going to rain this week end (again...), perfect to write a tutorial.

Chelmi
Title: Re: Who is interested in a Makefile tutorial?
Post by: sonictj on July 17, 2009, 05:55:48 PM
Quote
What do you mean by "You can simply let GCC generate them for you"? Makefiles?

As long as you do not select use an external makefile, in the configuration files of AVR Studio, GCC is automatically generating a makefile for you.

Either way knowing how to create makefiles sounds like a valuable skill to have.  I'm all for the tutorial.
Title: Re: Who is interested in a Makefile tutorial?
Post by: chelmi on July 17, 2009, 06:23:39 PM
Quote
What do you mean by "You can simply let GCC generate them for you"? Makefiles?

As long as you do not select use an external makefile, in the configuration files of AVR Studio, GCC is automatically generating a makefile for you.

Either way knowing how to create makefiles sounds like a valuable skill to have.  I'm all for the tutorial.

I doubt GCC will create a Makefile, it's probably generated by AVR Studio.
Title: Re: Who is interested in a Makefile tutorial?
Post by: sonictj on July 17, 2009, 06:52:01 PM
the generator can be found in wherever gcc is \utils\bin\make.exe this is the makefile plugin to AVR Studio. I tried something new too, if you look in the build pull down menu of AVR Studio you will see export makefile.  This will give you the makefile for your project.  Here is mine that was generated.  I think I kinda understand whats going on in there.
Title: Re: Who is interested in a Makefile tutorial?
Post by: chelmi on July 17, 2009, 07:37:00 PM
the generator can be found in wherever gcc is \utils\bin\make.exe this is the makefile plugin to AVR Studio. I tried something new too, if you look in the build pull down menu of AVR Studio you will see export makefile.  This will give you the makefile for your project.  Here is mine that was generated.  I think I kinda understand whats going on in there.

make is the Makefile interpreter. It reads a Makefile and perform the actions described in it. AVR Studio is probably the one generating the Makefile. It will all become clear with my tutorial, hopefully :p
Title: Re: Who is interested in a Makefile tutorial?
Post by: sonictj on July 17, 2009, 10:23:29 PM
Quote
make is the Makefile interpreter. It reads a Makefile and perform the actions described in it. AVR Studio is probably the one generating the Makefile. It will all become clear with my tutorial, hopefully :p

ok