Updated Makefile.master

If you have been using my Makefile for Arduino sketches I've been updating it regularly with bug fixes and improvements. The latest version includes:

  • Arduino bin directory, avrdude config file and avrdude path made configurable.
  • Single-file sketches weren't building properly.
  • Listing file now generated for the final binary image.

You can find the current version of the Makefile.master here.

Categories : Tech, AVR

Re: Updated Makefile.master

I reused and modified your Makefile to make it compatible to Vim's QuickFix features. You can find it at users.jyu.fi/~mweber/software/arduino/Makefile.master. You probably won't want to reuse it as-is since I hardcoded some features, but here is what I changed:

  • After killing the serial communication software, sleep for 1 second
  • Before starting the programmer, the DTR signal is triggered with stty to
    reset the board (programming would otherwise not be possible)
  • Warnings remain warnings (GCC's -Werror flag has been removed, because I
    had a weird warning that I don't know how to fix)
  • The sketch's .pde file is hardlinked into the build directory, and is
    #included in sketchname_pde.cpp instead of copied into it. This
    allows GCC to report the errors on the proper line of the .pde file and
    to report the proper path for this file in its error messages (when compiling
    sketchname_pde.cpp, GCC is in the build directory; since it would include
    ../sketch.pde, the error messages relative to this file would point to a
    file name starting with ../, but since Vim is in the parent directory, the
    path to sketch.pde would be wrong and Vim's QuickFix would fail to find the file).
  • Linking is made by gcc instead of g++ because of a bug in linking to
    libm (which is needed if you want to do floating point computations, so it
    links against it by default).
  • A vim: line has been appended to make Vim recognize the file as a