How do I use a Makefile?

Hi there!
Someone has written code for a project I'm interested in and they have the following files:
main.c, another file with .c extension, a file with a .h extension and Makefile.

I've never made projects under than through the arduino program before uploading them to the chip... How would I go about using these?

You may or may not need a make file:

http://playground.arduino.cc/Learning/CommandLine

That said - a google search on "arduino makefile" will pull up results - for instance:

That said - you might want to post your code, because it sounds like what you might have is an AVR C program (perhaps for the ATMega328 - but who knows?) - and not an Arduino program necessarily. Or - you may have the post pre-processed version of the code (but prior to compilation to the .hex file).

Either way - being able to take a look at all of the code -and- the makefile would be very helpful.

Likely - you'll just place it all in a single directory, perhaps alter a line or two in the makefile (?), then type "make" or "make all" or "make install" or ...? That would depend on the makefile and how it is set up - but without seeing it, I don't know what the proper "make" command would be.

This also assumes you are running Linux or OSX (Mac) or some other sane *nix - otherwise, IIRC, you have to set up a "unix-like" environment under Windows to use make (?) - cygwin or similar...I'm not a windows guy so without looking it up and studying it, I'm not sure what the process would be on that platform, but it may take a few more steps (or it may not).

So - post the code first - and let us know what platform you will be compiling this on (Windows, Mac, Linux, something else?)...

Eh - regarding windows - found this (google "windows arduino makefile"):

http://forum.arduino.cc/index.php?topic=37813.0

Thanks for your help so far,
This is a link to the files:

Well - that's not an arduino project.

It's meant to be compiled using avr-gcc and uploaded using avrdude - which you'll have with the Arduino IDE installed. Its targeted at the ATMega328 (ie - an Arduino Uno), and the Arduino as the programmer (ie - over USB).

So, once you have things set up on your system (you still didn't mention what you are using) - you should be able to type (in the directory where the makefile is) "make" or "make all" - then "make install" to get it over to the Arduino.

The Arduino needs to be plugged in to the USB - and the port it is set to is in the makefile - currently set to "/dev/ttyACM0" - you'll need to alter that line (on line 120) to point to the proper serial port.

Note that all of this is for *nix - I am not sure what you'll need to do under Windows. But the process should be somewhat similar.