Browse Source

Squashed 'vendor/arduino-mk/' content from commit 11c9341

git-subtree-dir: vendor/arduino-mk
git-subtree-split: 11c9341692
master
Peter J. Jones 5 years ago
commit
c683564201
42 changed files with 4521 additions and 0 deletions
  1. 3
    0
      .gitignore
  2. 1327
    0
      Arduino.mk
  3. 35
    0
      CONTRIBUTING.md
  4. 46
    0
      Common.mk
  5. 233
    0
      HISTORY.md
  6. 217
    0
      README.md
  7. 48
    0
      ard-reset-arduino.1
  8. 1101
    0
      arduino-mk-vars.md
  9. 38
    0
      bin/ard-reset-arduino
  10. 115
    0
      chipKIT.mk
  11. 1
    0
      examples/.gitignore
  12. 23
    0
      examples/ATtinyBlink/ATtinyBlink.ino
  13. 13
    0
      examples/ATtinyBlink/Makefile
  14. 53
    0
      examples/AnalogInOutSerial/AnalogInOutSerial.ino
  15. 4
    0
      examples/AnalogInOutSerial/Makefile
  16. 19
    0
      examples/Blink/Blink.ino
  17. 5
    0
      examples/Blink/Makefile
  18. 19
    0
      examples/BlinkChipKIT/BlinkChipKIT.pde
  19. 5
    0
      examples/BlinkChipKIT/Makefile
  20. 16
    0
      examples/BlinkInAVRC/Makefile
  21. 38
    0
      examples/BlinkInAVRC/blink.c
  22. 65
    0
      examples/BlinkWithoutDelay/BlinkWithoutDelay.ino
  23. 4
    0
      examples/BlinkWithoutDelay/Makefile
  24. 31
    0
      examples/Fade/Fade.ino
  25. 4
    0
      examples/Fade/Makefile
  26. 58
    0
      examples/HelloWorld/HelloWorld.ino
  27. 4
    0
      examples/HelloWorld/Makefile
  28. 55
    0
      examples/MakefileExample/Makefile-example.mk
  29. 7
    0
      examples/README.md
  30. 14
    0
      examples/TinySoftWareSerial/Makefile
  31. 12
    0
      examples/TinySoftWareSerial/TinySoftwareSerial.ino
  32. 6
    0
      examples/WebServer/Makefile
  33. 82
    0
      examples/WebServer/WebServer.ino
  34. 6
    0
      examples/master_reader/Makefile
  35. 32
    0
      examples/master_reader/master_reader.ino
  36. 4
    0
      examples/toneMelody/Makefile
  37. 95
    0
      examples/toneMelody/pitches.h
  38. 49
    0
      examples/toneMelody/toneMelody.ino
  39. 502
    0
      licence.txt
  40. 23
    0
      packaging/debian/README.md
  41. 39
    0
      packaging/fedora/README.md
  42. 70
    0
      packaging/fedora/arduino-mk.spec

+ 3
- 0
.gitignore View File

@@ -0,0 +1,3 @@
*.o
build-cli
/.project

+ 1327
- 0
Arduino.mk
File diff suppressed because it is too large
View File


+ 35
- 0
CONTRIBUTING.md View File

@@ -0,0 +1,35 @@
# Contributing To Arduino Makefile

Community made patches, localizations, bug reports, documentation and contributions are always welcome and are crucial to the success of this project.

When contributing please ensure you follow the guidelines below so that we can keep on top of things.

## Getting Started

Submit a ticket for your issue, assuming one does not already exist.

- Raise it on our [Issue Tracker](https://github.com/sudar/Arduino-Makefile/issues)
- Clearly describe the issue including steps to reproduce the bug.
- Make sure you fill in the earliest version that you know has the issue as well as the following
- Your operating system (Mac, Linux/Unix, Windows)
- Your Arduino IDE version
- Snippet of your makefile

## Making Changes

- Fork the repository on GitHub
- Make the changes to your forked repository
- Update the [changelog file](HISTORY.md) and add a note about your change. If possible prefix it with either Fix, Tweak or New
- If you are adding or changing the behavior of any variable, then update the corresponding documentation in the [arduino-mk-vars.md](arduino-mk-vars.md) file as well
- When committing, reference your issue (if present) and include a note about the fix
- If possible (and if makes sense) do atomic commits
- Try to follow [this guideline](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) while choosing the git commit message
- Push the changes to your fork and submit a pull request to the 'master' branch of the this repository

At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.

# Additional Resources

- [General GitHub Documentation](http://help.github.com/)
- [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/)
- [Guide about contributing code in GitHub](http://sudarmuthu.com/blog/contributing-to-project-hosted-in-github)

+ 46
- 0
Common.mk View File

@@ -0,0 +1,46 @@
# Useful functions
# Returns the first argument (typically a directory), if the file or directory
# named by concatenating the first and optionally second argument
# (directory and optional filename) exists
dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))

# Run a shell script if it exists. Stops make on error.
runscript_if_exists = \
$(if $(wildcard $(1)), \
$(if $(findstring 0, \
$(lastword $(shell $(abspath $(wildcard $(1))); echo $$?))), \
$(info Info: $(1) success), \
$(error ERROR: $(1) failed)))

# For message printing: pad the right side of the first argument with spaces to
# the number of bytes indicated by the second argument.
space_pad_to = $(shell echo $(1) " " | head -c$(2))

# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
show_config_info = $(call arduino_output,- $(call space_pad_to,$(2),20) $(1))

# Call with the name of the variable, a prefix tag if desired (like [AUTODETECTED]),
# and an explanation if desired (like (found in $$PATH)
show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2))

# Just a nice simple visual separator
show_separator = $(call arduino_output,-------------------------)

$(call show_separator)
$(call arduino_output,Arduino.mk Configuration:)

########################################################################
#
# Detect OS
ifeq ($(OS),Windows_NT)
CURRENT_OS = WINDOWS
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CURRENT_OS = LINUX
endif
ifeq ($(UNAME_S),Darwin)
CURRENT_OS = MAC
endif
endif
$(call show_config_variable,CURRENT_OS,[AUTODETECTED])

+ 233
- 0
HISTORY.md View File

@@ -0,0 +1,233 @@
A Makefile for Arduino Sketches
===============================

The following is the rough list of changes that went into different versions.
I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.

### 1.3.4 (2014-07-12)
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)
- Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers)
- Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz)
- Fix: Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path. (Issue #201 and #202) (https://github.com/sej7278)
- Add: List board name as well as tag in `make show_boards`. (Issue #204) (https://github.com/sej7278)
- Fix: Add missing newlines at end of some echo's (Issue #207) (https://github.com/sej7278)
- Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278)
- New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic)
- Fix: MONITOR_PORT detection (Issue #213, #215) (https://github.com/sej7278)
- Tweak: Audited regexes/quoting/wildcards (Issue #192) (https://github.com/sej7278)
- New: Build core objects in subdirectory (Issue #82) (https://github.com/sej7278)

### 1.3.3 (2014-04-12)
- Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278)

### 1.3.2 (2014-04-11)
- Fix: Add arduino-mk-vars.md file to RPM SPECfile. (https://github.com/sej7278)
- Fix: Add avr-libc/malloc.c and realloc.c to included core files. Fixes issue #163 (https://github.com/sej7278)
- Fix: Add "gpio" to the list of isp that don't have a port. (Issue #165, #166) (https://github.com/sej7278)
- Fix: Add "-D__PROG_TYPES_COMPAT__" to the avr-g++ compiler flags to match IDE. (https://github.com/sej7278)
- New: Create `Makefile-example-mk`, a *real life* `Makefile` example, to be used as a reference. (https://github.com/tinyladi)
- Tweak: Add `OBJDIR` to `arduino-mk-vars.md` (https://github.com/tinyladi)
- Tweak: *Beautify* `arduino-mk-vars.md` with code blocks. (https://github.com/tinyladi)
- Fix: AVR tools paths for chipKIT in Linux. (https://github.com/peplin)
- Fix: Consider usb or usb:... to be a valid ISP_PORT (https://github.com/geoffholden)
- Add: Add phony target to run pre-build hook script (https://github.com/jrid)
- Fix: Add BOOTLOADER_PARENT to `arduino-mk-vars.md` and fixed BOOTLOADER_PATH example. (https://github.com/sej7278)
- Tweak: Replace perl reset script with Python script. (https://github.com/sej7278)
- Tweak: Made choice of Python2/3 interpreter up to the OS. (https://github.com/peplin)
- Tweak: Simplified packaging dependencies. (https://github.com/sej7278)
- Tweak: Tweak AVRDUDE conf detection in windows. (https://github.com/EAGMnor)

### 1.3.1 (2014-02-04)
- Fix: BUNDLED_AVR_TOOLS_DIR is now set properly when using only arduino-core and not the whole arduino package. (https://github.com/sej7278)
- New: Document all variables that can be overridden. (https://github.com/sej7278)
- New: Add a new `help_vars` target to display information about variables that can be overridden.

### 1.3.0 (2014-01-29)
- Fix: Use more reliable serial device naming in Windows. Fix issue #139 and #155 (https://github.com/peplin)
- Fix: Document that ARDUINO_DIR must be a relative path in Windows. Fix issue #156 (https://github.com/peplin)
- Tweak: Don't hard code MONITOR_PORT in examples, for more flexible testing. (Issue #157) (https://github.com/peplin)
- Tweak: Silence the stderr output from call to `which`. (Issue #158) (https://github.com/peplin)
- Fix: Override complete compiler tool paths for chipKIT. (Issue #159) (https://github.com/peplin)
- New: The makefile is compatible with Windows
- New: Update `README.md` file about usage and Windows compatibility

### 1.2.0 (2014-01-14)
- Add: Add RPM SPECfile and new `package` directory to store package instructions and files (https://github.com/sej7278)
- Fix: Remove use of arduino-mk subdirectory in git. Fix issue #151, #152 and #147 (https://github.com/sej7278)
- Fix: Remove `arduino-mk` directory from all examples. Fix #154

### 1.1.0 (2013-12-26)
- Don't append port details to avrdude for usbasp. See #123
- Ignore commented lines while parsing boards.txt file. See #124
- In ISP mode, read baudrate and programmer from boards.txt. See #125
- Add `burn_bootloader` target. See #85
- Show correct path to `arduino.mk` file in help message. Fix #120
- Change echo for printf. Fix #129 (https://github.com/thomassigurdsen)
- Add support for ChipKiT 2013. Fix #136 (https://github.com/peplin)
- Auto detect and include libraries specified in `USER_LIB_PATH`. Fix #135 (https://github.com/tinyladi)
- Use `MAKEFILE_LIST` to get the name of the make file. Fix #130 (https://github.com/cantora)
- New: Add option to set fuses without burning a bootloader. Fix #141 (https://github.com/sej7278)
- Tweak: Don't append port details to avrdude for usbtiny. Fix #140 and #138 (https://github.com/PPvG)
- Fix: Handle relative paths of bootloader file while burning bootloaders. Fix #126 and #142 (https://github.com/sej7278)
- New: Add `CONTRIBUTING.md` explaining how to contribute to the project.
- New: Force -Os optimization for SoftwareSerial. Add `OPTIMIZATION_FLAGS` and `DEBUG_FLAGS`. (https://github.com/mahoy)
- Fix: Use `ARDUINO_HEADER` variable instead of hardcoded file names. Fix #131

### 1.0.1 (2013-09-25)
- Unconditionally add -D in avrdude options. See #114

### 1.0.0 (2013-09-22)
- Add $OBJDIR to the list of configuration that gets printed. Fix issue #77
- Add support for specifying optimization level. Fix issue #81
- Add support for reseting "Micro" Arduino. Fix issue #80 (https://github.com/sej7278)
- Remove "utility" from example makefiles. Fix issue #84
- Auto detect alternate core path from sketchbook folder. Fix issue #86
- Remove redundant checks for ARDUINO_DIR
- Improve avrdude and avrdude.conf path auto detection. Fix issue #48
- Move binary sketch size verification logic inside makefile. Fix issue #54
- Remove dependency on wait-connection-leonardo shell script. Fix issue #95
- Add support for the Digilent chipKIT platform. (https://github.com/peplin)
- Implement ard-parse-boards with shell scripting instead of Perl (https://github.com/peplin)
- Compile with debugging symbols only when DEBUG=1 (https://github.com/peplin)
- Replace Leonardo detection with Caterina detection (https://github.com/sej7278)
- Autodetect baudrate only if either a .ino/.pde is present
- Allow building with Arduino core, without a .ino/.pde file
- Ability to support different Arduino cores (https://github.com/sej7278)

### 0.12.0 (2013-06-20)
- Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman)
- Deprecate "generated_assembly" target in favour of "generate_assembly". Fix issue #79

### 0.11.0 (2013-06-15)
- Replace hardcoded executables with variable
- Fix whitespace issues
- Add a warning when HEX_MAXIMUM_SIZE is not specified
- Add the ability to configure avrdude options. Fix issue #53
- Handle cases where certain fuse bits are not present. Fix issue #61
- Add support for compiling plain AVR C files. Fix issue #63
- Add an example to show how to compile AVR C files. Fix issue #73

### 0.10.6 (2013-06-14)
- Fix whitespace and add /dev/null redirection (https://github.com/sej7278)
- Change the way AUTO_ARDUINO_VERSION is computed (https://github.com/sej7278)
- Make serial monitor baudrate detection work in Mac as well(https://github.com/sej7278)
- Fix directory creation for library source files (https://github.com/matthijskooijman)
- Rewrite ard-leonardo-reset script in perl (https://github.com/sej7278)

### 0.10.5 (2013-06-11)
- Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo.
- Allow adding extra common dependencies (COMMON_DEPS) (https://github.com/gaftech)
- Added ifndef ARDUINO_VAR_PATH for compiling for the attiny (https://github.com/danielesteban)
- Strip extra whitespace from the `BOARD_TAG` variable
- Enhanced support for programming using Arduino as ISP
- Added example to show how to program using Arduino as ISP
- Add support for Leonardo boards. Took code from (https://github.com/guicho271828)

### 0.10.4 (2013-05-31) @matthijskooijman
- Improved BAUD_RATE detection logic
- Added logic to check if there is only .ino or .pde file
- Compile .ino/.pde files directly
- Output configuration only once
- Try to read Version.txt file only if it is present
- Refactored dependency code

### 0.10.3 16.xii 2012 gaftech
- Enabling creation of EEPROM file (.eep)
- EEPROM upload: eeprom and raw_eeprom targets
- Auto EEPROM upload with isp mode: ISP_EEPROM option.
- Allow custom OBJDIR

### 0.10.2 15.xii.2012 Sudar
- Added sketch size verification. (https://github.com/fornellas)
- Show original line number for error messages (https://github.com/WizenedEE)
- Removed -w from CPPFLAGS to show warnings (https://github.com/gaftech)
- Changed shebang to use /usr/bin/env (https://github.com/anm)
- set USB_VID and USB_PID only for leonardo boards(https://github.com/alohr)
- Updated Readme (https://github.com/fr0sty1/)

### 0.10.1 15.xii.2012 Sudar
- Merged all changes from Upstream and the following changes from https://github.com/rpavlik
- Allow passing extra flags
- Make listing files more useful
- Add knowledge of device-specific assembler
- Use variables instead of hardcoded commands
- Make disasm more helpful
- Change .sym output
- Provide symbol_sizes and generated_assembly targets.
- Be able to silence configuration output
- Make everybody depend on the makefile, in case cflags are changed, etc.
- Make the makefile error if the arduino port is not present.

### 0.10 17.ix.12 M J Oldfield
- Added installation notes for Fedora (ex Rickard Lindberg).
- Changed size target so that it looks at the ELF object,
not the hexfile (ex Jared Szechy and Scott Howard).
- Fixed ARDUNIO typo in README.md (ex Kalin Kozhuharov).
- Tweaked OBJDIR handling (ex Matthias Urlichs and Scott Howard).
- Changed the name of the Debian/Ubuntu package (ex
Scott Howard).
- Only set AVRDUDE_CONF if it's not set (ex Tom Hall).
- Added support for USB_PID/VID used by the Leonardo (ex Dan
Villiom Podlaski Christiansen and Marc Plano-Lesay).

### 0.9.3.2 10.ix.2012 Sudar
- Fixed a typo in README. Issue reported at upstream (https://github.com/mjoldfield/Arduino-Makefile/issues/21)

### 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

### 0.9.3 13.vi.2012

- Auto detect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
- 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/)
- Changed bytes option for the head shell command, so that it works in Mac as well
- Auto detect Serial Baud rate from sketch if possible

### 0.9.2 06.vi.2012

- Allow user to choose source files (LOCAL_*_SRCS flags) (https://github.com/Gaftech)
- Modified "make size" behavior: using --mcu option and targeting .elf file instead of .hex file.(https://github.com/Gaftech)

### 0.9.1 06.vi.2012

- 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-02-12, version 0.8
- Patches for version 1.0 of the Arduino IDE. Older versions might still work, but I’ve not tested it.
- A change to the build process: rather than link all the system objects directly into the executable, bundle them in a library first. This should make the final executable smaller.
- If TARGET isn’t explicitly set, default to the current directory name. Thanks to Daniele Vergini for this patch.
- Add support for .c files in system libraries: Dirk-Willem van Gulik and Evan Goldenberg both reported this and provided patches in the same spirit.
- Added a size target as suggested by Alex Satrapa.

### Unreleased, version 0.7
- Added -lm to the linker options, and -F to stty.

### 2011-06-23, version 0.6
- Added ard-parse-boards. Mark Sproul suggested doing something like this ages ago, but I’ve only recently looked at it in detail.
- Fabien Le Lez reported that one needs to link with -lc to avoid [linker errors](http://forum.arduino.cc/index.php/topic,40215.0.html).

### 2011-06-23, version 0.5
- Imported changes from Debian/Ubuntu, which incorporate a patch from Stefan Tomanek so that libraries would be compiled too.

Note: Many other people sent me similar patches, but I didn't get around to using them. In the end, I took the patch from Debian and Ubuntu: there seems merit in not forking the code and using a tested version. So, thanks and apologies to Nick Andrew, Leandro Coletto Biazon, Thibaud Chupin, Craig Hollabaugh, Johannes H. Jensen, Fabien Le Lez, Craig Leres, and Mark Sproul.

### 2010-05-24, version 0.4
Tweaked rules for the reset target on Philip Hands’ advice.

### 2010-05-21, version 0.3
- Tidied up the licensing, making it clear that it’s released under LGPL 2.1.
- [Philip Hands](http://hands.com/~phil/) sent me some code to reset the Arduino by dropping DTR for 100ms, and I added it.
- Tweaked the Makefile to handle version 0018 of the Arduino software which now includes main.cpp. Accordingly we don’t need to—and indeed must not—add main.cxx to the .pde sketch file. The paths seem to have changed a bit too.

+ 217
- 0
README.md View File

@@ -0,0 +1,217 @@
# A Makefile for Arduino Sketches

This is a very simple Makefile which knows how to build Arduino sketches. It defines 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.

## Features

- Very robust
- Highly customizable
- Supports all official AVR-based Arduino boards
- Supports chipKIT
- Works on all three major OS (Mac, Linux, Windows)
- Auto detects serial baud rate and libraries used
- Support for `*.ino` and `*.pde` sketches as well as raw `*.c` and `*.cpp`
- Support for Arduino Software versions 1.0.x as well as 0.x.
Support for Arduino 1.5.x is still work in progress
- Automatic dependency tracking. Referred libraries are automatically included
in the build process. Changes in `*.h` files lead to recompilation of sources which include them

## Installation

### Through package

If you're using FreeBSD, Debian or Ubuntu, you can find this in the `arduino-mk`
package which can be installed using `apt-get` or `aptitude`.

### From source

- Download the latest release
- Or clone it from Github using the command `git clone git@github.com:sudar/Arduino-Makefile.git`
- Check the [usage section](https://github.com/sudar/Arduino-Makefile#usage) in this readme about setting usage options

## Requirements

You need to have the Arduino IDE. You can either install it through the
installer or download the distribution zip file and extract it.

The Makefile also delegates resetting the board to a short Python program.
You'll need to install `pySerial` to use it though.

On Debian or Ubuntu:

apt-get install python-serial

On Fedora:

yum install pyserial

On openSUSE:

zypper install python-serial

On Mac using MacPorts:

sudo port install py27-serial

On Windows:

You need to install Cygwin and its packages for Make, Perl and the following Serial library.

pySerial can be downloaded from PyPi

On other systems:

pip install pyserial

or

easy_install -U pyserial

## Usage

You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile).

You can also checkout the sample makefiles inside the `examples/` directory, e.g. [Makefile-example](examples/MakefileExample/Makefile-example.mk).

Download a copy of this repo some where in your system or install it through a package.

On the Mac you might want to set:

ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
ARDMK_DIR = /usr/local
AVR_TOOLS_DIR = /usr
MONITOR_PORT = /dev/ttyACM0
BOARD_TAG = mega2560

On Linux (if you have installed through package), you shouldn't need to set anything other than your board type and port:

BOARD_TAG = mega2560
MONITOR_PORT = /dev/ttyACM0

On Windows (using cygwin), you might want to set:

ARDUINO_DIR = ../../arduino
ARDMK_DIR = path/to/mkfile
MONITOR_PORT = com3
BOARD_TAG = mega2560

It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows. For example, if your your Arduino directory is in:

c:\Program Files (x86)\Arduino

You will get problems with the special characters on the directory name. More details about this can be found in [issue #94](https://github.com/sudar/Arduino-Makefile/issues/94)

To create a symbolic link, you can use the command “mklink” on Windows, e.g.

mklink /d c:\Arduino c:\Program Files (x86)\Arduino

After which, the variables should be:

ARDUINO_DIR=../../../../../Arduino

Instead of:

ARDUINO_DIR=../../../../../Program\ Files\ \(x86\)/Arduino



- `BOARD_TAG` - Type of board, for a list see boards.txt or `make show_boards`
- `MONITOR_PORT` - The port where your Arduino is plugged in, usually `/dev/ttyACM0` or `/dev/ttyUSB0` in Linux or Mac OS X and `com3`, `com4`, etc. in Windows.
- `ARDUINO_DIR` - Path to Arduino installation. In Cygwin in Windows this path must be
relative, not absolute (e.g. "../../arduino" and not "/c/cygwin/Arduino").
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`
- `AVR_TOOLS_DIR` - Path where the avr tools chain binaries are present. If you are going to use the binaries that came with Arduino installation, then you don't have to set it. Otherwise set it realtive and not absolute.

The list of all variables that can be overridden is available at [arduino-mk-vars.md](arduino-mk-vars.md) file.

## Including Libraries

You can specify space separated list of libraries that are needed for your sketch to the variable `ARDUINO_LIBS`.

`ARDUINO_LIBS = Wire SoftwareSerial`

The libraries will be searched in the following places in the following order.

- `/libraries` directory inside your sketchbook directory. Sketchbook directory will be auto detected from your Arduino preference file. You can also manually set it through `ARDUINO_SKETCHBOOK`.
- `/libraries` directory inside your Arduino directory, which is read from `ARDUINO_DIR`.

The libraries inside user directories will take precedence over libraries present in Arduino core directory.

The makefile can autodetect the libraries that are included from your sketch and can include them automatically. But it can't detect libraries that are included from other libraries. (see [issue #93](https://github.com/sudar/Arduino-Makefile/issues/93))

## avrdude

To upload compiled files, `avrdude` is used. This Makefile tries to find `avrdude` and it's config (`avrdude.conf`) below `ARDUINO_DIR`. If you like to use the one installed on your system instead of the one which came with Arduino, you can try to set the variables `AVRDUDE` and `AVRDUDE_CONF`. On a typical Linux system these could be set to

AVRDDUDE = /usr/bin/avrdude
AVRDUDE_CONF = /etc/avrdude.conf

## Colorgcc

It is possible to use [`colorgcc`](https://github.com/colorgcc/colorgcc) with this makefile. Check out [this comment](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile#comment-1408) to find usage instructions.

## Emacs/Flymake support

On-the-fly syntax checking in Emacs using the [Flymake](http://www.emacswiki.org/emacs/FlyMake) minor mode is now possible.

First, the flymake mode must be configured to recognize ino files :

Edit the flymake configuration :

```
M-x customize-option RET
flymake-allowed-file-name-masks RET
```

Add the line :

```
("\\.ino\\'" flymake-simple-make-init)
```

Then click on "Apply and Save" button

Then, the following line must be added to the project Makefile :

```
check-syntax:
$(CXX_NAME) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES)
```

## Versioning

The current version of the makefile is `1.3.4`. You can find the full history in the [HISTORY.md](HISTORY.md) file

This project adheres to Semantic [Versioning 2.0](http://semver.org/).

## License

This makefile and the related documentation and examples are free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

## Contribution

All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
Also checkout the [contribution guide](CONTRIBUTING.md) for more details.

If you are looking for ideas to work on, then check out the following TODO items or the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/).

## Limitations / Know Issues / TODO's

- Doesn't work with Arduino 1.5.x yet. Follow [issue #45](https://github.com/sudar/Arduino-Makefile/issues/45) for progress.
- Since it doesn't do any pre processing like Arduino IDE, you have to declare all methods before you use them ([issue #59](https://github.com/sudar/Arduino-Makefile/issues/59))
- More than one .ino or .pde file is not supported yet ([issue #49](https://github.com/sudar/Arduino-Makefile/issues/49))
- When you compile for the first time, it builds all libs inside Arduino directory even if it is not needed. But while linking only the relevant files are linked. ([issue #29](https://github.com/sudar/Arduino-Makefile/issues/29)). Even Arduino IDE does the same thing though.

If you find an issue or have an idea for a feature then log them in the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/)

## Credits

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/tutorials/compiling-arduino-sketches-using-makefile)

## 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.

+ 48
- 0
ard-reset-arduino.1 View File

@@ -0,0 +1,48 @@
.TH ARD-RESET-ARDUINO "1" "April 2014" "ard-reset-arduino 1.3.4" "Arduino CLI Reset"

.SH NAME
ard-reset-arduino - Reset Arduino board

.SH SYNOPSIS
.B ard-reset-arduino
[OPTION]... [PORT]

.SH DESCRIPTION
To reset Arduinos, we either pulse the DTR line or open the USB port
at 1200 baud and close it again.

.SH OPTIONS
.B \-\-verbose
Watch what's going on on STDERR.

.B \-\-period
Specify the DTR pulse width in seconds.

.B \-\-caterina
Reset a Leonardo, Micro, Robot, LilyPadUSB or similar 32u4-based device.

.SH EXAMPLES
ard-reset-arduino /dev/ttyACM0
.PP
ard-reset-arduino \-\-verbose \-\-period=0.1 /dev/cu.usb*
.PP
ard-reset-arduino \-\-verbose \-\-caterina /dev/ttyUSB0

.SH BUGS
There are no known bugs in this application. Please report problems
to the author. Patches are welcome.

.SH AUTHOR
Simon John, git@the-jedi.co.uk

.SH LICENSE
Copyright (c) 2014, Simon John. All rights reserved.
.PP
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
.PP
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ 1101
- 0
arduino-mk-vars.md
File diff suppressed because it is too large
View File


+ 38
- 0
bin/ard-reset-arduino View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python

from __future__ import print_function
import serial
import os.path
import argparse
from time import sleep

parser = argparse.ArgumentParser(description='Reset an Arduino')
parser.add_argument('--caterina', action='store_true', help='Reset a Leonardo, Micro, Robot or LilyPadUSB.')
parser.add_argument('--verbose', action='store_true', help="Watch what's going on on STDERR.")
parser.add_argument('--period', default=0.1, help='Specify the DTR pulse width in seconds.')
parser.add_argument('port', nargs=1, help='Serial device e.g. /dev/ttyACM0')
args = parser.parse_args()

if args.caterina:
if args.verbose: print('Forcing reset using 1200bps open/close on port %s' % args.port[0])
ser = serial.Serial(args.port[0], 57600)
ser.close()
ser.open()
ser.close()
ser.setBaudrate(1200)
ser.open()
ser.close()
sleep(1)

while not os.path.exists(args.port[0]):
if args.verbose: print('Waiting for %s to come back' % args.port[0])
sleep(1)

if args.verbose: print('%s has come back after reset' % args.port[0])
else:
if args.verbose: print('Setting DTR high on %s for %ss' % (args.port[0],args.period))
ser = serial.Serial(args.port[0], 115200)
ser.setDTR(False)
sleep(args.period)
ser.setDTR(True)
ser.close()

+ 115
- 0
chipKIT.mk View File

@@ -0,0 +1,115 @@
#
# chipKIT extensions for Arduino Makefile
# System part (i.e. project independent)
#
# Copyright (C) 2011, 2012, 2013 Christopher Peplin
# <chris.peplin@rhubarbtech.com>, based on work that is Copyright Martin
# Oldfield
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# Modified by John Wallbank for Visual Studio
#
# Development changes, John Wallbank,
#
# - made inclusion of WProgram.h optional so that
# including it in the source doesn't mess up compile error line numbers
# - parameterised the routine used to reset the serial port
#

########################################################################
# Makefile distribution path
#

# The show_config_variable is unavailable before we include the common makefile,
# so we defer logging the ARDMK_DIR info until it happens in Arduino.mk
ifndef ARDMK_DIR
# presume it's the same path to our own file
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
endif

include $(ARDMK_DIR)/Common.mk

ifndef MPIDE_DIR
AUTO_MPIDE_DIR := $(firstword \
$(call dir_if_exists,/usr/share/mpide) \
$(call dir_if_exists,/Applications/Mpide.app/Contents/Resources/Java) )
ifdef AUTO_MPIDE_DIR
MPIDE_DIR = $(AUTO_MPIDE_DIR)
$(call show_config_variable,MPIDE_DIR,[autodetected])
else
echo $(error "mpide_dir is not defined")
endif
else
$(call show_config_variable,MPIDE_DIR,[USER])
endif

ifeq ($(CURRENT_OS),WINDOWS)
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),)
echo $(error On Windows, MPIDE_DIR must be a relative path)
endif
endif

ifndef MPIDE_PREFERENCES_PATH
AUTO_MPIDE_PREFERENCES_PATH := $(firstword \
$(call dir_if_exists,$(HOME)/.mpide/preferences.txt) \
$(call dir_if_exists,$(HOME)/Library/Mpide/preferences.txt) )
ifdef AUTO_MPIDE_PREFERENCES_PATH
MPIDE_PREFERENCES_PATH = $(AUTO_MPIDE_PREFERENCES_PATH)
$(call show_config_variable,MPIDE_PREFERENCES_PATH,[autodetected])
endif
endif

# The same as in Arduino, the Linux distribution contains avrdude and #
# avrdude.conf in a different location, but for chipKIT it's even slightly
# different than the Linux paths for Arduino, so we have to "double override".
ifeq ($(CURRENT_OS),LINUX)
AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools
AVRDUDE = $(AVRDUDE_DIR)/avrdude
AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf
endif

PIC32_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools
PIC32_TOOLS_PATH = $(PIC32_TOOLS_DIR)/bin

ALTERNATE_CORE = pic32
ALTERNATE_CORE_PATH = $(MPIDE_DIR)/hardware/pic32
ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(ALTERNATE_CORE)
ARDUINO_PREFERENCES_PATH = $(MPIDE_PREFERENCES_PATH)
ARDUINO_DIR = $(MPIDE_DIR)

CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S

ARDUINO_VERSION = 23

CC_NAME = pic32-gcc
CXX_NAME = pic32-g++
AR_NAME = pic32-ar
OBJDUMP_NAME = pic32-objdump
OBJCOPY_NAME = pic32-objcopy
SIZE_NAME = pic32-size
NM_NAME = pic32-nm

OVERRIDE_EXECUTABLES = 1
CC = $(PIC32_TOOLS_PATH)/$(CC_NAME)
CXX = $(PIC32_TOOLS_PATH)/$(CXX_NAME)
AS = $(PIC32_TOOLS_PATH)/$(AS_NAME)
OBJCOPY = $(PIC32_TOOLS_PATH)/$(OBJCOPY_NAME)
OBJDUMP = $(PIC32_TOOLS_PATH)/$(OBJDUMP_NAME)
AR = $(PIC32_TOOLS_PATH)/$(AR_NAME)
SIZE = $(PIC32_TOOLS_PATH)/$(SIZE_NAME)
NM = $(PIC32_TOOLS_PATH)/$(NM_NAME)

LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript)
LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT)

MCU_FLAG_NAME=mprocessor
LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(LDSCRIPT)
LDFLAGS += -T$(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld
CPPFLAGS += -mno-smart-io -fno-short-double
CFLAGS_STD =

include $(ARDMK_DIR)/Arduino.mk

+ 1
- 0
examples/.gitignore View File

@@ -0,0 +1 @@
build-*

+ 23
- 0
examples/ATtinyBlink/ATtinyBlink.ino View File

@@ -0,0 +1,23 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Connect a LED to Pin 3. It might be different in different ATtiny micro controllers
int led = 3;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

+ 13
- 0
examples/ATtinyBlink/Makefile View File

@@ -0,0 +1,13 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile

# if you have placed the alternate core in your sketchbook directory, then you can just mention the core name alone.
ALTERNATE_CORE = attiny
# If not, you might have to include the full path.
#ALTERNATE_CORE_PATH = /home/sudar/Dropbox/code/arduino-sketches/hardware/attiny/

BOARD_TAG = attiny85-8
ISP_PORT = /dev/ttyACM*

include $(ARDMK_DIR)/Arduino.mk

# !!! Important. You have to use make ispload to upload when using ISP programmer

+ 53
- 0
examples/AnalogInOutSerial/AnalogInOutSerial.ino View File

@@ -0,0 +1,53 @@
/*
Analog input, analog output, serial output
Reads an analog input pin, maps the result to a range from 0 to 255
and uses the result to set the pulsewidth modulation (PWM) of an output pin.
Also prints the results to the serial monitor.
The circuit:
* potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the analog pin.
side pins of the potentiometer go to +5V and ground
* LED connected from digital pin 9 to ground
created 29 Dec. 2008
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
*/

// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);

// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);

// wait 10 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(10);
}

+ 4
- 0
examples/AnalogInOutSerial/Makefile View File

@@ -0,0 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =

include ../../Arduino.mk

+ 19
- 0
examples/Blink/Blink.ino View File

@@ -0,0 +1,19 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}

+ 5
- 0
examples/Blink/Makefile View File

@@ -0,0 +1,5 @@
BOARD_TAG = uno
ARDUINO_LIBS =

include ../../Arduino.mk


+ 19
- 0
examples/BlinkChipKIT/BlinkChipKIT.pde View File

@@ -0,0 +1,19 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}

+ 5
- 0
examples/BlinkChipKIT/Makefile View File

@@ -0,0 +1,5 @@
BOARD_TAG = mega_pic32
ARDUINO_LIBS =

include ../../chipKIT.mk


+ 16
- 0
examples/BlinkInAVRC/Makefile View File

@@ -0,0 +1,16 @@
# This sample Makefile, explains how you can compile plain AVR C file.
#
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile

NO_CORE = Yes

BOARD_TAG = atmega16
MCU = atmega16
F_CPU = 8000000L

ISP_PROG = stk500v1
AVRDUDE_ISP_BAUDRATE = 19200

include $(ARDMK_DIR)/Arduino.mk

# !!! Important. You have to use make ispload to upload when using ISP programmer

+ 38
- 0
examples/BlinkInAVRC/blink.c View File

@@ -0,0 +1,38 @@
/*
* © Anil Kumar Pugalia, 2010. Email: email@sarika-pugs.com
*
* ATmega48/88/168, ATmega16/32
*
* Example Blink. Toggles all IO pins at 1Hz
*/

#include <avr/io.h>
#include <util/delay.h>

void init_io(void)
{
// 1 = output, 0 = input
DDRB = 0b11111111; // All outputs
DDRC = 0b11111111; // All outputs
DDRD = 0b11111110; // PORTD (RX on PD0). Just for demo
}

int main(void)
{
init_io();

while (1)
{
PORTC = 0xFF;
PORTB = 0xFF;
PORTD = 0xFF;
_delay_ms(500);

PORTC = 0x00;
PORTB = 0x00;
PORTD = 0x00;
_delay_ms(500);
}

return 0;
}

+ 65
- 0
examples/BlinkWithoutDelay/BlinkWithoutDelay.ino View File

@@ -0,0 +1,65 @@
/* Blink without Delay
Turns on and off a light emitting diode(LED) connected to a digital
pin, without using the delay() function. This means that other code
can run at the same time without being interrupted by the LED code.
The circuit:
* LED attached from pin 13 to ground.
* Note: on most Arduinos, there is already an LED on the board
that's attached to pin 13, so no hardware is needed for this example.
created 2005
by David A. Mellis
modified 8 Feb 2010
by Paul Stoffregen
This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
*/

// constants won't change. Used here to
// set pin numbers:
const int ledPin = 13; // the number of the LED pin

// Variables will change:
int ledState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000; // interval at which to blink (milliseconds)

void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
}

void loop()
{
// here is where you'd put code that needs to be running all the time.

// check to see if it's time to blink the LED; that is, if the
// difference between the current time and last time you blinked
// the LED is bigger than the interval at which you want to
// blink the LED.
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;

// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;

// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}


+ 4
- 0
examples/BlinkWithoutDelay/Makefile View File

@@ -0,0 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =

include ../../Arduino.mk

+ 31
- 0
examples/Fade/Fade.ino View File

@@ -0,0 +1,31 @@
/*
Fade
This example shows how to fade an LED on pin 9
using the analogWrite() function.
This example code is in the public domain.
*/
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by

void setup() {
// declare pin 9 to be an output:
pinMode(9, OUTPUT);
}

void loop() {
// set the brightness of pin 9:
analogWrite(9, brightness);

// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}

+ 4
- 0
examples/Fade/Makefile View File

@@ -0,0 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =

include ../../Arduino.mk

+ 58
- 0
examples/HelloWorld/HelloWorld.ino View File

@@ -0,0 +1,58 @@
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}


+ 4
- 0
examples/HelloWorld/Makefile View File

@@ -0,0 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS = LiquidCrystal

include ../../Arduino.mk

+ 55
- 0
examples/MakefileExample/Makefile-example.mk View File

@@ -0,0 +1,55 @@
### DISCLAIMER
### This is an example Makefile and it MUST be configured to suit your needs.
### For detailled explanations about all the avalaible options,
### please refer to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md

### PROJECT_DIR
### This is the path to where you have created/cloned your project
PROJECT_DIR = /Users/Ladislas/dev/leka/moti

### ARDMK_DIR
### Path to the Arduino-Makefile directory.
ARDMK_DIR = $(PROJECT_DIR)/arduino-mk

### ARDUINO_DIR
### Path to the Arduino application and ressources directory.
ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java

### USER_LIB_PATH
### Path to where the your project's libraries are stored.
USER_LIB_PATH := $(PROJECT_DIR)/lib

### BOARD_TAG
### It must be set to the board you are currently using. (i.e uno, mega2560, etc.)
BOARD_TAG = mega2560

### MONITOR_BAUDRATE
### It must be set to Serial baudrate value you are using.
MONITOR_BAUDRATE = 115200

### AVR_TOOLS_DIR
### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
AVR_TOOLS_DIR = /usr/local

### AVRDDUDE
### Path to avrdude directory.
AVRDDUDE = /usr/local/bin/avrdude

### CPPFLAGS
### Flags you might want to set for debugging purpose. Comment to stop.
CPPFLAGS = -pedantic -Wall -Wextra

### MONITOR_PORT
### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
MONITOR_PORT = /dev/tty.usbmodem*

### don't touch this
CURRENT_DIR = $(shell basename $(CURDIR))

### OBJDIR
### This is were you put the binaries you just compile using 'make'
OBJDIR = $(PROJECT_DIR)/bin/$(BOARD_TAG)/$(CURRENT_DIR)

### path to Arduino.mk, inside the ARDMK_DIR, don't touch.
include $(ARDMK_DIR)/Arduino.mk


+ 7
- 0
examples/README.md View File

@@ -0,0 +1,7 @@
This folder contains the list of example Arduino sketches and makefile showing the different usage patterns

- Blink - Shows normal usage
- HelloWorld - Shows how to include Arduino libraries
- BlinkInAVRC - Shows how to use plain AVR C code
- BlinkChipKIT - Shows how to use ChipKIT
- ATtinyBlink - Shows how to use different cores like ATtiny

+ 14
- 0
examples/TinySoftWareSerial/Makefile View File

@@ -0,0 +1,14 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile

# if you have placed the alternate core in your sketchbook directory, then you can just mention the core name alone.
ALTERNATE_CORE = attiny
# If not, you might have to include the full path.
#ALTERNATE_CORE_PATH = /home/sudar/Dropbox/code/arduino-sketches/hardware/attiny/

BOARD_TAG = attiny85-8

ARDUINO_LIBS = SoftwareSerial

include $(ARDMK_DIR)/Arduino.mk

# !!! Important. You have to use make ispload to upload when using ISP programmer

+ 12
- 0
examples/TinySoftWareSerial/TinySoftwareSerial.ino View File

@@ -0,0 +1,12 @@
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 4); // RX, TX

void setup() {
mySerial.begin(9600);
}

void loop() {
mySerial.println(millis());
delay(1000);
}

+ 6
- 0
examples/WebServer/Makefile View File

@@ -0,0 +1,6 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile

BOARD_TAG = uno
ARDUINO_LIBS = Ethernet SPI

include ../../Arduino.mk

+ 82
- 0
examples/WebServer/WebServer.ino View File

@@ -0,0 +1,82 @@
/*
Web Server
A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
* Analog inputs attached to pins A0 through A5 (optional)
created 18 Dec 2009
by David A. Mellis
modified 4 Sep 2010
by Tom Igoe
*/

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 178);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup()
{
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
}

void loop()
{
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();

// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(analogRead(analogChannel));
client.println("<br />");
}
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
}

+ 6
- 0
examples/master_reader/Makefile View File

@@ -0,0 +1,6 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile

BOARD_TAG = uno
ARDUINO_LIBS = Wire

include ../../Arduino.mk

+ 32
- 0
examples/master_reader/master_reader.ino View File

@@ -0,0 +1,32 @@
// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
}

void loop()
{
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2

while(Wire.available()) // slave may send less than requested
{
char c = Wire.read(); // receive a byte as character
Serial.print(c); // print the character
}

delay(500);
}

+ 4
- 0
examples/toneMelody/Makefile View File

@@ -0,0 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =

include ../../Arduino.mk

+ 95
- 0
examples/toneMelody/pitches.h View File

@@ -0,0 +1,95 @@
/*************************************************
* Public Constants
*************************************************/

#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#define NOTE_F1 44
#define NOTE_FS1 46
#define NOTE_G1 49
#define NOTE_GS1 52
#define NOTE_A1 55
#define NOTE_AS1 58
#define NOTE_B1 62
#define NOTE_C2 65
#define NOTE_CS2 69
#define NOTE_D2 73
#define NOTE_DS2 78
#define NOTE_E2 82
#define NOTE_F2 87
#define NOTE_FS2 93
#define NOTE_G2 98
#define NOTE_GS2 104
#define NOTE_A2 110
#define NOTE_AS2 117
#define NOTE_B2 123
#define NOTE_C3 131
#define NOTE_CS3 139
#define NOTE_D3 147
#define NOTE_DS3 156
#define NOTE_E3 165
#define NOTE_F3 175
#define NOTE_FS3 185
#define NOTE_G3 196
#define NOTE_GS3 208
#define NOTE_A3 220
#define NOTE_AS3 233
#define NOTE_B3 247
#define NOTE_C4 262
#define NOTE_CS4 277
#define NOTE_D4 294
#define NOTE_DS4 311
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_FS4 370
#define NOTE_G4 392
#define NOTE_GS4 415
#define NOTE_A4 440
#define NOTE_AS4 466
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_CS5 554
#define NOTE_D5 587
#define NOTE_DS5 622
#define NOTE_E5 659
#define NOTE_F5 698
#define NOTE_FS5 740
#define NOTE_G5 784
#define NOTE_GS5 831
#define NOTE_A5 880
#define NOTE_AS5 932
#define NOTE_B5 988
#define NOTE_C6 1047
#define NOTE_CS6 1109
#define NOTE_D6 1175
#define NOTE_DS6 1245
#define NOTE_E6 1319
#define NOTE_F6 1397
#define NOTE_FS6 1480
#define NOTE_G6 1568
#define NOTE_GS6 1661
#define NOTE_A6 1760
#define NOTE_AS6 1865
#define NOTE_B6 1976
#define NOTE_C7 2093
#define NOTE_CS7 2217
#define NOTE_D7 2349
#define NOTE_DS7 2489
#define NOTE_E7 2637
#define NOTE_F7 2794
#define NOTE_FS7 2960
#define NOTE_G7 3136
#define NOTE_GS7 3322
#define NOTE_A7 3520
#define NOTE_AS7 3729
#define NOTE_B7 3951
#define NOTE_C8 4186
#define NOTE_CS8 4435
#define NOTE_D8 4699
#define NOTE_DS8 4978



+ 49
- 0
examples/toneMelody/toneMelody.ino View File

@@ -0,0 +1,49 @@
/*
Melody
Plays a melody
circuit:
* 8-ohm speaker on digital pin 8
created 21 Jan 2010
modified 30 Aug 2011
by Tom Igoe

This example code is in the public domain.
http://arduino.cc/en/Tutorial/Tone
*/
#include "pitches.h"

// notes in the melody:
int melody[] = {
NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
4, 8, 8, 4,4,4,4,4 };

void setup() {
// iterate over the notes of the melody:
for (int thisNote = 0; thisNote < 8; thisNote++) {

// to calculate the note duration, take one second
// divided by the note type.
//e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
int noteDuration = 1000/noteDurations[thisNote];
tone(8, melody[thisNote],noteDuration);

// to distinguish the notes, set a minimum time between them.
// the note's duration + 30% seems to work well:
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
// stop the tone playing:
noTone(8);
}
}

void loop() {
// no need to repeat the melody.
}

+ 502
- 0
licence.txt View File

@@ -0,0 +1,502 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999

Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]

Preamble

The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.

This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.

When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.

To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.

For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.

We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.

To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.

Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.

When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.

We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.

For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.

In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.

Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.

The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".

A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.

The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)

"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.

1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.

You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

a) The modified work must itself be a software library.

b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.

c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.

d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.

(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)

These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.

In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.

This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.

4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.

If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.

5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.

However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.

When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.

If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)

Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.

You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:

a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)

b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.

c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.

d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.

e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.

For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.

It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:

a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.

b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.

8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.

9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.

10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.

13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.

NO WARRANTY

15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries

If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).

To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.

<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice

That's all there is to it!

+ 23
- 0
packaging/debian/README.md View File

@@ -0,0 +1,23 @@
# How to compile a Deb package

Use these instructions to build your own Deb package from your local sources.
For the latest official packages go to [Debian](http://packages.debian.org/arduino-mk)
or [Ubuntu](https://launchpad.net/ubuntu/+source/arduino-mk) or use apt.

First install the dependencies as root:

apt-get build-dep arduino-mk
apt-get install arduino-core build-essential dpkg-dev fakeroot devscripts

Fetch the Debian source:

apt-get source arduino-mk

Make any local changes to want within the arduino-mk-* directory and update the package version:

cd arduino-mk-*
dch -i

Then compile. This will create a binary Deb:

dpkg-buildpackage -b

+ 39
- 0
packaging/fedora/README.md View File

@@ -0,0 +1,39 @@
# How to compile an RPM

First install the dependencies as root:

yum install arduino-core rpm-build

From the top-level Arduino-Makefile directory you've checked out of github, run the following (as unprivileged user) to create a compressed tarball using the naming conventions required by rpmbuild:

git archive HEAD --prefix=arduino-mk-1.3.4/ -o ../arduino-mk-1.3.4.tar.gz

If you don't already have a rpmbuild setup (e.g. you've not installed the SRPM) you will need to create the directories:

mkdir -p ~/rpmbuild/{SOURCES,SPECS}

Then copy the tarball and specfile into those directories:

cp ../arduino-mk-1.3.4.tar.gz ~/rpmbuild/SOURCES/
cp packaging/fedora/arduino-mk.spec ~/rpmbuild/SPECS/

Then compile. This will create a binary and source RPM:

cd ~/rpmbuild/SPECS/
rpmbuild -ba arduino-mk.spec

Fedora's AVR compilers use ccache, so you may have to override some of the paths to the AVR tools in your sketch's Makefile, for example:

```Makefile