dev.ed.am
Arduino Makefile
Arduino Makefile Timeline
August 22, 2014
bug_report_tiny.png 11:53  Bug report #14 - compile error: function "was not declared in this scope"
gippa (gippa):
Issue created
Hi Tim,

I use your Makefile and first thanks for the great job!
then sorry for my english (google) ;)

I have this compilation error:

funcion "was not declared in this scope" _only_ when function was declared after usage.
in arduino IDE work ok.

bye.
January 13, 2014
bug_report_tiny.png 01:12  Bug report #13 - SD.h not found by arduino.mk Rev 0.6 97
Carl_P (ccpetersen):
Issue created
Using OSX 10.9.1
Using Arduino IDE 1.5.5
Using arduino.mk rev 0.6 97
Using Makefile:
<source lang="php">LIBRARIES := SD SPI
BOARD := uno
SERIALDEV := /dev/cu.usbmodem1d11
include ~/bin/arduino.mk</source>

Arduino 1.5.5 has SD.h in "/Applications/Arduino.app/Contents/Resources/Java/libraries/SD/src" and the Makefile searches "/Applications/Arduino.app/Contents/Resources/Java/libraries/SD/"
January 09, 2014
bug_report_tiny.png 19:24  Bug report #11 - sed doesn't accept a -r option on OS X
edam (edam):
Issue closed
January 08, 2014
bug_report_tiny.png 22:06  Bug report #12 - mkdir -p .dep/./ fails on OSX Mavericks
edam (edam):
Issue closed
bug_report_tiny.png 21:26  Bug report #11 - sed doesn't accept a -r option on OS X
edam (edam):
Issue closed
January 06, 2014
bug_report_tiny.png 18:24  Bug report #12 - mkdir -p .dep/./ fails on OSX Mavericks
Carl_P (ccpetersen):
Issue created
Machine: Macbook Pro running OSX 10.9.1, (GNU)make version 3.81

In a sketch directory make fails at the %.o: %.ino rule. The line mkdir -p .dep/$(dir $<) resolves to mkdir -p .dep/./ which gets this error: "mkdir: .dep/./: No such file or directory"

I just removed the $(dir $<) part on the .ino/.pde rules.
January 05, 2014
bug_report_tiny.png 19:04  Bug report #11 - sed doesn't accept a -r option on OS X
edam (edam):
Issue created
The makefile uses sed's -r (expanded regex) option in several places. This doesn't work on OS X -- it causes an "illegal option" error.
October 23, 2013
bug_report_tiny.png 15:49  Bug report #10 - Using Arduino Makefile to build ArdOS results in a bad executable
edam (edam):
Issue closed
October 11, 2013
bug_report_tiny.png 05:18  Bug report #10 - Using Arduino Makefile to build ArdOS results in a bad executable
agprimatic@gmail.com:
Issue created
I built an example ArdOS ([https://bitbucket.org/ctank/ardos-ide/wiki/Home https://bitbucket.org/ctank/ardos-ide/wiki/Home]) code, bigExample.ino, using the Arduino Makefile, and it builds successfully but it does not execute correctly. It seems to continually jump back to the start of the code.

Building bigExample.ino in the Arduino IDE builds and runs correctly.
July 31, 2013
bug_report_tiny.png 20:55  Bug report #5 - The arduino.mk file does not work with Arduino 1.5.2.
edam (edam):
Issue closed
feature_request_tiny.png 20:54  Feature request #9 - Building with the "sam" backend (for Arduino Due) isn't supported
edam (edam):
Issue created
Building projects with any BOARD that uses the `sam` backend (which is only `arduino_due_x`, the Arduino Due board, at the moment) isn't supported.

<source lang="sh">$ BOARD=arduino_due_x make</source>
July 19, 2013
feature_request_tiny.png 16:48  Feature request #6 - Assembler as is chosen rather than avr-as
edam (edam):
Issue closed
bug_report_tiny.png 16:36  Bug report #3 - Library directory selection is too strict
edam (edam):
Issue closed
bug_report_tiny.png 14:18  Bug report #8 - Picking up, compiling and linking *.S files
edam (edam):
Issue closed
June 01, 2013
bug_report_tiny.png 04:07  Bug report #8 - Picking up, compiling and linking *.S files
douglas.kastle@gmail.com:
Issue created
This is probably an extension of this feature request, http://dev.ed.am/arduino-mk/issues/6, however when I try and use a released library, AVRLib, https://github.com/DavyLandman/AESLib, it does not successfully compile using the Makefile as there are a number of assembly files, in this case ending with the extension of *.S. The ardunio GUI successfully pickes up and compiles these files so I was able to figure out what was missing.

I have edited my local make file to pick up *.S as source files and to compile them the same as *.c files and it all works

Thanks for releasing this code, I much perfer working with arduinos using the command line than a clunky GUI

Here is the diff of the changes I made:

244,246c244,246
< $(wildcard *.c *.cc *.cpp *.C) \
< $(wildcard $(addprefix util/, *.c *.cc *.cpp *.C)) \
< $(wildcard $(addprefix utility/, *.c *.cc *.cpp *.C))
---
> $(wildcard *.c *.cc *.cpp *.C *.S) \
> $(wildcard $(addprefix util/, *.c *.cc *.cpp *.C *.S)) \
> $(wildcard $(addprefix utility/, *.c *.cc *.cpp *.C *.S))
276c276
< $(patsubst %, .lib/%.o, $(wildcard $(addprefix $(dir)/, *.c *.cpp))))
---
> $(patsubst %, .lib/%.o, $(wildcard $(addprefix $(dir)/, *.c *.cpp *.S))))
402a403,406
> %.o: %.S
> mkdir -p .dep/$(dir $<)
> $(COMPILE.c) $(CPPDEPFLAGS) -o $@ $<
>
428a433,436
> mkdir -p $(dir $@)
> $(COMPILE.c) -o $@ $<
>
> .lib/%.S.o: %.S
May 31, 2013
feature_request_tiny.png 17:27  Feature request #7 - Add support for "board profiles"
edam (edam):
Issue created
Currently, board profiles are not supported at all.

An example board profile can be [http://www.freetronics.com/pages/leostick-getting-started-guide found here]. It includes `cores` and `bootloaders` directories, and its own `boards.txt`.
May 24, 2013
feature_request_tiny.png 11:25  Feature request #6 - Assembler as is chosen rather than avr-as
pum.walters@gmail.com:
Issue created
for assembler files (.s) arduino.ml uses 'as', which is the hosts's (x86) assembler, whereas avr-as in the avr toolchain should be used.

I don't know how to make a patch script, but in my arduino.mk I added (at appropriate places)

near CC := $(call findsoftware,avr-gcc) added AS := $(call findsoftware,avr-as)

near CPPDEPFLAGS = -MMD -MP -MF .dep/$<.dep added ASDEPFLAGS = .dep/$<.dep

near %.o: %.c .... added
%.o: %.s
mkdir -p .dep/$(dir $<)
$(COMPILE.s) $(ASDEPFLAGS) -o $@ $<

(I haven't yet been able to assemble and upload anything, so I guess I don't know what I'm doing yet, so take this is a suggestion at best :-)
April 28, 2013
bug_report_tiny.png 07:00  Bug report #5 - The arduino.mk file does not work with Arduino 1.5.2.
carl.nobile@gmail.com:
Issue created
I don't know if this should be a bug or a feature request, but the current version of the arduino.mk does not work on the Arduino 1.5.2. It seems they have added an optional subsystem names 'sam' as opposed to 'avr'. This caused some directories to be moved around within the arduino IDE. I have a patch that fixes this, but this bug report system doesn't seem to let me attach the patch file.

Here is a link to the patch: [[http://tetrasys-design.net/upload/arduino.mk.patch|http://tetrasys-design.net/upload/arduino.mk.patch]]

Carl
March 04, 2013
icon_build.png 13:00 arduino-mk_0.5.txz
New version released
February 26, 2013
bug_report_tiny.png 00:19  Bug report #4 - Issues on OS X (preferences.conf, install location, avrdude.conf)
edam (edam):
Issue closed
February 23, 2013
bug_report_tiny.png 19:39  Bug report #4 - Issues on OS X (preferences.conf, install location, avrdude.conf)
edam (edam):
Issue closed
February 03, 2013
bug_report_tiny.png 11:01  Bug report #2 - doesn't check for libraries in sketchbook folder
edam (edam):
Issue closed
January 26, 2013
bug_report_tiny.png 20:57  Bug report #4 - Issues on OS X (preferences.conf, install location, avrdude.conf)
Guest user (guest):
Issue created
Sorry for not separating the issues to different bug reports; I don't know if you'd be willing to push OS X support...

So:
# The preferences.txt file is found as ~/Library/Arduino/preferences.txt on OS X. So the current (rev.72) arduino.mk doesn't find it (so doesn't set SKETCHBOOKDIR and so the user libraries aren't found - that's how I came across this issue).
# The ARDUINODIR variable needs to point to <Location_of_Arduino.app>/Contents/Resources/Java (so not to the install location of Arduino.app) - but this is fixable in individual Makefiles, so not much problem at all. The usual locations for Arduino.app are either /Applications/Arduino.app or ~/Applications/Arduino.app (with the first one being used much more heavily) - so you could add these two into the default list.
# "make upload" does a good (correct) guess for the serial port, but avrdude complains:
avrdude: can't open config file "/usr/local/etc/avrdude.conf": No such file or directory
avrdude: error reading system wide configuration file "/usr/local/etc/avrdude.conf"
I couldn't understand why the Arduino.app-supplied one isn't chosen - the arduino.mk logic seemed to be correct, and I don't really know how to "debug" Makefiles.

Otherwise, the compilation itself went fine (except finding the libraries in the sketchbook directory, as mentioned above). Thanks for this, it's a great idea and good implementation!
January 03, 2013
bug_report_tiny.png 21:06  Bug report #3 - Library directory selection is too strict
edam (edam):
Issue created
The arduino IDE automatically includes a library in the build (i.e. builds it and links against it) if *any* header in the root of a library's directory is #included. So, for example, you can have a library directory called foo which contains bar.h and going
<source lang="c++">#include <bar.h></source>
would automatically include the foo library in the build.

The makefile's logic is slightly different. It only automatically includes libraries only if the included header has the same name as the library directory. So in the above example, the foo library would not be included. This logic needs to be made more compatible.

The IDE's logic is horrible. For example, adding a math.h to a library makes the system math.h inaccessible. And two libraries (which might have been written by unrelated 3rd parties, remember) can not have headers with the same name and both be accessible. But fortunately, the makefile's automatic inclusion of libraries is only done in the "automatic" mode, so the IDE's crappy logic can be overridden and libraries specified manually.
December 28, 2012
bug_report_tiny.png 00:08  Bug report #2 - doesn't check for libraries in sketchbook folder
Guest user (guest):
Issue created
You check for libraries in $(ARDUINODIR)/libraries but not in ../libraries ("sketchbook libraries").
December 13, 2012
feature_request_tiny.png 07:45  Feature request #1 - Win32 Support
Guest user (guest):
Issue created
With a small amount of fiddling, I modified the makefile so it works equivalently across OS X, Linux and Windows (at least in terms of building a sketch, upload and serial monitor not tested).

I attach the following patch.

<source lang="diff">
--- arduino.mk.orig 2012-12-13 17:40:52.000000000 +1100
+++ arduino.mk 2012-12-13 17:41:46.000000000 +1100
@@ -151,6 +151,18 @@
#_______________________________________________________________________________
#

+ifeq ($(OS),Windows_NT)
+ WIN32 := 1
+ ifdef ARDUINODIR
+ ifneq (,$(findstring :,$(ARDUINODIR)))
+ ARDUINODIR := /$(subst :,/,$(ARDUINODIR))
+ endif
+ ARDUINODIR := $(subst \,/,$(ARDUINODIR))
+ endif
+else
+ POSIX := 1
+endif
+
# default arduino software directory, check software exists
ifndef ARDUINODIR
ARDUINODIR := $(firstword $(wildcard ~/opt/arduino /usr/share/arduino))
@@ -201,7 +213,12 @@
endif

# software
-findsoftware = $(firstword $(wildcard $(addsuffix /$(1), $(AVRTOOLSPATH))))
+ifdef WIN32
+ EXE := .exe
+else
+ EXE :=
+endif
+findsoftware = $(firstword $(wildcard $(addsuffix /$(1)$(EXE), $(AVRTOOLSPATH))))
CC := $(call findsoftware,avr-gcc)
CXX := $(call findsoftware,avr-g++)
LD := $(call findsoftware,avr-ld)
@@ -226,7 +243,7 @@

# avrdude confifuration
ifeq "$(AVRDUDECONF)" ""
-ifeq "$(AVRDUDE)" "$(ARDUINODIR)/hardware/tools/avr/bin/avrdude"
+ifeq "$(AVRDUDE)" "$(ARDUINODIR)/hardware/tools/avr/bin/avrdude$(EXE)"
AVRDUDECONF := $(ARDUINODIR)/hardware/tools/avr/etc/avrdude.conf
else
AVRDUDECONF := $(wildcard $(AVRDUDE).conf)

</source>