unix: Fix behaviour of COPT/NDEBUG for unix variants.
Based on eg 1e6fd9f2b4
, it's understood that
the intention for unix builds is that regular builds disable assert, but
the coverage build should set -O0 and enable asserts.
It looks like this didn't work (even before variants were introduced, eg at
v1.11) -- coverage always built with -Os and -DNDEBUG.
This commit makes it possible for variants to have finer-grained control
over COPT flags, and enables assert() and -O0 on coverage builds.
Other variants already match the defaults so they have been updated.
This commit is contained in:
parent
f66c989516
commit
45cf76465c
@ -44,10 +44,18 @@ CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DI
|
|||||||
|
|
||||||
# Debugging/Optimization
|
# Debugging/Optimization
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g
|
COPT ?= -O0
|
||||||
COPT = -O0
|
|
||||||
else
|
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
|
# _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)
|
# security for detecting buffer overflows. Some distros (Ubuntu at the very least)
|
||||||
# have it enabled by default.
|
# have it enabled by default.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
PROG ?= micropython-coverage
|
PROG ?= micropython-coverage
|
||||||
|
|
||||||
COPT = -O0
|
# Disable optimisations and enable assert() on coverage builds.
|
||||||
|
DEBUG ?= 1
|
||||||
|
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
-fprofile-arcs -ftest-coverage \
|
-fprofile-arcs -ftest-coverage \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# build synthetically fast interpreter for benchmarking
|
# build synthetically fast interpreter for benchmarking
|
||||||
|
|
||||||
COPT = "-O2 -DNDEBUG -fno-crossjumping"
|
COPT += "-fno-crossjumping -O2"
|
||||||
|
|
||||||
PROG = micropython-fast
|
PROG = micropython-fast
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# build a minimal interpreter
|
# build a minimal interpreter
|
||||||
COPT = -Os -DNDEBUG
|
|
||||||
|
|
||||||
PROG = micropython-minimal
|
PROG = micropython-minimal
|
||||||
|
|
||||||
FROZEN_MANIFEST =
|
FROZEN_MANIFEST =
|
||||||
|
Loading…
Reference in New Issue
Block a user