Commit 6f8880d0 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix: Move "utime" module config to C level instead of make level.

parent 70536212
......@@ -85,10 +85,6 @@ INC += -I../lib/mp-readline
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
LIB_SRC_C_EXTRA += mp-readline/readline.c
endif
ifeq ($(MICROPY_PY_TIME),1)
CFLAGS_MOD += -DMICROPY_PY_TIME=1
SRC_MOD += modtime.c
endif
ifeq ($(MICROPY_PY_TERMIOS),1)
CFLAGS_MOD += -DMICROPY_PY_TERMIOS=1
SRC_MOD += modtermios.c
......@@ -136,6 +132,7 @@ SRC_C = \
file.c \
modmachine.c \
modos.c \
modtime.c \
moduselect.c \
alloc.c \
coverage.c \
......@@ -234,7 +231,7 @@ fast:
# build a minimal interpreter
minimal:
$(MAKE) COPT="-Os -DNDEBUG" CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' BUILD=build-minimal PROG=micropython_minimal MICROPY_PY_TIME=0 MICROPY_PY_TERMIOS=0 MICROPY_PY_SOCKET=0 MICROPY_PY_FFI=0 MICROPY_USE_READLINE=0 MICROPY_FATFS=0
$(MAKE) COPT="-Os -DNDEBUG" CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' BUILD=build-minimal PROG=micropython_minimal MICROPY_PY_TERMIOS=0 MICROPY_PY_SOCKET=0 MICROPY_PY_FFI=0 MICROPY_USE_READLINE=0 MICROPY_FATFS=0
# build interpreter with nan-boxing as object model
nanbox:
......
......@@ -24,6 +24,9 @@
* THE SOFTWARE.
*/
#include "py/mpconfig.h"
#if MICROPY_PY_UTIME
#include <unistd.h>
#include <errno.h>
#include <string.h>
......@@ -190,3 +193,5 @@ const mp_obj_module_t mp_module_time = {
.name = MP_QSTR_utime,
.globals = (mp_obj_dict_t*)&mp_module_time_globals,
};
#endif // MICROPY_PY_UTIME
......@@ -103,6 +103,7 @@
#define MICROPY_STACKLESS_STRICT (0)
#define MICROPY_PY_OS_STATVFS (1)
#define MICROPY_PY_UTIME (1)
#define MICROPY_PY_UERRNO (1)
#define MICROPY_PY_UCTYPES (1)
#define MICROPY_PY_UZLIB (1)
......@@ -170,10 +171,10 @@ extern const struct _mp_obj_module_t mp_module_jni;
#else
#define MICROPY_PY_JNI_DEF
#endif
#if MICROPY_PY_TIME
#define MICROPY_PY_TIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) },
#if MICROPY_PY_UTIME
#define MICROPY_PY_UTIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) },
#else
#define MICROPY_PY_TIME_DEF
#define MICROPY_PY_UTIME_DEF
#endif
#if MICROPY_PY_TERMIOS
#define MICROPY_PY_TERMIOS_DEF { MP_ROM_QSTR(MP_QSTR_termios), MP_ROM_PTR(&mp_module_termios) },
......@@ -194,7 +195,7 @@ extern const struct _mp_obj_module_t mp_module_jni;
#define MICROPY_PORT_BUILTIN_MODULES \
MICROPY_PY_FFI_DEF \
MICROPY_PY_JNI_DEF \
MICROPY_PY_TIME_DEF \
MICROPY_PY_UTIME_DEF \
MICROPY_PY_SOCKET_DEF \
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \
......
......@@ -11,9 +11,6 @@ MICROPY_USE_READLINE = 1
# Whether to enable FatFs VFS
MICROPY_FATFS = 1
# Subset of CPython time module
MICROPY_PY_TIME = 1
# Subset of CPython termios module
MICROPY_PY_TERMIOS = 1
......
......@@ -77,6 +77,7 @@
#define MICROPY_PY_SYS_STDFILES (0)
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_UCTYPES (0)
#define MICROPY_PY_UTIME (0)
#define MICROPY_PY_UZLIB (0)
#define MICROPY_PY_UJSON (0)
#define MICROPY_PY_URE (0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment