Skip to content

Commit be14561

Browse files
committed
docs: Enhance README with compiler-aware Link-Time Optimization (LTO) details
1 parent e263d52 commit be14561

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,34 @@ make debug VERBOSE=1
175175
# Release build without Link-Time Optimization (faster linking)
176176
make release USE_LTO=false
177177

178+
# Compiler-aware LTO (automatic: thin for Clang, auto for GCC)
179+
make release CXX=clang++ # Uses -flto=thin (optimized for Clang)
180+
make release CXX=g++ # Uses -flto=auto (optimized for GCC)
181+
178182
# Parallel build with 8 cores (release configuration)
179183
make -j8 release
180184
```
181185

186+
## 🔗 Link-Time Optimization (LTO)
187+
188+
The Makefile automatically selects the best LTO variant based on your compiler:
189+
190+
| Compiler | LTO Type | Benefit |
191+
|----------|----------|---------|
192+
| **Clang/clang++** | `-flto=thin` | Faster compilation, good optimization |
193+
| **GCC/g++** | `-flto=auto` | Best optimization, slower linking |
194+
| **Disabled** | (none) | Fastest build time |
195+
196+
```bash
197+
# Enable LTO (default in release builds)
198+
make release USE_LTO=true CXX=clang++ # Automatically uses thin LTO
199+
200+
# Disable LTO if linking is too slow
201+
make release USE_LTO=false
202+
```
203+
204+
### Parallel build with 8 cores (release configuration)
205+
182206
## 🔍 Compiler Warning Levels
183207

184208
Control compiler warning strictness with the **`WARN_LEVEL`** variable. Perfect for managing warnings in different project phases or integrating with CI/CD pipelines.

0 commit comments

Comments
 (0)