/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: 2014-01-11 21:59:40 UTC
  • Revision ID: tim@ed.am-20140111215940-6o0v14fqk7rxdhu8
make usage of sed more portable (and tested on OS X); switch 1.5 support to
using new boards.txt layout from 1.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
BOARDSFILES := $(foreach dir, $(ARDUINOBACKENDS), \
196
196
        $(ARDUINODIR)/hardware/arduino$(dir)/boards.txt)
197
197
readboardsparam = $(firstword \
198
 
        $(shell sed -ne "s/^menu\\.cpu\\.$(BOARD)\\.$(1)=\(.*\)/\1/Ip" \
 
198
        $(shell sed -ne "s/^menu\\.cpu\\.$(BOARD)\\.$(1)=\(.*\)/\1/p" \
199
199
                $(BOARDSFILES)) \
200
 
        $(shell sed -ne "s/^$(basename $(BOARD))\\.$(1)=\(.*\)/\1/Ip" \
 
200
        $(shell sed -ne "s/^$(basename $(BOARD))\\.$(1)=\(.*\)/\1/p" \
201
201
                $(BOARDSFILES)))
202
202
BOARD_BUILD_MCU := $(call readboardsparam,build.mcu)
203
203
BOARD_BUILD_FCPU := $(call readboardsparam,build.f_cpu)
258
258
        $(wildcard $(addprefix utility/, *.c *.cc *.cpp *.C *.s *.S))
259
259
 
260
260
# automatically determine library directories (to pull library sources in from)
261
 
# by matching included headers in poject sources to headers that exist in the
 
261
# by matching included headers in project sources to headers that exist in the
262
262
# roots of any library directories, giving priority to libraries in the order
263
263
# they're in LIBRARYPATH, and then to the alphabetically-greater named library
264
264
# (this is a really stupid way of doing it, but it's how the IDE works -- if
265
265
# it's causing problems, you can override it by setting LIBRARIES manually)
266
 
INCLUDEDHEADERS := \
267
 
        $(shell sed -ne "s/^\s*\#\s*include\s*[<\"]\(\S\+\.h\)[>\"].*/\1/p" \
268
 
        $(SOURCES))
 
266
INCLUDEDHEADERS := $(shell sed -ne "/^[ \t]*\#[ \t]*include[ \t<\"]/ {" \
 
267
         -e "s/^.*[<\"]\(.*\)[>\"].*/\1/" -e "p" -e "}" $(SOURCES))
269
268
reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) \
270
269
        $(firstword $(1))
271
270
LIBRARYHEADERS := $(foreach dir, $(LIBRARYPATH), \
388
387
 
389
388
boards:
390
389
        @echo "Available BOARD values:"
391
 
        @sed -ne '/^\w\+\.name=/p; /^menu\.cpu\.\w\+\.\w\+=/p;' $(BOARDSFILES) | \
392
 
                sed -e 's/\(\w\+\)\.name=\(.*\)/\1                   \2/' \
393
 
                        -e 's/menu.cpu.\w\+\(\.\w\+\)=\(.*\)/  \1                  --\2/' \
394
 
                        -e 's/\(.\{19\}\) *\(.*\)/  \1 \2/; s/--/  ...with /;'
 
390
        @sed -ne '/[[:alnum:]]*\.name=/p' \
 
391
                -e '/^[[:alnum:]]*\.menu\.cpu\.[[:alnum:]]*=/p' $(BOARDSFILES) | \
 
392
                sed -e 's/\([[:alnum:]]*\)\.name=\(.*\)/\1                   \2/' \
 
393
                        -e 's/^.*\(\.[[:alnum:]]*\)=\(.*\)/  \1                  --\2/' \
 
394
                        -e 's/\(.\{19\}\) *\(.*\)/  \1 \2/' -e 's/--/  ...with /'
395
395
ifneq "$(ARDUINOBACKENDS)" "/"
396
396
        @echo
397
397
        @echo "NOTE: where a board supports multiple CPUs, you must specify" \