From cce41b32b8d4e3295c1737ee94beece22c7a567e Mon Sep 17 00:00:00 2001 From: IoI_xD Date: Tue, 31 Mar 2026 17:15:25 -0700 Subject: [PATCH] document tiny flag; have it use flto on clang --- doc/TINYCONFIG.md | 8 ++++++++ pl/rules.pl | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 doc/TINYCONFIG.md diff --git a/doc/TINYCONFIG.md b/doc/TINYCONFIG.md new file mode 100644 index 0000000..7ab60b5 --- /dev/null +++ b/doc/TINYCONFIG.md @@ -0,0 +1,8 @@ +# Tiny Config + +Milsko's configure script supports the `--tiny` option for building the tiniest possible Milsko library (~400kb as of writing). Currently, what it does is: + +- Add `-Oz` to the cflags +- (clang only) add `-flto=thin` to the cflags and linker flags +- Build stb-image with `STB_IMAGE_STATIC` (this is why you get warnings with stb_image when you use it) +- Disable the Wayland backend diff --git a/pl/rules.pl b/pl/rules.pl index 46810c7..d42f1ee 100644 --- a/pl/rules.pl +++ b/pl/rules.pl @@ -3,6 +3,10 @@ new_object("src/*.c"); my $gl_libs = ""; if (param_get("tiny")) { add_cflags("-Oz"); + if(defined($ENV{CC}) && grep(/^clang$/, $ENV{CC})) { + add_libs("-flto=thin"); + add_cflags("-flto=thin"); + } } if (param_get("classic-theme")) { add_cflags("-DUSE_CLASSIC_THEME");