Hello there,
First things first: Great job AlphaZeta. I was tired fixing arduino makefile included in arduino-core package, so I used my uncle Google and tadam, here is your post.
I modified your makefile to be more generic since I wanted to have one makefile for all my sketches and just to copy it to proper dir and NOT to have to modify it.
Here are listed my modifications:
CXX_MODULES = \
$(ARDUINO)/Tone.cpp \
$(ARDUINO)/WMath.cpp \
$(ARDUINO)/Print.cpp \
$(ARDUINO)/HardwareSerial.cpp \
$(ARDUINO)/CDC.cpp \
$(ARDUINO)/HID.cpp \
$(ARDUINO)/IPAddress.cpp \
$(ARDUINO)/new.cpp \
$(ARDUINO)/Stream.cpp \
$(ARDUINO)/USBCore.cpp \
$(ARDUINO)/WMath.cpp \
$(ARDUINO)/WString.cpp \
$(ARDUINO)/main.cpp \
CXX_MODULES += $(shell find $(ARDUINO_LIB) -maxdepth 2 -mindepth 2 -type f -name *.cpp -exec /bin/echo -n " {}" \;)
The last line adds all .cpp files in libraries directory to compile list so I don't have to add them when using another library in my sketch
CINCS = -I$(ARDUINO) -I$(VARIANTS) -I$(ARDUINO_LIB)
CXXINCS = -I$(ARDUINO) -I$(VARIANTS) -I$(ARDUINO_LIB)
CINCS += $(shell find $(ARDUINO_LIB) -mindepth 1 -maxdepth 2 -type d ! -name examples -exec /bin/echo -n " -I{} " \;)
CXXINCS += $(shell find $(ABDUINO_LIB) -mindepth 1 -maxdepth 2 -type d ! -name examples -exec /bin/echo -n " -I{} " \;)
Similarly, two bottom lines add all dirs in arduino's library path to include path.
applet/main.o:
test -d applet || mkdir applet
echo '#include "Arduino.h"' > applet/main.cpp
cat $(TARGET).pde >> applet/main.cpp
cat $(ARDUINO)/main.cxx >> applet/main.cpp
$(CXX) -c $(ALL_CXXFLAGS) applet/main.cpp -o applet/main.o
Minor bugfix, inspired by Makefile included in stock Debian testing Arduino package.
To avoid /usr/share/arduino/libraries/Firmata/Boards.h:8:25: error: floating constant in preprocessor expression
i changed
VERSION=1.00
into VERSION=100
I use it on Debian Wheezy (amd64) with installed both arduino and arduino-core packages.
I'm open to anny sugesstions, I know it's not perfect (it compiles also unneeded and unused libraries). Hope it helps anybody
Makefile (8.43 KB)