Created
March 16, 2015 09:28
-
-
Save mgcrea/00880542f1ce8f561ad6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Arduino.mk b/Arduino.mk | |
index 9045888..cf38545 100644 | |
--- a/Arduino.mk | |
+++ b/Arduino.mk | |
@@ -988,19 +988,32 @@ else | |
$(call show_config_variable,MCU_FLAG_NAME,[USER]) | |
endif | |
+ifndef CPPFLAGS | |
+ CPPFLAGS = -Wall -ffunction-sections -fdata-sections | |
+endif | |
+ | |
+ifndef CPUFLAGS | |
+ CPUFLAGS = -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) | |
+endif | |
+ | |
+ifndef DEFSFLAGS | |
+ DEFSFLAGS = -DARDUINO=$(ARDUINO_VERSION) $(ARDUINO_ARCH_FLAG) -D__PROG_TYPES_COMPAT__ | |
+endif | |
+ | |
# Using += instead of =, so that CPPFLAGS can be set per sketch level | |
-CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) $(ARDUINO_ARCH_FLAG) -D__PROG_TYPES_COMPAT__ \ | |
+CPPFLAGS += $(CPUFLAGS) $(DEFSFLAGS) \ | |
-I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ | |
- $(SYS_INCLUDES) $(PLATFORM_INCLUDES) $(USER_INCLUDES) -Wall -ffunction-sections \ | |
- -fdata-sections | |
+ $(SYS_INCLUDES) $(PLATFORM_INCLUDES) $(USER_INCLUDES) | |
-ifdef DEBUG | |
-OPTIMIZATION_FLAGS= $(DEBUG_FLAGS) | |
-else | |
-OPTIMIZATION_FLAGS = -O$(OPTIMIZATION_LEVEL) | |
+ifndef OPTIMIZATION_FLAGS | |
+ ifdef DEBUG | |
+ OPTIMIZATION_FLAGS= $(DEBUG_FLAGS) | |
+ else | |
+ OPTIMIZATION_FLAGS = -O$(OPTIMIZATION_LEVEL) | |
+ endif | |
endif | |
-CPPFLAGS += $(OPTIMIZATION_FLAGS) | |
+#CPPFLAGS += $(OPTIMIZATION_FLAGS) | |
# USB IDs for the Caterina devices like leonardo or micro | |
ifneq ($(CATERINA),) | |
@@ -1022,7 +1035,9 @@ else | |
endif | |
CFLAGS += $(CFLAGS_STD) | |
-CXXFLAGS += -fno-exceptions $(CXXFLAGS_STD) | |
+ifndef CXXFLAGS | |
+# CXXFLAGS += -fno-exceptions $(CXXFLAGS_STD) | |
+endif | |
ASFLAGS += -x assembler-with-cpp | |
LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL) | |
SIZEFLAGS ?= --mcu=$(MCU) -C | |
@@ -1199,7 +1214,8 @@ $(OBJDIR)/%.o: %.pde $(COMMON_DEPS) | $(OBJDIR) | |
# the ino -> o file | |
$(OBJDIR)/%.o: %.ino $(COMMON_DEPS) | $(OBJDIR) | |
@$(MKDIR) $(dir $@) | |
- $(CXX) -x c++ -include $(ARDUINO_HEADER) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ | |
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ | |
+# -x c++ -include $(ARDUINO_HEADER) -MMD | |
# generated assembly | |
$(OBJDIR)/%.s: %.pde $(COMMON_DEPS) | $(OBJDIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Teensy.mk b/Teensy.mk | |
index 8a441e7..39ff771 100644 | |
--- a/Teensy.mk | |
+++ b/Teensy.mk | |
@@ -34,8 +34,8 @@ endif | |
include $(ARDMK_DIR)/Common.mk | |
VENDOR = teensy | |
-ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3 | |
-BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(VENDOR)/boards.txt | |
+ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(VENDOR)/avr/cores/teensy3 | |
+BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(VENDOR)/avr/boards.txt | |
ifndef F_CPU | |
F_CPU=96000000 | |
@@ -135,28 +135,21 @@ endif | |
######################################################################## | |
# FLAGS | |
-ifndef USB_TYPE | |
- USB_TYPE = USB_SERIAL | |
-endif | |
- | |
-CPPFLAGS += -DLAYOUT_US_ENGLISH -D$(USB_TYPE) | |
-CPPFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.option) | |
+CPPFLAGS := -O $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.common) | |
+CPPFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpp) | |
+CPUFLAGS := $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpu) | |
+DEFSFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.defs) | |
+DEFSFLAGS += -DARDUINO=10601 -DF_CPU=96000000 -DARDUINO_ARCH_AVR -DUSB_SERIAL -DLAYOUT_US_ENGLISH | |
+OPTIMIZATION_FLAGS = $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.optimize) | |
-CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.cppoption) | |
+CXXFLAGS := | |
+#CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.cpp) | |
ifeq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.gnu0x)","true") | |
CXXFLAGS_STD += -std=gnu++0x | |
endif | |
-ifeq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.elide_constructors)", "true") | |
- CXXFLAGS += -felide-constructors | |
-endif | |
- | |
-LDFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.linkoption) $(call PARSE_TEENSY,$(BOARD_TAG),build.additionalobject) | |
- | |
-ifneq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)",) | |
- LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript) | |
-endif | |
+LDFLAGS := $(call PARSE_TEENSY,$(BOARD_TAG),build.flags.ld) | |
######################################################################## | |
# some fairly odd settings so that 'make upload' works |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment