2012-03-10 14:25:42 +01:00
# A Makefile for Arduino Sketches
2013-05-19 13:03:59 +02:00
This is a very simple Makefile which knows how to build Arduino sketches. It defines the entire workflows for compiling code, flashing it to Arduino and even communicating through Serial monitor. You don't need to change anything in the Arduino sketches.
2012-03-10 14:25:42 +01:00
2013-05-19 13:03:59 +02:00
If you're using Debian or Ubuntu, you can find this in the `arduino-mk` package.
2012-03-10 14:25:42 +01:00
2013-05-19 13:03:59 +02:00
## Credits
2012-04-29 19:55:17 +02:00
2013-05-19 13:03:59 +02:00
This makefile was originally created by [Martin Oldfield ](http://mjo.tc/atelier/2009/02/arduino-cli.html ) and he maintained it till v0.10.2.
From May 2013, it is maintained by [Sudar ](http://hardwarefun.com )
2012-04-29 19:55:17 +02:00
2013-05-19 13:03:59 +02:00
## Usage
2012-04-29 19:55:17 +02:00
2013-05-19 13:03:59 +02:00
Download a copy of this repo some where in your system.
2012-04-29 19:55:17 +02:00
On the Mac you might want to set:
ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
ARDMK_DIR = /usr/local
On Linux, you might prefer:
ARDUINO_DIR = /usr/share/arduino
ARDMK_DIR = /usr/local
AVR_TOOLS_DIR = /usr
The Makefile also delegates resetting the board to a short Perl program.
2012-12-15 13:04:48 +01:00
You'll need to install `Device::SerialPort` to use it though. You'll also
need the `YAML` library to run ard-parse-boards.
2012-04-29 19:55:17 +02:00
2012-09-17 17:05:21 +02:00
On Debian or Ubuntu:
2012-04-29 19:55:17 +02:00
2013-01-21 07:01:09 +01:00
apt-get install libdevice-serialport-perl
2012-09-17 17:05:21 +02:00
apt-get install libyaml-perl
On Fedora:
yum install perl-Device-SerialPort
yum install perl-YAML
2012-04-29 19:55:17 +02:00
2012-10-07 11:54:14 +02:00
On Mac using MacPorts:
sudo port install p5-device-serialport
sudo port install p5-YAML
and use /opt/local/bin/perl5 instead of /usr/bin/perl
2012-09-17 17:05:21 +02:00
On other systems:
2012-04-29 19:55:17 +02:00
cpanm Device::SerialPort
2012-09-17 17:05:21 +02:00
cpanm YAML
2012-03-26 05:54:21 +02:00
## User Libraries
In order to use Arduino libraries installed in the user's sketchbook folder (the
standard location for custom libraries when using the Arduino IDE), you need to
2012-09-10 18:47:01 +02:00
set the `ARDUINO_SKETCHBOOK` variable to point to this directory. By default it
2012-03-26 05:54:21 +02:00
is set to `$HOME/sketchbook` .
2012-07-06 08:42:43 +02:00
2013-05-31 05:59:36 +02:00
## Versioning
2013-05-31 06:12:44 +02:00
The current version of the makefile is `0.10.4` . You can find the full history in the [HISTORY.md ](HISTORY.md ) file
2013-05-31 05:59:36 +02:00
This project adheres to Semantic [Versioning 2.0 ](http://semver.org/ ).
2013-05-31 06:12:44 +02:00
## Contribution
All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
If you are looking for ideas to work on, then check out the following TODO items.
2013-05-31 05:59:36 +02:00
## Know Issues / TODO's
2013-05-31 06:12:44 +02:00
- Doesn't work with Arduino 1.5.x yet.
If you find an issue or have an idea for a feature then log them at https://github.com/sudar/Arduino-Makefile/issues/
2013-05-19 13:03:59 +02:00
## Similar works
- It's not a derivative of this, but Alan Burlison has written a [similar thing ](http://bleaklow.com/2010/06/04/a_makefile_for_arduino_sketches.html ).
- Alan's Makefile was used in a [Pragmatic Programmer's article ](http://pragprog.com/magazines/2011-04/advanced-arduino-hacking ).
- Rei Vilo wrote to tell me that he's using the Makefile ina Xcode 4 template called [embedXcode ](http://embedxcode.weebly.com/ ). Apparently it supports many platforms and boards, including AVR-based Arduino, AVR-based Wiring, PIC32-based chipKIT, MSP430-based LaunchPad and ARM3-based Maple.