Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial. http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile
Find a file
Matthijs Kooijman 4e6c776425 Fix directory creation for library source files
In commit 3bce1d88 (Allow adding extra common dependencies), the way
$(OBJDIR) was created changed. Instead of having some ad-hoc mkdir calls
around, all relevant rules were made to depend on the directory instead.

However, this change didn't take into account that the object files for
libraries live instead a subdirectory of $(OBJDIR), which was no longer
automatically created. This made compilation of all libraries fail, on a
clean build directory.

Fixing the rules to depend on $(dir $@) or $(dir %) doesn't work, since
those function calls are expanded by making upon reading the file, not
later when the rule is actually matched.

Therefore, this commit restores the previous explicit mkdir calls for
library object files. The non-library objects files, which do not live
in a subdirectory, still use the dependency approach as before.

Fixes: #58
2013-06-13 23:05:57 +02:00
arduino-mk Fix directory creation for library source files 2013-06-13 23:05:57 +02:00
bin fixed whitespace and /dev/null redirection 2013-06-13 09:38:27 +02:00
examples Added example to show how to program using Arduino as ISP. Fixes #55 2013-06-09 17:20:05 +05:30
.gitignore allow user to choose source files 2012-07-06 15:02:43 +05:30
HISTORY.md Change the way AUTO_ARDUINO_VERSION is computed 2013-06-13 17:02:15 +05:30
README.md Release v0.10.5 2013-06-11 16:16:05 +05:30

A Makefile for Arduino Sketches

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.

If you're using Debian or Ubuntu, you can find this in the arduino-mk package.

Credits

This makefile was originally created by Martin Oldfield and he maintained it till v0.10.2. From May 2013, it is maintained by Sudar

Usage

Download a copy of this repo some where in your system.

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. You'll need to install Device::SerialPort to use it though. You'll also need the YAML library to run ard-parse-boards.

On Debian or Ubuntu:

   apt-get install libdevice-serialport-perl
   apt-get install libyaml-perl

On Fedora:

   yum install perl-Device-SerialPort
   yum install perl-YAML

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

On other systems:

   cpanm Device::SerialPort
   cpanm YAML

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 set the ARDUINO_SKETCHBOOK variable to point to this directory. By default it is set to $HOME/sketchbook.

Versioning

The current version of the makefile is 0.10.5. You can find the full history in the HISTORY.md file

This project adheres to Semantic Versioning 2.0.

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 or the issue tracker.

Know Issues / TODO's

  • Doesn't work with Arduino 1.5.x yet.
  • Since it doesn't do any pre processing like Arduino IDE, you have to declare all methods before you use them (issue #59)
  • More than one .ino or .pde file is not supported yet (issue #49)

If you find an issue or have an idea for a feature then log them in the issue tracker

Similar works

  • It's not a derivative of this, but Alan Burlison has written a similar thing.
  • Alan's Makefile was used in a Pragmatic Programmer's article.
  • Rei Vilo wrote to tell me that he's using the Makefile ina Xcode 4 template called embedXcode. Apparently it supports many platforms and boards, including AVR-based Arduino, AVR-based Wiring, PIC32-based chipKIT, MSP430-based LaunchPad and ARM3-based Maple.