From 1ed3356540f55c9ed4167c87166f6d18b2868f9c Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 24 Jul 2017 15:50:47 +1000 Subject: [PATCH] py/py.mk: Make berkeley-db C-defs apply only to relevant source files. Otherwise they can interfere (eg redefinition of "abort") with other source files in a given uPy port. --- py/py.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/py/py.mk b/py/py.mk index 70891677d6..02f2df8e12 100644 --- a/py/py.mk +++ b/py/py.mk @@ -74,7 +74,7 @@ endif ifeq ($(MICROPY_PY_BTREE),1) BTREE_DIR = lib/berkeley-db-1.xx -CFLAGS_MOD += -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ -Dvirt_fd_t=mp_obj_t "-DVIRT_FD_T_HEADER=" +BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ -Dvirt_fd_t=mp_obj_t "-DVIRT_FD_T_HEADER=" INC += -I../$(BTREE_DIR)/PORT/include SRC_MOD += extmod/modbtree.c SRC_MOD += $(addprefix $(BTREE_DIR)/,\ @@ -95,7 +95,9 @@ mpool/mpool.c \ ) CFLAGS_MOD += -DMICROPY_PY_BTREE=1 # we need to suppress certain warnings to get berkeley-db to compile cleanly -$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter +# and we have separate BTREE_DEFS so the definitions don't interfere with other source code +$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS) +$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS) endif # py object files