aboutsummaryrefslogtreecommitdiff
path: root/ports/unix/mpconfigport.h
diff options
context:
space:
mode:
authorJim Mussared2019-10-23 11:20:07 +1100
committerDamien George2020-01-12 10:34:23 +1100
commitbd2fff66875ed5adab8ce163a7f2bdafbd0332f9 (patch)
tree39d7903f1b7aad4fde4c9b06911c6170148f84de /ports/unix/mpconfigport.h
parent7d2ccd027fce61642a3a1177220d7f9c69f371f9 (diff)
unix: Add build variants, analogous to boards on bare-metal.
Invoking "make" will still build the standard "micropython" executable, but other variants are now build using, eg, "make VARIANT=minimal". This follows how bare-metal ports specify a particular board, and allows running any make target (eg clean, test) with any variant. Convenience targets (eg "make coverage") are provided to retain the old behaviour, at least for now. See issue #3043.
Diffstat (limited to 'ports/unix/mpconfigport.h')
-rw-r--r--ports/unix/mpconfigport.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h
index d633726a1..f435c3ff3 100644
--- a/ports/unix/mpconfigport.h
+++ b/ports/unix/mpconfigport.h
@@ -24,7 +24,15 @@
* THE SOFTWARE.
*/
-// options to control how MicroPython is built
+// Options to control how MicroPython is built for this port,
+// overriding defaults in py/mpconfig.h.
+
+// Variant-specific definitions.
+#include "mpconfigvariant.h"
+
+// The minimal variant's config covers everything.
+// If we're building the minimal variant, ignore the rest of this file.
+#ifndef MICROPY_UNIX_MINIMAL
#define MICROPY_ALLOC_PATH_MAX (PATH_MAX)
#define MICROPY_PERSISTENT_CODE_LOAD (1)
@@ -64,7 +72,9 @@
#define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
+#ifndef MICROPY_STREAMS_NON_BLOCK
#define MICROPY_STREAMS_NON_BLOCK (1)
+#endif
#define MICROPY_STREAMS_POSIX_API (1)
#define MICROPY_OPT_COMPUTED_GOTO (1)
#ifndef MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE
@@ -97,11 +107,13 @@
#define MICROPY_PERSISTENT_CODE_SAVE (1)
#define MICROPY_COMP_CONST (0)
#endif
+#ifndef MICROPY_PY_SYS_PLATFORM
#if defined(__APPLE__) && defined(__MACH__)
#define MICROPY_PY_SYS_PLATFORM "darwin"
#else
#define MICROPY_PY_SYS_PLATFORM "linux"
#endif
+#endif
#define MICROPY_PY_SYS_MAXSIZE (1)
#define MICROPY_PY_SYS_STDFILES (1)
#define MICROPY_PY_SYS_EXC_INFO (1)
@@ -331,3 +343,5 @@ void mp_unix_mark_exec(void);
// For debugging purposes, make printf() available to any source file.
#include <stdio.h>
#endif
+
+#endif // MICROPY_UNIX_MINIMAL