From 28c1822ec742ea0d469a3631115ed68507c1179e Mon Sep 17 00:00:00 2001
From: Kimplul <kimi.h.kuparinen@gmail.com>
Date: Sat, 4 Jan 2025 00:03:07 +0200
Subject: add LTO compilation flag

---
 scripts/makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'scripts/makefile')

diff --git a/scripts/makefile b/scripts/makefile
index c1de16e..0b4f42b 100644
--- a/scripts/makefile
+++ b/scripts/makefile
@@ -4,6 +4,10 @@ OPTFLAGS	!= [ "$(RELEASE)" != "0" ] \
 			&& echo "-O2" \
 			|| echo "-O0"
 
+LTO		?= 0
+LTOFLAGS	!= [ "$(LTO)" != "0" ] \
+			&& echo "-flto=auto"
+
 DEBUG		?= 1
 DEBUGFLAGS	!= [ "$(DEBUG)" != "0" ] \
 			&& echo "-DDEBUG=1" \
@@ -34,8 +38,8 @@ OBFLAGS		:= -g
 # interpreter is allowed to have uninitialized values
 WARNFLAGS	:= -Wall -Wextra -Wno-maybe-uninitialized
 
-COMPILE_FLAGS	:= $(CFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(OBFLAGS) $(ASSERTFLAGS) \
-		   $(DEBUGFLAGS)
+COMPILE_FLAGS	:= $(CFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(LTOFLAGS) \
+		   $(OBFLAGS) $(ASSERTFLAGS) $(DEBUGFLAGS)
 
 INCLUDE_FLAGS	:= -I include
 
-- 
cgit v1.2.3