From e2659df9b9eeb7335130be251586dd88c64cba2d Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Sat, 21 Dec 2024 22:32:03 +0400 Subject: [PATCH] style: move common optimization options to var --- .build.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.build.sh b/.build.sh index 99cd3cf..ddbc18d 100644 --- a/.build.sh +++ b/.build.sh @@ -19,18 +19,20 @@ clone () { # optimizations set_cflags () { + opt="-Ofast -march=native" export \ - CFLAGS="-std=gnu2x -Ofast -march=native" \ - CPPFLAGS="-Ofast -march=native" \ + CFLAGS="-std=gnu2x $opt" \ + CPPFLAGS="$opt" \ LDFLAGS="-Wl,-O3" \ RUSTFLAGS="-C target-cpu=native -C panic=abort" } # in a separate fn because ring does not build with LTO use_lto () { + lto="-flto=auto -fwhole-program" export \ - CFLAGS="$CFLAGS -flto=auto -fwhole-program" \ - CPPFLAGS="$CPPFLAGS -flto=auto -fwhole-program" + CFLAGS="$CFLAGS $lto" \ + CPPFLAGS="$CPPFLAGS $lto" } # make -j12