diff --git a/Arduino.mk b/Arduino.mk index 76a7d5e..beda93e 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -262,29 +262,6 @@ else $(call show_config_variable,ARDMK_DIR,[USER]) endif -######################################################################## -# Arduino Directory - -ifndef ARDUINO_DIR - AUTO_ARDUINO_DIR := $(firstword \ - $(call dir_if_exists,/usr/share/arduino) \ - $(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java) ) - ifdef AUTO_ARDUINO_DIR - ARDUINO_DIR = $(AUTO_ARDUINO_DIR) - $(call show_config_variable,ARDUINO_DIR,[AUTODETECTED]) - else - echo $(error "ARDUINO_DIR is not defined") - endif -else - $(call show_config_variable,ARDUINO_DIR,[USER]) -endif - -ifeq ($(CURRENT_OS),WINDOWS) - ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),) - echo $(error On Windows, ARDUINO_DIR must be a relative path) - endif -endif - ######################################################################## # Default TARGET to pwd (ex Daniele Vergini) diff --git a/Common.mk b/Common.mk index 0c1bc0b..b77c644 100644 --- a/Common.mk +++ b/Common.mk @@ -45,6 +45,29 @@ else endif $(call show_config_variable,CURRENT_OS,[AUTODETECTED]) +######################################################################## +# Arduino Directory + +ifndef ARDUINO_DIR + AUTO_ARDUINO_DIR := $(firstword \ + $(call dir_if_exists,/usr/share/arduino) \ + $(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java) ) + ifdef AUTO_ARDUINO_DIR + ARDUINO_DIR = $(AUTO_ARDUINO_DIR) + $(call show_config_variable,ARDUINO_DIR,[AUTODETECTED]) + else + echo $(error "ARDUINO_DIR is not defined") + endif +else + $(call show_config_variable,ARDUINO_DIR,[USER]) +endif + +ifeq ($(CURRENT_OS),WINDOWS) + ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),) + echo $(error On Windows, ARDUINO_DIR must be a relative path) + endif +endif + ######################################################################## # # Travis-CI diff --git a/Teensy.mk b/Teensy.mk index 3b9676d..42282aa 100644 --- a/Teensy.mk +++ b/Teensy.mk @@ -4,7 +4,9 @@ # # https://www.pjrc.com/teensy/ # -# Example sketch: https://github.com/stepcut/teensy-blink +# You must install teensyduino for this Makefile to work: +# +# http://www.pjrc.com/teensy/teensyduino.html # # Copyright (C) 2014 Jeremy Shaw based on # work that is copyright Sudar, Nicholas Zambetti, David A. Mellis @@ -19,12 +21,18 @@ # # Original Arduino adaptation by mellis, eighthave, oli.keller # -# Current version: 1.3.4 -# # Refer to HISTORY.md file for complete history of changes # ######################################################################## + +ifndef ARDMK_DIR + ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))) +endif + +# include Common.mk now we know where it is +include $(ARDMK_DIR)/Common.mk + VENDOR = teensy ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3 BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(VENDOR)/boards.txt @@ -121,11 +129,22 @@ ifndef MCU MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.cpu) ifndef MCU MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.mcu) - else - MCU_FLAG_NAME=mcpu endif endif +ifndef MCU_FLAG_NAME + MCU_FLAG_NAME=mcpu +endif + +#ifndef MCU +# MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.cpu) +# ifndef MCU +# MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.mcu) +# else +# MCU_FLAG_NAME=mcpu +# endif +#endif + ######################################################################## # FLAGS @@ -159,8 +178,4 @@ RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOA ######################################################################## # automatially include Arduino.mk for the user -ifndef ARDMK_DIR - ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))) -endif - include $(ARDMK_DIR)/Arduino.mk diff --git a/examples/BlinkTeensy/Makefile b/examples/BlinkTeensy/Makefile index 84ae31f..1d59ef2 100644 --- a/examples/BlinkTeensy/Makefile +++ b/examples/BlinkTeensy/Makefile @@ -1,4 +1,3 @@ -ARDUINO_DIR = /home/stepcut/n-heptane/projects/arduino/arduino-1.0.6 BOARD_TAG = teensy31 ARDUINO_LIBS =