/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-02-25 22:42:47 UTC
  • Revision ID: tim@ed.am-20130225224247-mlvghfkv6qiy0ns2
updated reference documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
#                         edam's Arduino makefile
4
4
#_______________________________________________________________________________
5
 
#                                                                 version 0.6dev
 
5
#                                                                 version 0.5dev
6
6
#
7
 
# Copyright (C) 2011, 2012, 2013 Tim Marston <tim@ed.am>.
 
7
# Copyright (C) 2011, 2012 Tim Marston <tim@ed.am>.
8
8
#
9
9
# Permission is hereby granted, free of charge, to any person obtaining a copy
10
10
# of this software and associated documentation files (the "Software"), to deal
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)
206
205
BOARD_UPLOAD_SPEED := $(call readboardsparam,upload.speed)
207
206
BOARD_UPLOAD_PROTOCOL := $(call readboardsparam,upload.protocol)
208
207
BOARD_USB_VID := $(call readboardsparam,build.vid)
248
247
 
249
248
# automatically determine included libraries
250
249
LIBRARIES := $(filter $(notdir $(wildcard $(addsuffix /*, $(LIBRARYPATH)))), \
251
 
        $(shell sed -nre "s/^\s*\#\s*include\s*[<\"](\S+)\.h[>\"].*/\1/p" \
252
 
        $(SOURCES)))
 
250
        $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(SOURCES)))
253
251
 
254
252
endif
255
253
 
264
262
AVRSIZE := $(call findsoftware,avr-size)
265
263
 
266
264
# directories
267
 
ARDUINOCOREDIR := $(ARDUINODIR)/hardware/arduino/cores/$(BOARD_BUILD_CORE)
 
265
ARDUINOCOREDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino
268
266
LIBRARYDIRS := $(foreach lib, $(LIBRARIES), \
269
267
        $(firstword $(wildcard $(addsuffix /$(lib), $(LIBRARYPATH)))))
270
268
LIBRARYDIRS += $(addsuffix /utility, $(LIBRARYDIRS))
301
299
CPPDEPFLAGS = -MMD -MP -MF .dep/$<.dep
302
300
CPPINOFLAGS := -x c++ -include $(ARDUINOCOREDIR)/Arduino.h
303
301
AVRDUDEFLAGS += $(addprefix -C , $(AVRDUDECONF)) -DV
304
 
AVRDUDEFLAGS += -p$(BOARD_BUILD_MCU) -P$(SERIALDEV) -c$(BOARD_UPLOAD_PROTOCOL)
305
 
AVRDUDEFLAGS += $(addprefix -b, $(BOARD_UPLOAD_SPEED))
 
302
AVRDUDEFLAGS += -p $(BOARD_BUILD_MCU) -P $(SERIALDEV)
 
303
AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED)
306
304
LINKFLAGS += -Os -Wl,--gc-sections -mmcu=$(BOARD_BUILD_MCU)
307
305
 
308
306
# figure out which arg to use with stty (for OS X, GNU and busybox stty)
337
335
ifeq "$(BOARD_BOOTLOADER_PATH)" "caterina"
338
336
        stty $(STTYFARG) $(SERIALDEV) speed 1200
339
337
        sleep 1
340
 
else
 
338
endif
341
339
        stty $(STTYFARG) $(SERIALDEV) hupcl
342
 
endif
343
340
        $(AVRDUDE) $(AVRDUDEFLAGS) -U flash:w:$(TARGET).hex:i
344
341
 
345
342
clean: