/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to arduino.mk

  • Committer: Dan
  • Date: 2012-02-10 14:39:20 UTC
  • Revision ID: dan@waxworlds.org-20120210143920-7fwczt1h6pd9iee2
added up-to-date arduino.mk and symlinked to it from everywhere

Show diffs side-by-side

added added

removed removed

147
147
endif
148
148
 
149
149
# no target? use default
150
 
ifeq ($(TARGET), )
 
150
ifndef TARGET
151
151
TARGET := a.out
152
152
endif
153
153
 
154
154
# no serial device? attempt to detect an arduino
155
 
ifeq ($(SERIALDEV), )
 
155
ifndef 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
172
171
ARDUINOLIB := _arduino.a
173
 
ARDUINOLIBTMP := $(ARDUINOLIB).tmp
 
172
ARDUINOLIBTMP := _arduino.a.tmp
174
173
ARDUINOLIBOBJS := $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
175
174
        $(wildcard $(addprefix $(ARDUINOSRCDIR)/, *.c *.cpp)))))
176
175
ARDUINOLIBOBJS += $(foreach lib, $(LIBRARIES), \
177
176
        $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
178
 
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/, *.c *.cpp)) \
179
 
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/utility/, *.c *.cpp)) ))))
 
177
        $(wildcard $(addprefix $(ARDUINODIR)/libraries/$(lib)/, *.c *.cpp))))))
180
178
 
181
179
# obtain board parameters from the arduino boards.txt file
182
180
BOARDS_FILE := $(ARDUINODIR)/hardware/arduino/boards.txt
191
189
BOARD_UPLOAD_PROTOCOL := \
192
190
        $(shell sed -ne "s/$(BOARD).upload.protocol=\(.*\)/\1/p" $(BOARDS_FILE))
193
191
 
194
 
# prefer software that comes with arduino
195
 
TOOLSDIRPREFIX = $(wildcard $(ARDUINODIR)/hardware/tools/)
196
 
TOOLSAVRDIRPREFIX = $(wildcard $(ARDUINODIR)/hardware/tools/avr/)
197
 
 
198
 
# software (prioritise binaries that came with arduino software)
199
 
FIND_SOFTWARE = $(firstword $(wildcard \
200
 
        $(ARDUINODIR)/hardware/tools/$(1) \
201
 
        $(ARDUINODIR)/hardware/tools/avr/bin/$(1) \
202
 
        ) $(1) )
203
 
CC := $(call FIND_SOFTWARE,avr-gcc)
204
 
CXX := $(call FIND_SOFTWARE,avr-g++)
205
 
LD := $(call FIND_SOFTWARE,avr-ld)
206
 
AR := $(call FIND_SOFTWARE,avr-ar)
207
 
OBJCOPY := $(call FIND_SOFTWARE,avr-objcopy)
208
 
AVRDUDE := $(call FIND_SOFTWARE,avrdude)
 
192
# software
 
193
CC := avr-gcc
 
194
CXX := avr-g++
 
195
LD := avr-ld
 
196
AR := avr-ar
 
197
OBJCOPY := avr-objcopy
 
198
AVRDUDE := avrdude
209
199
 
210
200
# flags
211
201
CPPFLAGS = -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections
294
284
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/%.cpp
295
285
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
296
286
        $(COMPILE.cpp) -o $@ $<
297
 
 
298
 
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.c
299
 
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
300
 
        $(COMPILE.c) -o $@ $<
301
 
 
302
 
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.cpp
303
 
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
304
 
        $(COMPILE.cpp) -o $@ $<