21 Responses to “Arduino 1.0 development with a makefile on Linux”

  • Andreas

    Super tutorial – just what I needed. I tried the procedure above and everything works perfectly!

    Thanks a lot!


  • Bill

    It worked fine and it is currently the only makefile I could find that actually works!


  • Bill

    I wonder, how can I change it to include libraries in a specified folder (under sketchbook/libraries) apart from the default ones?

  • Alessandro Pasotti


    I’ve patched the makefile to include sketchbook/libraries and sent it to Tim (the original author), but I didn’t get a relpy yet.

    I’m attaching the new version to the post above.

    You may need to adjust the paths (tested under Ubuntu LTS).

  • Bill

    Alessandro it works right out of the box (just changed the symlink in my system).

    Thank you very much.

    ps: I suggest this gets stored in the arduino playground so that people find it more easily 🙂

  • Andreas Kring


    The procedures in the article above used work out for me fine, but now I run into trouble (i.e. nothing happens (on the Arduino) when I run “make -f ../Makefile” from the blink folder) when follow the steps described (I have just switched from Ubuntu 10.04 LTS to Ubuntu 12.04 LTS).

    Everything works fine when I use the standard Arduino IDE.

    I did not add “export ARDUINODIR=~/arduino-1.0” to ~/.bashrc (do I have to do this when I installed the arduino package using $ apt-get install arduino?)

    When I run “make -f ../Makefile”, I get the following output in the terminal:

    mkdir -p .dep/./
    /usr/bin/avr-g++ -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -DUSB_VID= -DUSB_PID= -I. -Iutil -Iutility -I /usr/share/arduino/hardware/arduino/cores/arduino -I /usr/share/arduino/hardware/arduino/variants/standard/ -c -MMD -MP -MF .dep/Blink.ino.dep -o Blink.o -x c++ -include /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h Blink.ino
    /usr/bin/avr-gcc -Os -Wl,–gc-sections -mmcu=atmega328p Blink.o .lib/arduino.a -lm -o Blink.elf
    /usr/bin/avr-objcopy -O ihex -R .eeprom Blink.elf Blink.hex
    rm Blink.elf

    Any ideas on what can be the problem?

    Best regards

  • Alessandro Pasotti

    Hi, Andreas,

    there is nothing wrong in your output, just type:

    make -f ../Makefile upload

    and the binary .hex will be uploaded to your Arduino.

    It’s a two step procedure, but you can easily modify the make file to do everything in a single step if you want.

  • Andreas Kring

    Hi, Alessandro.

    Ok, thanks a lot – that explains it.
    Thanks for the fast reply.

    Best regards

  • Ilya

    Thanks so much!
    I doing some wrong,I get also this mesage when I trying make -f

    ../Makefile:169: *** ARDUINODIR is not set correctly; arduino software not found. Stop.

    what I did wrong?
    Thank you!

  • Jeane

    Thanks so much for the Makefile.

    I am getting a: “Makefile:328: *** missing separator. Stop.”
    Don’t know why?
    Any guess?


  • Fotis

    Looks like the community loves your solution! Is there a way to know whether the makefile does exactly the same things with the Arduino IDE “verify” button (including the preprocesing, generating function prototypes, etc)?

    Thanks a lot!!

  • Alessandro Pasotti


    there are no function prototypes in the Makefile, the only thing the Makefile does under the hood is to include Arduino.h (I wouldn’t call this pre-processing though).

    BTW this is seldom a problem, on the contrary, I believe that this forces the user to write correct C/C++ code, I personally hated the way Arduino team advertised the “Arduino Programming Language” as a self-standing entity, as a software developer, at first I thought it was a real new programming language not just plain old C without prototypes.

    Also, as explained in the post, I’m not the author of the Makefile and there are many more Makefiles in the net. It seems like I’m not the only IDE-hater out there 🙂


  1.  Programming an Arduino from the command line with Linux | OpenForce.dk