diff --git a/HISTORY.md b/HISTORY.md index 9ca135a..7f2c1dd 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -15,6 +15,7 @@ The following is the rough list of changes that went into different versions. I - Remove dependency on wait-connection-leonardo shell script. Fix issue #95 - Add support for the Digilent chipKIT platform. (https://github.com/peplin) - Implement ard-parse-boards with shell scripting instead of Perl (https://github.com/peplin) +- Compile with debugging symbols only when DEBUG=1 (https://github.com/peplin) ### 0.12.0 (2013-06-20) - Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman) diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index a494293..9a3fc06 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -764,8 +764,14 @@ 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) \ -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ - $(SYS_INCLUDES) $(USER_INCLUDES) -g -O$(OPTIMIZATION_LEVEL) -Wall \ - -ffunction-sections -fdata-sections + $(SYS_INCLUDES) $(USER_INCLUDES) -Wall -ffunction-sections \ + -fdata-sections + +ifdef DEBUG +CPPFLAGS += -O0 -g +else +CPPFLAGS += -O$(OPTIMIZATION_LEVEL) +endif # USB IDs for the Leonardo ifeq ($(VARIANT),leonardo)