Skip to content

Commit

Permalink
Move LTO logic from common.mk (qmk#14973)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored and ptrxyz committed Nov 6, 2021
1 parent 47be2e7 commit 5721ac2
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 30 deletions.
6 changes: 2 additions & 4 deletions keyboards/hub20/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LOCKING_RESYNC_ENABLE

/* disable these deprecated features by default */
#ifndef LINK_TIME_OPTIMIZATION_ENABLE
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
#endif
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
6 changes: 2 additions & 4 deletions keyboards/latin17rgb/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@
#define DEBOUNCE 3

/* disable these deprecated features by default */
//#ifndef LINK_TIME_OPTIMIZATION_ENABLE
//# define NO_ACTION_MACRO
//# define NO_ACTION_FUNCTION
//#endif
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

#ifdef RGB_MATRIX_ENABLE
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
Expand Down
6 changes: 2 additions & 4 deletions keyboards/latin6rgb/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@
#define DEBOUNCE 3

/* disable these deprecated features by default */
//#ifndef LINK_TIME_OPTIMIZATION_ENABLE
//# define NO_ACTION_MACRO
//# define NO_ACTION_FUNCTION
//#endif
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

#ifdef RGB_MATRIX_ENABLE
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
Expand Down
6 changes: 2 additions & 4 deletions keyboards/smallkeyboard/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@
#define DEBOUNCE 3

/* disable these deprecated features by default */
//#ifndef LINK_TIME_OPTIMIZATION_ENABLE
//# define NO_ACTION_MACRO
//# define NO_ACTION_FUNCTION
//#endif
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

#ifdef RGB_MATRIX_ENABLE
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
Expand Down
4 changes: 2 additions & 2 deletions keyboards/thevankeyboards/minivan/keymaps/josjoha/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// place overrides here

// Some defines meant to decrease the firmware size. The firmware is otherwise over the maximum (atmega32u4)
//# ifndef LINK_TIME_OPTIMIZATION_ENABLE
//# ifndef LTO_ENABLE
//Disable old style macro handling: MACRO() & action_get_macro
//# define NO_ACTION_MACRO // This saves 320 bytes
//disable calling of action_function() from the fn_actions array (deprecated)
Expand All @@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.


// Attempts to reduce firmware size:
//#define LINK_TIME_OPTIMIZATION_ENABLE // Did not decrease firmware size when tested on 26 Jan 2020
//#define LTO_ENABLE // Did not decrease firmware size when tested on 26 Jan 2020
//#define NO_DEBUG //disable debugging (already defined)
//#define NO_PRINT JJdisable printing/debugging using hid_listen (already defined)
//#define NO_ACTION_LAYER //disable layers (obviously need layers)
Expand Down
12 changes: 0 additions & 12 deletions tmk_core/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@ ifeq ($(strip $(SHARED_EP_ENABLE)), yes)
TMK_COMMON_DEFS += -DSHARED_EP_ENABLE
endif

ifeq ($(strip $(LTO_ENABLE)), yes)
ifeq ($(PLATFORM),CHIBIOS)
$(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
$(info If unsure, set LTO_ENABLE = no.)
endif
EXTRAFLAGS += -flto
TMK_COMMON_DEFS += -DLTO_ENABLE
TMK_COMMON_DEFS += -DLINK_TIME_OPTIMIZATON_ENABLE
else ifdef LINK_TIME_OPTIMIZATION_ENABLE
$(error The LINK_TIME_OPTIMIZATION_ENABLE flag has been renamed to LTO_ENABLE.)
endif

# Search Path
VPATH += $(TMK_PATH)/$(COMMON_DIR)
VPATH += $(TMK_PATH)/$(PLATFORM_COMMON_DIR)
Expand Down
9 changes: 9 additions & 0 deletions tmk_core/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ endif
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
ifeq ($(strip $(LTO_ENABLE)), yes)
ifeq ($(PLATFORM),CHIBIOS)
$(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
$(info If unsure, set LTO_ENABLE = no.)
endif
CDEFS += -flto
CDEFS += -DLTO_ENABLE
endif

DEBUG_ENABLE ?= yes
ifeq ($(strip $(SKIP_DEBUG_INFO)),yes)
DEBUG_ENABLE=no
Expand Down

0 comments on commit 5721ac2

Please sign in to comment.