move ARDUINO_DIR auto-detection into Common.mk. This allows Teensy.mk to use auto-detected location.

This commit is contained in:
stepcut 2014-10-22 15:27:59 -05:00
parent 1f5e0b3367
commit 6534cf8f15
4 changed files with 47 additions and 33 deletions

View file

@ -262,29 +262,6 @@ else
$(call show_config_variable,ARDMK_DIR,[USER]) $(call show_config_variable,ARDMK_DIR,[USER])
endif 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) # Default TARGET to pwd (ex Daniele Vergini)

View file

@ -45,6 +45,29 @@ else
endif endif
$(call show_config_variable,CURRENT_OS,[AUTODETECTED]) $(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 # Travis-CI

View file

@ -4,7 +4,9 @@
# #
# https://www.pjrc.com/teensy/ # 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 # Copyright (C) 2014 Jeremy Shaw <jeremy@n-heptane.com> based on
# work that is copyright Sudar, Nicholas Zambetti, David A. Mellis # work that is copyright Sudar, Nicholas Zambetti, David A. Mellis
@ -19,12 +21,18 @@
# #
# Original Arduino adaptation by mellis, eighthave, oli.keller # Original Arduino adaptation by mellis, eighthave, oli.keller
# #
# Current version: 1.3.4
#
# Refer to HISTORY.md file for complete history of changes # 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 VENDOR = teensy
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3 ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(VENDOR)/boards.txt BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(VENDOR)/boards.txt
@ -121,11 +129,22 @@ ifndef MCU
MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.cpu) MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.cpu)
ifndef MCU ifndef MCU
MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.mcu) MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.mcu)
else
MCU_FLAG_NAME=mcpu
endif endif
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 # FLAGS
@ -159,8 +178,4 @@ RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOA
######################################################################## ########################################################################
# automatially include Arduino.mk for the user # automatially include Arduino.mk for the user
ifndef ARDMK_DIR
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
endif
include $(ARDMK_DIR)/Arduino.mk include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,4 +1,3 @@
ARDUINO_DIR = /home/stepcut/n-heptane/projects/arduino/arduino-1.0.6
BOARD_TAG = teensy31 BOARD_TAG = teensy31
ARDUINO_LIBS = ARDUINO_LIBS =