Convert Figma logo to code with AI

sudar logoArduino-Makefile

Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.

2,020
448
2,020
102

Top Related Projects

14,200

Arduino IDE 1.x

Your Gateway to Embedded Software Development Excellence :alien:

Arduino command line tool

Arduino core for the ESP32

STM32 core support for Arduino

Quick Overview

The Arduino-Makefile project is a Makefile-based build system for Arduino projects. It provides a simple and flexible way to build, upload, and manage Arduino sketches using the command line, without relying on the Arduino IDE.

Pros

  • Cross-platform: The Makefile works on Windows, macOS, and Linux, making it a versatile choice for developers working on different platforms.
  • Flexibility: The Makefile can be customized to fit various project needs, allowing users to define their own build rules and targets.
  • Automation: The Makefile automates many common tasks, such as compiling, uploading, and monitoring the serial port, saving developers time and effort.
  • Integration with other tools: The Makefile can be integrated with other tools, such as version control systems and continuous integration platforms, enabling a more streamlined development workflow.

Cons

  • Learning curve: Users who are unfamiliar with Makefiles and command-line tools may face a steeper learning curve compared to using the Arduino IDE.
  • Limited IDE integration: The Makefile-based approach may not integrate as seamlessly with some IDEs as the Arduino IDE, which is designed specifically for Arduino development.
  • Dependency management: Managing dependencies, such as external libraries, can be more complex with the Makefile-based approach compared to the Arduino IDE's built-in library management.
  • Debugging: Debugging Arduino projects using the Makefile-based approach may be more challenging than using the Arduino IDE's built-in debugging tools.

Code Examples

Here are a few code examples demonstrating the usage of the Arduino-Makefile project:

  1. Compiling an Arduino sketch:
BOARD_TAG = uno
ARDUINO_DIR = /usr/share/arduino

include /path/to/Arduino.mk

This Makefile snippet sets the board type to "uno" and specifies the location of the Arduino installation directory. The include statement loads the Arduino.mk file, which provides the necessary build rules and targets.

  1. Uploading an Arduino sketch:
upload: $(TARGET_HEX)
    $(ARDUINO_UPLOAD) $(BOARD_TAG) $(TARGET_HEX)

This target uploads the compiled sketch (represented by the $(TARGET_HEX) variable) to the Arduino board using the $(ARDUINO_UPLOAD) command.

  1. Monitoring the serial port:
monitor:
    $(ARDUINO_MONITOR) $(MONITOR_BAUDRATE)

This target opens a serial monitor to the Arduino board, using the $(ARDUINO_MONITOR) command and the specified $(MONITOR_BAUDRATE).

  1. Cleaning the build directory:
clean:
    $(REMOVE) $(TARGET_HEX) $(TARGET_ELF) $(OBJS_DIR)/*

This target removes the compiled hex file, the ELF file, and the object files from the build directory.

Getting Started

To get started with the Arduino-Makefile project, follow these steps:

  1. Clone the repository:
git clone https://github.com/sudar/Arduino-Makefile.git
  1. Navigate to the project directory:
cd Arduino-Makefile
  1. Copy the Makefile.example file to your Arduino project directory and rename it to Makefile:
cp Makefile.example /path/to/your/arduino/project/Makefile
  1. Open the Makefile in your preferred text editor and customize the settings to match your project and development environment, such as the Arduino installation directory and the board type.

  2. Run the make command in your project directory to compile the Arduino sketch:

make
  1. Use the make upload command to upload the compiled sketch to your Arduino board:
make upload
  1. (Optional) Use the make monitor command to open a serial monitor and observe the output from your Arduino board:
make monitor
  1. Explore the available Makefile targets and customize them as needed to fit your development workflow.

Competitor Comparisons

14,200

Arduino IDE 1.x

Pros of Arduino

  • Official Arduino IDE with integrated board manager and library support
  • User-friendly interface for beginners with built-in examples
  • Seamless integration with Arduino hardware and ecosystem

Cons of Arduino

  • Limited customization options for advanced users
  • Dependency on GUI for project management and compilation
  • Less flexibility for version control and continuous integration

Code Comparison

Arduino:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

Arduino-Makefile:

ARDUINO_DIR = /usr/share/arduino
BOARD_TAG    = uno
ARDUINO_PORT = /dev/ttyACM0
ARDUINO_LIBS =
include /usr/share/arduino/Arduino.mk

Arduino-Makefile allows for command-line compilation and upload, making it easier to integrate with version control systems and automated build processes. It provides more flexibility for advanced users but requires more setup and familiarity with Makefiles. Arduino IDE offers a more straightforward approach for beginners but may limit customization options for complex projects.

Your Gateway to Embedded Software Development Excellence :alien:

Pros of PlatformIO Core

  • Supports multiple platforms and frameworks beyond Arduino
  • Integrated library management and dependency resolution
  • Built-in unit testing and continuous integration capabilities

Cons of PlatformIO Core

  • Steeper learning curve for beginners
  • Requires more system resources and setup time
  • May have compatibility issues with some Arduino-specific libraries

Code Comparison

Arduino-Makefile:

ARDUINO_DIR = /usr/share/arduino
ARDMK_DIR = /usr/local/arduino-mk
BOARD_TAG = uno
include $(ARDMK_DIR)/Arduino.mk

PlatformIO Core:

[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps =
    SPI
    Wire

Arduino-Makefile uses a traditional Makefile approach, while PlatformIO Core employs a more modern, INI-style configuration file. PlatformIO's setup is generally more concise and easier to read, especially for complex projects with multiple dependencies.

Both tools aim to simplify Arduino development, but PlatformIO Core offers a more comprehensive ecosystem for embedded development across various platforms. Arduino-Makefile is more focused on Arduino-specific projects and may be simpler for users already familiar with Make-based build systems.

Arduino command line tool

Pros of arduino-cli

  • Official Arduino tool, ensuring better compatibility and support
  • Supports a wider range of Arduino boards and platforms
  • Can be integrated into CI/CD pipelines and automated workflows

Cons of arduino-cli

  • Steeper learning curve for users familiar with Makefile-based workflows
  • May require more setup and configuration for complex projects

Code Comparison

Arduino-Makefile:

ARDUINO_DIR = /usr/share/arduino
BOARD_TAG    = uno
ARDUINO_PORT = /dev/ttyACM0
ARDUINO_LIBS = SPI Ethernet
include /usr/share/arduino/Arduino.mk

arduino-cli:

arduino-cli compile --fqbn arduino:avr:uno MySketch
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:uno MySketch

Key Differences

  • Arduino-Makefile uses a traditional Makefile approach, which may be more familiar to some users
  • arduino-cli provides a command-line interface with more granular control over the build and upload process
  • Arduino-Makefile requires manual specification of Arduino directory and libraries, while arduino-cli manages these dependencies automatically
  • arduino-cli offers more advanced features like board management and library installation directly from the command line

Both tools serve the purpose of building and uploading Arduino sketches, but arduino-cli provides a more modern and flexible approach, especially for advanced users and automated environments.

Arduino core for the ESP32

Pros of arduino-esp32

  • Specifically designed for ESP32 microcontrollers, offering optimized support and features
  • Includes built-in libraries and tools tailored for ESP32 development
  • Regular updates and active community support from Espressif Systems

Cons of arduino-esp32

  • Limited to ESP32 boards, lacking support for other Arduino-compatible platforms
  • May require additional setup and configuration compared to a universal Makefile solution
  • Potential learning curve for developers not familiar with ESP32-specific features

Code Comparison

Arduino-Makefile:

ARDUINO_DIR = /usr/share/arduino
ARDMK_DIR = /usr/local/arduino-mk
BOARD_TAG = uno
include $(ARDMK_DIR)/Arduino.mk

arduino-esp32:

#include <Arduino.h>
#include <WiFi.h>

void setup() {
  Serial.begin(115200);
  WiFi.begin("SSID", "PASSWORD");
}

The Arduino-Makefile example shows a simple Makefile configuration for building Arduino projects, while the arduino-esp32 code demonstrates the use of ESP32-specific libraries and functionality.

STM32 core support for Arduino

Pros of Arduino_Core_STM32

  • Specifically designed for STM32 microcontrollers, offering optimized support and features
  • Integrates seamlessly with the Arduino IDE, providing a familiar development environment
  • Includes a wide range of STM32-specific libraries and examples

Cons of Arduino_Core_STM32

  • Limited to STM32 microcontrollers, lacking the flexibility to work with other Arduino boards
  • May have a steeper learning curve for users unfamiliar with STM32 architecture

Code Comparison

Arduino-Makefile:

ARDUINO_DIR = /usr/share/arduino
ARDMK_DIR = /usr/local/arduino-mk
BOARD_TAG = uno
include $(ARDMK_DIR)/Arduino.mk

Arduino_Core_STM32:

#include <Arduino.h>
#include <STM32duino.h>

void setup() {
  // STM32-specific initialization
}

The Arduino-Makefile example shows a typical Makefile configuration, while the Arduino_Core_STM32 snippet demonstrates the inclusion of STM32-specific headers and initialization in the setup function.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

A Makefile for Arduino Sketches Build Status

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 official ARM-based Arduino boards using Atmel SAM chip family and includes on-device debugging targets.
  • Supports chipKIT
  • Supports Teensy 3.x (via Teensyduino)
  • Supports Robotis OpenCR 1.0
  • 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 0.x, 1.0.x, 1.5.x and 1.6.x except 1.6.2. We recommend 1.6.3 or above version of Arduino IDE.
  • 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

Using apt-get (or aptitude)

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

sudo apt-get install arduino-mk

homebrew (or linuxbrew)

If you're using homebrew (or linuxbrew) then you can find this in the arduino-mk package which can be installed using the following commands.

Also make sure you have the necessary dependencies installed. Refer to the Requirements section below to install the dependencies.

# add tap
$ brew tap sudar/arduino-mk

# to install the last stable release
$ brew install arduino-mk

# to install the development version
$ brew install --HEAD arduino-mk

Arch Linux

Arch Linux users can use the unofficial AUR package arduino-mk. It can be installed with [AUR] helper using the following command.

yay -S arduino-mk

Fedora

Fedora Linux users can use our packaging instructions here to build an RPM.

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 in this readme about setting usage options

Requirements

Arduino IDE

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

pySerial

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

On most systems you should be able to install it using either pip3 or easy_install3.

pip3 install pyserial

# or if you prefer easy_install

easy_install3 -U pyserial

If you prefer to install it as a package, then you can do that as well.

On Debian or Ubuntu:

apt-get install python3-serial

On Fedora:

dnf install python3-pyserial

On openSUSE:

zypper install python3-serial

On Arch:

sudo pacman -S python-pyserial

On macOS using Homebrew (one can install to System Python but this is not recommend or good practice):

brew install python
pip3 install pyserial

On Windows:

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

Assuming you included Python in your Cygwin installation:

  1. download PySerial source package from https://pypi.python.org/pypi/pyserial
  2. extract downloaded package running tar xvzf dowloaded_package_name.tar.gz
  3. navigate to extracted package folder
  4. build and install Python module:
python3 setup.py build
python3 setup.py install

Alternatively, if you have setup Cygwin to use a Windows Python installation, simply install using pip:

pip3 install pyserial

Arduino-Makefile should automatically detect the Python installation type and use the correct device port binding.

Usage

Download a copy of this repo somewhere to your system or install it through a package by following the above installation instruction.

Sample makefiles are provided in the examples/ directory. E.g. Makefile-example demonstrates some of the more advanced options, whilst Blink demonstrates the minimal settings required for various boards like the Uno, Nano, Mega, Teensy, ATtiny etc.

Mac

On the Mac with IDE 1.0 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 the Mac with IDE 1.5+ it's like above but with

    ARDUINO_DIR   = /Applications/Arduino.app/Contents/Java

Linux

You can either declare following variables in your project's makefile or set them as environmental variables.

    ARDUINO_DIR – Directory where Arduino is installed
    ARDMK_DIR – Directory where you have copied the makefile
    AVR_TOOLS_DIR – Directory where avr tools are installed

Keep in mind, that Arduino 1.5.x+ comes with it's own copy of avr tools which you can leverage in your build process here.

Example of ~/.bashrc file:

    export ARDUINO_DIR=/home/sudar/apps/arduino-1.0.5
    export ARDMK_DIR=/home/sudar/Dropbox/code/Arduino-Makefile
    export AVR_TOOLS_DIR=/usr/include

Example of the project's make file:

    BOARD_TAG     = mega2560
    MONITOR_PORT  = /dev/ttyACM0

Windows

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

    # Symbolic link to Arduino installation directory - see below
    ARDUINO_DIR   = C:/Arduino
    ARDMK_DIR     = path/to/mkfile
    MONITOR_PORT  = com3
    BOARD_TAG     = mega2560

NOTE: Use forward slash not backslash and there should be no spaces or special characters in the Windows paths (due to Win/Unix crossover). The paths should not be cygdrive paths.

On Windows (using MSYS and PuTTY), you might want to set the following extra parameters:

    MONITOR_CMD   = putty
    MONITOR_PARAMS = 8,1,n,N

On Arduino 1.5+ installs, you should set the architecture to either avr or sam and if using a submenu CPU type, then also set that:

    ARCHITECTURE  = avr
    BOARD_TAG     = atmegang
    BOARD_SUB     = atmega168

Symbolic Link

It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows; unless one installs to a non-default location. 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

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

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

Alternatively if you've setup Cygwin hard symbolic links (CYGWIN=winsymlinks:native):

ln -s /cygdrive/c/Program Files\ \(x86\)/Arduino/ C:/Arduino

After which, the variables should be:

    ARDUINO_DIR=C:/Arduino

Instead of:

    ARDUINO_DIR=C:/Program\ Files\ \(x86\)/Arduino

Useful Variables

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

  • 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. Using Windows with Cygwin, this path must use Unix / and not Windows \ (eg "C:/Arduino" not "C:\Arduino).
  • ARDMK_DIR - Path where the *.mk are present. If you installed the package, then it is usually /usr/share/arduino. On Windows, this should be a path without spaces and no special characters, it can be a cygdrive path if necessary and must use / not \.
  • 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 relative and not absolute.

Including Libraries

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

	ARDUINO_LIBS = Wire SoftwareSerial

The libraries will be searched for 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)

avrdude

To upload compiled files, avrdude is used. This Makefile tries to find avrdude and its 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

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

Teensy 3.x

For Teensy 3.x support you must first install Teensyduino.

See examples/BlinkTeensy for example usage.

Robotis OpenCM

For Robotis OpenCM support you must first install the OpenCM IDE

See examples/BlinkOpenCM for example usage.

For large Robotis projects, libmaple may be more appropriate, as the OpenCM IDE uses a very old compiler release.

Arduino ARM Boards

For Arduino boards using ARM architechure, specifically the Atmel SAM series ((SAM3X8E) Due; (SAMD21) Arduino M0 [Pro], Zero, MKR1000, Feather M0, etc.), first install the board support package from the IDE or other distribution channels.

DefineARDUINO_PACKAGE_DIR as the root path containing the ARM support package (the manufacturer folder) and the BOARD_TAG (see make show_boards for help) within your project Makefile. Include 'Sam.mk' rather than 'Arduino.mk' at the end of your file - see examples/ZeroBlink, examples/MZeroBlink and examples/DueBlink for example usage.

Note: The Arduino IDE does not install board support packages to the base Arduino installation directory (the directory that will work with AVR Makefiles). They are generally installed to a '.arduino15/packages' folder in the users home directory. This is the reason for the new ARDUINO_PACKAGE_DIR define. On Windows, the package directory is often in the user home directory so advice is to create a symblic link to avoid slash/space in path problems. You can also manually install support packages in your Sketchbook 'hardware' folder, then define ARDUINO_PACKAGE_DIR as this path.

If using a SAM board from a manufacturer other than Arduino, one must still install the Arduino board support as above (unless using externally defined toolchain) and then define the location of the manufacturer board support core using the ALTERNATIVE_CORE_PATH define. For example: ALTERNATE_CORE_PATH = $(ARDUINO_SKETCHBOOK)/hardware/sparkfun/samd

The programing method will auto-detect based on the BOARD_TAG settings read from boards.txt:

Programming using OpenOCD CMSIS-DAP with the Programming/debug USB is currently supported (the same method used by the IDE), including burning bootloaders. External CMSIS tools such as Atmel Ice will also work with this method. Black Magic Probe (BMP) support is also included using GDB for both uploading and debugging.

Native USB programing using Bossa (Due, Zero, MKR1000, Feather style bootloaders) and avrdude (M0 bootloaders) is supported. The bootloaders on these devices requires a double press of the reset button or open/closing the serial port at 1200 BAUD. The automatic entry of the bootloader is attempted using ard-reset-arduino when using the general make upload target by polling attached devices until the bootloader port re-attaches (same method as the IDE). On Windows, the USB enumerates as differnt COM ports for the CDC Serial and bootloader and these must be defined. On encountering problems, one can manually enter the bootloader then upload using the make raw_upload target. Note that the make reset target will enter the bootloader on these devices; there is no way to reset over USB.

If using system installed tools, be aware that openocd and bossa were orginally forked for Arduino support and system distributions may not be up to date with merged changes. bossa must be version 1.7->. openocd should work but there may be problems at run time ref. Ideally, use the support packaged version or compile and install the Arduino fork.

With the ARM chipset and using a CMSIS-DAP tool, on-device debugging is made available:

  • debug_init and debug targets for on-device debugging using GDB. To use this, one must start the GDB server with make debug_init &, followed by connecting to the target with make debug. If using a Black Magic Probe, one can just use make debug. At the moment, a system wide arm-none-eabi-gdb must be installed as the one supplied with the Arduino toolchain does not appear to work.
  • Example usage: https://asciinema.org/a/Jarz7Pr3gD6mqaZvCACQBzqix
  • See the examples/MZeroBlink Makefile for a commented example.

Versioning

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

This project adheres to Semantic Versioning 2.0.

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 for more details.

If you are looking for ideas to work on, then check out the following TODO items or the issue tracker.

Limitations / Known Issues / TODO's

  • 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)
  • 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). Even Arduino IDE does the same thing though.
  • This makefile doesn't support boards or IDE from Arduino.org.

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

Interfacing with other projects/frameworks/IDE's

Colorgcc

It is possible to use colorgcc with this makefile. Check out this comment to find usage instructions.

Emacs/Flymake support

On-the-fly syntax checking in Emacs using the 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) -c -include Arduino.h   -x c++ $(CXXFLAGS)   $(CPPFLAGS)  -fsyntax-only $(CHK_SOURCES)

Code:Blocks integration

In Code:Blocks open Project -> Properties -> Project settings tab -> check "This is custom Makefile".

Now go to Settings -> Environment -> Environment variables -> Add

Add three keys with paths as values, using full paths (!):

	ARDUINO_DIR=/full/path/to/arduino-1.0.6
	ARDMK_DIR=/full/path/to/sketchbook
	AVR_TOOLS_DIR=/usr

Now to set DEBUG target (this will compile the project) go to Build options -> Debug -> "Make" commands

In Build Project/Target remove $target:

$make -f $makefile

In Clean Project/Target remove $target:

$make -f $makefile clean

To set the RELEASE target (which will compile and upload) go to Build options -> Release -> "Make" commands

In Build Project/Target put:

$make -f $makefile upload

In Clean Project/Target remove $target:

$make -f $makefile clean

Test Suite

This project includes a suite of example Makefiles and small Arduino and chipKIT programs to assist the maintainers of the Makefile. Run tests/script/bootstrap.sh to attempt to automatically install the dependencies (Arduino IDE, MPIDE, etc.). Run tests/script/runtests.sh to attempt to compile all of the examples. The bootstrap script is primarily intended for use by a continuous integration server, specifically Travis CI. It is not intended for normal users.

Makefile Generator and Project Initialisation

ardmk-init within the bin/ folder is a utility Python script to create a Arduino-mk Makefile for a project and also has option to create a traditional tree organization (src, lib, bin). It can be used as with commanline arguments or prompted - see examples below (append $ARDMK_DIR/bin/ to command if not on path):

  • Run prompted within current working directory: ardmk-init
  • Create Arduino Uno Makefile (useful within a library example): ardmk-init -qb uno
  • Create boilerplate Arduino Uno project in current working directory of same name: ardmk-init -b uno --quiet --project
  • Create Arduino-mk nano Makefile in current working directory with template .ino: ardmk-init -b nano -u atmega328 -qtn my-project
  • See ardmk-init --help for more.

Bare-Arduino–Project

If you are planning on using this makefile in a larger/professional project, you might want to take a look at the Bare-Arduino–Project framework.

Similar to HTML frameworks, Bare-Arduino–Project aims at providing a basic tree organization, Makefile configurations for both OS X and Linux and a handful of instruction on how to get started with a robust Arduino project architecture.

Further information are available in the README.md as well as in the use/installation procedure.

Please be sure to report issues to Bare-Arduino–Project if you use it instead of this project.

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 Muthu and Simon John with the help of 40+ contributors.

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.