aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstepcut <jeremy@n-heptane.com>2014-10-22 15:27:59 -0500
committerstepcut <jeremy@n-heptane.com>2014-10-22 15:27:59 -0500
commit6534cf8f15e64df55bb98576e43fb46855bdbd2a (patch)
tree1bf50d2d2254fc8590423944c60491bf2b33b2ed
parent1f5e0b33671fe1032163a3a8e3af9366cd758b9b (diff)
move ARDUINO_DIR auto-detection into Common.mk. This allows Teensy.mk to use auto-detected location.
-rw-r--r--Arduino.mk23
-rw-r--r--Common.mk23
-rw-r--r--Teensy.mk33
-rw-r--r--examples/BlinkTeensy/Makefile1
4 files changed, 47 insertions, 33 deletions
diff --git a/Arduino.mk b/Arduino.mk
index 76a7d5e..beda93e 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -263,29 +263,6 @@ else
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)
ifndef TARGET
diff --git a/Common.mk b/Common.mk
index 0c1bc0b..b77c644 100644
--- a/Common.mk
+++ b/Common.mk
@@ -46,6 +46,29 @@ 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
ifneq ($(TEST),)
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 <jeremy@n-heptane.com> 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 =