/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: Tim Marston
  • Date: 2013-07-18 17:57:12 UTC
  • Revision ID: tim@ed.am-20130718175712-nxoqb246mfgfh811
updated regex that detects #included libraries

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
 
199
199
# obtain board parameters from the arduino boards.txt file
200
200
BOARDSFILE := $(ARDUINODIR)/hardware/arduino/boards.txt
201
 
readboardsparam = $(shell sed -ne "s/$(BOARD).$(1)=\(.*\)/\1/p" $(BOARDSFILE))
 
201
readboardsparam = $(shell sed -ne "s/^$(BOARD).$(1)=\(.*\)/\1/p" $(BOARDSFILE))
202
202
BOARD_BUILD_MCU := $(call readboardsparam,build.mcu)
203
203
BOARD_BUILD_FCPU := $(call readboardsparam,build.f_cpu)
204
204
BOARD_BUILD_VARIANT := $(call readboardsparam,build.variant)
 
205
BOARD_BUILD_CORE := $(call readboardsparam,build.core)
205
206
BOARD_UPLOAD_SPEED := $(call readboardsparam,upload.speed)
206
207
BOARD_UPLOAD_PROTOCOL := $(call readboardsparam,upload.protocol)
207
208
BOARD_USB_VID := $(call readboardsparam,build.vid)
247
248
 
248
249
# automatically determine included libraries
249
250
LIBRARIES := $(filter $(notdir $(wildcard $(addsuffix /*, $(LIBRARYPATH)))), \
250
 
        $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(SOURCES)))
 
251
        $(shell sed -nre "s/^\s*\#\s*include\s*[<\"](\S+)\.h[>\"].*/\1/p" \
 
252
        $(SOURCES)))
251
253
 
252
254
endif
253
255
 
262
264
AVRSIZE := $(call findsoftware,avr-size)
263
265
 
264
266
# directories
265
 
ARDUINOCOREDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino
 
267
ARDUINOCOREDIR := $(ARDUINODIR)/hardware/arduino/cores/$(BOARD_BUILD_CORE)
266
268
LIBRARYDIRS := $(foreach lib, $(LIBRARIES), \
267
269
        $(firstword $(wildcard $(addsuffix /$(lib), $(LIBRARYPATH)))))
268
270
LIBRARYDIRS += $(addsuffix /utility, $(LIBRARYDIRS))
299
301
CPPDEPFLAGS = -MMD -MP -MF .dep/$<.dep
300
302
CPPINOFLAGS := -x c++ -include $(ARDUINOCOREDIR)/Arduino.h
301
303
AVRDUDEFLAGS += $(addprefix -C , $(AVRDUDECONF)) -DV
302
 
AVRDUDEFLAGS += -p $(BOARD_BUILD_MCU) -P $(SERIALDEV)
303
 
AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED)
 
304
AVRDUDEFLAGS += -p$(BOARD_BUILD_MCU) -P$(SERIALDEV) -c$(BOARD_UPLOAD_PROTOCOL)
 
305
AVRDUDEFLAGS += $(addprefix -b, $(BOARD_UPLOAD_SPEED))
304
306
LINKFLAGS += -Os -Wl,--gc-sections -mmcu=$(BOARD_BUILD_MCU)
305
307
 
306
308
# figure out which arg to use with stty (for OS X, GNU and busybox stty)