Build with arduino makefile -- By alxm

Build with Arduino-Makefile

Author :


This is a short tutorial for building games with Arduino-Makefile from the command line, instead of with the Arduino IDE. I ran these steps on 64bit Linux, but Arduino-Makefile is compatible with Mac and Windows too!

Why? I was already using an external code editor, so why not bypass the IDE all the way? Building this way is a lot faster too, I'm able to compile example sketches in 4 sec vs 14 sec with the IDE!

I first wrote this article on my website, check it out for a bit of extra content like customizing your project's structure.

1. Install Arduino

Install the Gamebuino META dev environment as normal, so you can build your game with the IDE.

2. Install Arduino-Makefile

I cloned the latest version to my home folder:

$ cd ~
$ git clone

3. Choose a Project

Pick a sketch you want to build, and create a new file called Makefile in its source folder (where the .ino file is). I'll use the Gamebuino META a_Hello example here:

$ cd ~/Arduino/libraries/Gamebuino_META/examples/1.Basics/a_Hello
$ touch Makefile
$ ls
a_Hello.ino Makefile

4. Edit Makefile

Note that the ARDUINO_DIR, ARDMK_DIR, and ALTERNATE_CORE_PATH paths below may be different on your system. You can check what they are by building with the IDE and looking at the output (remember to turn Verbose On from File > Preferences).

# Paths to Arduino IDE and cloned Arduino-Makefile
ARDUINO_DIR = $(HOME)/arduino
ARDMK_DIR = $(HOME)/Arduino-Makefile

# Specify the custom Gamebuino board and where it's installed
BOARD_TAG = gamebuino_meta_native

# The Arduino libraries the game uses

# The META lib expects SKETCH_NAME to be defined

# Now that everything is configured, include Arduino-Makefile
include $(ARDMK_DIR)/

5. Build & Upload

$ make # Compile code and build .BIN file $ make upload # Flash to Gamebuino $ make clean # Remove all build files

All of these just work, even upload! You can build even faster with make -j, which runs commands in parallel.

1 Like
Author :


Thank you Alex for this contribution. I am sure it will be very useful for many budding coders in the community. And considering the decrease in activity on the site, it is reassuring to note that our most esteemed coders are still there to deliver interesting things from time to time :slight_smile:

Author :


Thanks for the kind words Steph!

This is something I always wanted to do, so I can build my games for Gamebuino the same way I build them for other platforms, with make -f Makefile.gamebuino.

Also, going through this stuff really made me appreciate how Meta is compatible with Arduino Zero, things like Arduino-Makefile "just work" with minimal config :-)

Author :


Great, i haven’t install my stuff to developp in my new house atm but i like that i have read and gain of time is a very good thing  :wink:

Author :


This is cool! Just saw that you hard-coded the version of the arduino boards in your description which was just updated to 1.2.2 though, to work with the newest samd board definitions. so yeah ^^