2012-03-10 14:25:42 +01:00
# A Makefile for Arduino Sketches
2012-07-06 08:42:43 +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
Until March 2012, this was simply posted on my website where you can
2012-07-06 08:42:43 +02:00
still find [what documentation](http://mjo.tc/atelier/2009/02/arduino-cli.html
2012-03-10 14:25:42 +01:00
"Documentation") exists.
2012-04-29 19:55:17 +02:00
If you're using Debian or Ubuntu, you can find this in the
2012-05-06 15:20:59 +02:00
arduino-mk package.
2012-04-29 19:55:17 +02:00
# Important Changes, 2012-04-29
I've rejigged the path calculations so that:
1. Few, if any paths, need to specified in the project specific Makefiles.
1. The paths can be grabber from the environment e.g. set up in a user's .bashrc.
1. It should be easier to move between e.g. Mac and Linux.
I'm indebted to Christopher Peplin for making me think about this, and indeed for
contributing code which did similar things in different ways.
The upshot of all this is that you'll need to set up some variables if you want
this to work:
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. On Debian or
Ubuntu do
2012-05-05 10:24:31 +02:00
apt-get install libdevice-serialport-perl libconfig-yaml-perl
2012-04-29 19:55:17 +02:00
On other systems
cpanm Device::SerialPort
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
set the `ARDUNIO_SKETCHBOOK` variable to point to this directory. By default it
is set to `$HOME/sketchbook` .
2012-07-06 08:42:43 +02:00
## Notes from Sudar
2012-07-06 12:33:32 +02:00
The following are the list of changes that I have made or merged in this fork. Hopefully it gets into mjoldfield repo and ultimately into Ubuntu package one day :)
2012-07-06 08:42:43 +02:00
### 0.9.1 06.vi.2012
2012-07-06 12:33:32 +02:00
- Corrected the ubuntu package names
- Prevent the *file-not-found* error if the depends.mk file is not needed
- Delete the build-cli folder as well while doing make clean
- Added support for compiling .pde files in Arduino 1.0 environment
- Replaced = with += in CPPFLAGS assignment so that we can set CPPFLAGS per sketch if needed
- Changed AVRDUDE_CONF so it can be defined in per-project makefile (https://github.com/WizenedEE)
- Cleaner way to delete the build-cli directory when make clean is invoked
- The package name in Debian and Ubuntu is arduino-mk (https://github.com/maqifrnswa)
2012-07-06 08:42:43 +02:00
2012-07-06 12:33:32 +02:00
### 0.9.2 06.vi.2012
- Allow user to choose source files (LOCAL_*_SRCS flags) (https://github.com/Gaftech)
2012-07-15 09:55:45 +02:00
- Modified "make size" behavior: using --mcu option and targeting .elf file instead of .hex file.(https://github.com/Gaftech)
2012-07-13 19:22:27 +02:00
### 0.9.3 13.vi.2012
2012-07-15 09:55:45 +02:00
- Auto detect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
2012-07-13 19:22:27 +02:00
- Categorize libs into user and system (https://github.com/rpavlik/)
- Dump size at the end of the build (https://github.com/rpavlik/)
- Lots and lots of improvements (https://github.com/rpavlik/)
2012-07-13 19:26:48 +02:00
- Changed bytes option for the head shell command, so that it works in Mac as well
2012-07-15 09:55:45 +02:00
- Auto detect Serial Baud rate from sketch if possible
2012-08-20 10:29:58 +02:00
### 0.9.3.1 18.viii.2012 jeffkowalski
- Autodetect ARDUINO_LIBS from includes in LOCAL_SRCS
- Autodetect ARDUINO_SKETCHBOOK from file set by Arduino IDE
- Autodetect ARDMK_DIR based on location of this file
- Added support for utility directory within SYS and USER libraries
2012-07-15 09:55:45 +02:00
## Know Issues
- Because of the way the makefile is structured, the configuration parameters gets printed twice.