/make/arduino-mk

To get this branch, use:
bzr branch http://bzr.ed.am/make/arduino-mk

« back to all changes in this revision

Viewing changes to arduino.mk

  • Committer: edam
  • Date: 2012-02-10 19:51:20 UTC
  • Revision ID: edam@waxworlds.org-20120210195120-etmt4ud4iae5m124
fixed detection of env. vars. and a typo in a rule that caused it not to work

Show diffs side-by-side

added added

removed removed

147
147
endif
148
148
 
149
149
# no target? use default
150
 
ifndef TARGET
 
150
ifeq ($(TARGET), )
151
151
TARGET := a.out
152
152
endif
153
153
 
154
154
# no serial device? attempt to detect an arduino
155
 
ifndef SERIALDEV
 
155
ifeq ($(SERIALDEV), )
156
156
SERIALDEV := $(firstword $(wildcard /dev/ttyACM? /dev/ttyUSB?))
157
157
endif
158
158
 
168
168
# files
169
169
OBJECTS := $(addsuffix .o, $(basename $(SOURCES)))
170
170
ARDUINOSRCDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino
 
171
ARDUINOLIBSDIR := $(ARDUINODIR)/libraries
171
172
ARDUINOLIB := _arduino.a
172
173
ARDUINOLIBTMP := $(ARDUINOLIB).tmp
173
174
ARDUINOLIBOBJS := $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
174
175
        $(wildcard $(addprefix $(ARDUINOSRCDIR)/, *.c *.cpp)))))
175
176
ARDUINOLIBOBJS += $(foreach lib, $(LIBRARIES), \
176
177
        $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
177
 
        $(wildcard $(addprefix $(ARDUINODIR)/libraries/$(lib)/, \
178
 
                *.c *.cpp utility/*.c utility/*.cpp ))))))
 
178
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/, *.c *.cpp)) \
 
179
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/utility/, *.c *.cpp)) ))))
179
180
 
180
181
# obtain board parameters from the arduino boards.txt file
181
182
BOARDS_FILE := $(ARDUINODIR)/hardware/arduino/boards.txt
296
297
 
297
298
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.c
298
299
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
299
 
        $(COMPILE.cpp) -o $@ $<
 
300
        $(COMPILE.c) -o $@ $<
300
301
 
301
302
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.cpp
302
303
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)