/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-03 17:02:32 UTC
  • Revision ID: tim@ed.am-20140103170232-ayjz27hf0ui2lnz9
added support for using avrdude's net:* and usb:* SERVIALDEVs

Show diffs side-by-side

added added

removed removed

42
42
#
43
43
#   $ ln -s ~/src/arduino.mk Makefile
44
44
#
45
 
# The Arduino software (version 1.0 or later, including the new 1.5 BETA) is
46
 
# required.  On GNU/Linux you can probably install the software from your
47
 
# package manager.  If you are using Debian (or a derivative), try `apt-get
48
 
# install arduino`.  Otherwise, you can download the Arduino software manually
49
 
# from http://arduino.cc/.  It is suggested that you install it at
50
 
# ~/opt/arduino (or /Applications on OS X) if you are unsure.
 
45
# The Arduino software is required, version 1.0 or later, including version 1.5
 
46
# (which is in BETA at time of release of this makefile).  On GNU/Linux you can
 
47
# probably install the software from your package manager.  If you are using
 
48
# Debian (or a derivative), try `apt-get install arduino`.  Otherwise, you can
 
49
# download the latest Arduino software manually from http://arduino.cc/.  In
 
50
# case you're unsure, install it at ~/opt/arduino (or /Applications on OS X).
51
51
#
52
52
# If you downloaded the Arduino software manually and unpacked it somewhere
53
53
# *other* than ~/opt/arduino (or /Applications), you will need to set up the
173
173
        $(HOME)/Applications/Arduino.app/Contents/Resources/Java))
174
174
endif
175
175
 
176
 
# check ARDUINODIR (and determine which backends are available)
 
176
# check arduino software exists and determine available backends
177
177
ifneq "" "$(wildcard $(ARDUINODIR)/hardware/arduino/boards.txt)"
178
178
ARDUINOBACKENDS := /
179
179
else ifneq "" "$(wildcard $(ARDUINODIR)/hardware/arduino/avr/boards.txt)"
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
266
INCLUDEDHEADERS := \
267
 
        $(shell sed -ne "s/^\s*\#\s*include\s*[<\"]\(\S\+\.h\)[>\"].*/\1/p" \
 
267
        $(shell sed -nre "s/^\s*\#\s*include\s*[<\"](\S+\.h)[>\"].*/\1/p" \
268
268
        $(SOURCES))
269
269
reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) \
270
270
        $(firstword $(1))
376
376
ifeq "$(BOARD_BOOTLOADER_PATH)" "caterina"
377
377
        stty $(STTYFARG) $(SERIALDEV) speed 1200
378
378
        sleep 1
379
 
else ifeq "" "$(filter net:% usb:%,$(SERIALDEV))"
 
379
else ifeq "" "$(filter net:%,$(SERIALDEV))"
380
380
        stty $(STTYFARG) $(SERIALDEV) hupcl
381
381
endif
382
382
        $(AVRDUDE) $(AVRDUDEFLAGS) -U flash:w:$(TARGET).hex:i
388
388
 
389
389
boards:
390
390
        @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 /;'
 
391
        @sed -nre '/^\w+\.name=/p; /^menu\.cpu\.\w+\.\w+=/p;' $(BOARDSFILES) | \
 
392
                sed -re 's/(\w+)\.name=(.*)/\1                   \2/' \
 
393
                        -e 's/menu.cpu.\w+(\.\w+)=(.*)/  \1                  --\2/' \
 
394
                        -e 's/(.{19}) *(.*)/  \1 \2/; s/--/  w\/ /;'
395
395
ifneq "$(ARDUINOBACKENDS)" "/"
396
396
        @echo
397
397
        @echo "NOTE: where a board supports multiple CPUs, you must specify" \
446
446
        $(CC) $(LINKFLAGS) $(OBJECTS) $(ARDUINOLIB) -lm -o $@
447
447
 
448
448
%.o: %.ino
449
 
        mkdir -p .dep/$(pathsubst ./%,%,$(dir $<))
 
449
        mkdir -p .dep/$(dir $<)
450
450
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $<
451
451
 
452
452
%.o: %.pde
453
 
        mkdir -p .dep/$(pathsubst ./%,%,$(dir $<))
 
453
        mkdir -p .dep/$(dir $<)
454
454
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $(CPPINOFLAGS) $<
455
455
 
456
456
%.o: %.c
457
 
        mkdir -p .dep/$(pathsubst ./%,%,$(dir $<))
 
457
        mkdir -p .dep/$(dir $<)
458
458
        $(COMPILE.c) $(CPPDEPFLAGS) -o $@ $<
459
459
 
460
460
%.o: %.cpp
461
 
        mkdir -p .dep/$(pathsubst ./%,%,$(dir $<))
 
461
        mkdir -p .dep/$(dir $<)
462
462
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $<
463
463
 
464
464
%.o: %.cc
465
 
        mkdir -p .dep/$(pathsubst ./%,%,$(dir $<))
 
465
        mkdir -p .dep/$(dir $<)
466
466
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $<
467
467
 
468
468
%.o: %.C
469
 
        mkdir -p .dep/$(pathsubst ./%,%,$(dir $<))
 
469
        mkdir -p .dep/$(dir $<)
470
470
        $(COMPILE.cpp) $(CPPDEPFLAGS) -o $@ $<
471
471
 
472
472
%.o: %.S
473
 
        mkdir -p .dep/$(pathsubst ./%,%,$(dir $<))
 
473
        mkdir -p .dep/$(dir $<)
474
474
        $(COMPILE.S) $(CPPDEPFLAGS) -o $@ $<
475
475
 
476
476
# building the arduino library