@@ -462,3 +462,31 @@ CFLAGS += -DCIRCUITPY_WATCHDOG=$(CIRCUITPY_WATCHDOG)
462
462
463
463
CIRCUITPY_WIFI ?= 0
464
464
CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI )
465
+
466
+ # Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
467
+ # $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
468
+ # This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
469
+ #
470
+ # Also propagate longint choice from .mk to C. There's no easy string comparison
471
+ # in cpp conditionals, so we #define separate names for each.
472
+
473
+ ifeq ($(LONGINT_IMPL ) ,NONE)
474
+ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none
475
+ CFLAGS += -DLONGINT_IMPL_NONE
476
+ else ifeq ($(LONGINT_IMPL),MPZ)
477
+ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
478
+ CFLAGS += -DLONGINT_IMPL_MPZ
479
+ else ifeq ($(LONGINT_IMPL),LONGLONG)
480
+ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
481
+ CFLAGS += -DLONGINT_IMPL_LONGLONG
482
+ else
483
+ $(error LONGINT_IMPL set to surprising value : "$(LONGINT_IMPL ) ")
484
+ endif
485
+
486
+ # ##
487
+ ifeq ($(LONGINT_IMPL ) ,NONE)
488
+ else ifeq ($(LONGINT_IMPL),MPZ)
489
+ else ifeq ($(LONGINT_IMPL),LONGLONG)
490
+ else
491
+ $(error LONGINT_IMPL set to surprising value : "$(LONGINT_IMPL ) ")
492
+ endif
0 commit comments