/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-08 21:04:56 UTC
  • Revision ID: tim@ed.am-20140108210456-ep6ysunq9o5t7ejb
strip ./ from the path to the current file we're compiling so that, when
creating the dependencies directory, mkdir isn't given a path with ./ in (fixes
#12)

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/p" \
 
198
        $(shell sed -ne "s/^menu\\.cpu\\.$(BOARD)\\.$(1)=\(.*\)/\1/Ip" \
199
199
                $(BOARDSFILES)) \
200
 
        $(shell sed -ne "s/^$(basename $(BOARD))\\.$(1)=\(.*\)/\1/p" \
 
200
        $(shell sed -ne "s/^$(basename $(BOARD))\\.$(1)=\(.*\)/\1/Ip" \
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 project sources to headers that exist in the
 
261
# by matching included headers in poject 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 := $(shell sed -ne "/^[ \t]*\#[ \t]*include[ \t<\"]/ {" \
267
 
         -e "s/^.*[<\"]\(.*\)[>\"].*/\1/" -e "p" -e "}" $(SOURCES))
 
266
INCLUDEDHEADERS := \
 
267
        $(shell sed -ne "s/^\s*\#\s*include\s*[<\"]\(\S\+\.h\)[>\"].*/\1/p" \
 
268
        $(SOURCES))
268
269
reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) \
269
270
        $(firstword $(1))
270
271
LIBRARYHEADERS := $(foreach dir, $(LIBRARYPATH), \
387
388
 
388
389
boards:
389
390
        @echo "Available BOARD values:"
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 /'
 
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 /;'
395
395
ifneq "$(ARDUINOBACKENDS)" "/"
396
396
        @echo
397
397
        @echo "NOTE: where a board supports multiple CPUs, you must specify" \