From e370999e378bf5040ef6348e2a0720bc3ec4f773 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 28 Aug 2024 15:39:38 +1000 Subject: [PATCH] unix: Add a description of COPT in the README. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton --- ports/unix/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/unix/README.md b/ports/unix/README.md index 648152263..953c83ef7 100644 --- a/ports/unix/README.md +++ b/ports/unix/README.md @@ -142,8 +142,16 @@ By default, builds are stripped of symbols and debug information to save size. To build a debuggable version of the Unix port, there are two options: 1. Run `make [other arguments] DEBUG=1`. Note setting `DEBUG` also reduces the - optimisation level, so it's not a good option for builds that also want the - best performance. + optimisation level and enables assertions, so it's not a good option for + builds that also want the best performance. 2. Run `make [other arguments] STRIP=`. Note that the value of `STRIP` is empty. This will skip the build step that strips symbols and debug information, but changes nothing else in the build configuration. + +### Optimisation Level + +The default compiler optimisation level is -Os, or -Og if `DEBUG=1` is set. + +Setting the variable `COPT` will explicitly set the optimisation level. For +example `make [other arguments] COPT=-O0 DEBUG=1` will build a binary with no +optimisations, assertions enabled, and debug symbols.