summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/unix/Makefile14
-rw-r--r--ports/unix/variants/coverage/mpconfigvariant.mk3
-rw-r--r--ports/unix/variants/fast/mpconfigvariant.mk2
-rw-r--r--ports/unix/variants/minimal/mpconfigvariant.mk2
4 files changed, 14 insertions, 7 deletions
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index a0225b265..ac6763186 100644
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -44,10 +44,18 @@ CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DI
# Debugging/Optimization
ifdef DEBUG
-CFLAGS += -g
-COPT = -O0
+COPT ?= -O0
else
-COPT = -Os -fdata-sections -ffunction-sections -DNDEBUG
+COPT ?= -Os
+COPT += -fdata-sections -ffunction-sections
+COPT += -DNDEBUG
+endif
+
+# Always enable symbols -- They're occasionally useful, and don't make it into the
+# final .bin/.hex/.dfu so the extra size doesn't matter.
+CFLAGS += -g
+
+ifndef DEBUG
# _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra
# security for detecting buffer overflows. Some distros (Ubuntu at the very least)
# have it enabled by default.
diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk
index 0bfc4f84c..d5c41a157 100644
--- a/ports/unix/variants/coverage/mpconfigvariant.mk
+++ b/ports/unix/variants/coverage/mpconfigvariant.mk
@@ -1,6 +1,7 @@
PROG ?= micropython-coverage
-COPT = -O0
+# Disable optimisations and enable assert() on coverage builds.
+DEBUG ?= 1
CFLAGS += \
-fprofile-arcs -ftest-coverage \
diff --git a/ports/unix/variants/fast/mpconfigvariant.mk b/ports/unix/variants/fast/mpconfigvariant.mk
index e6022291d..d67f7c8f3 100644
--- a/ports/unix/variants/fast/mpconfigvariant.mk
+++ b/ports/unix/variants/fast/mpconfigvariant.mk
@@ -1,6 +1,6 @@
# build synthetically fast interpreter for benchmarking
-COPT = "-O2 -DNDEBUG -fno-crossjumping"
+COPT += "-fno-crossjumping -O2"
PROG = micropython-fast
diff --git a/ports/unix/variants/minimal/mpconfigvariant.mk b/ports/unix/variants/minimal/mpconfigvariant.mk
index 3916c8c9a..ec3b21c0b 100644
--- a/ports/unix/variants/minimal/mpconfigvariant.mk
+++ b/ports/unix/variants/minimal/mpconfigvariant.mk
@@ -1,6 +1,4 @@
# build a minimal interpreter
-COPT = -Os -DNDEBUG
-
PROG = micropython-minimal
FROZEN_MANIFEST =