From c947c2529427fedea2b6d7b1dead8b61f6e8a28d Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 18 Jul 2022 11:40:27 -0500 Subject: [PATCH] unix/Makefile: Only checkout libffi submodule when used. This moves the libffi submodule variable modifier inside of the if statement where it is actually used so that the submodule will only be checked out if it is actually being used. A new DEPLIBS variable is also introduced to prevent building the libffi submodule when not needed. Signed-off-by: David Lechner --- ports/unix/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 04d2242a27..3b339c3d3f 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -30,7 +30,7 @@ UNAME_S := $(shell uname -s) include $(TOP)/py/py.mk include $(TOP)/extmod/extmod.mk -GIT_SUBMODULES += lib/berkeley-db-1.xx lib/libffi +GIT_SUBMODULES += lib/berkeley-db-1.xx INC += -I. INC += -I$(TOP) @@ -202,6 +202,9 @@ endif ifeq ($(MICROPY_PY_FFI),1) ifeq ($(MICROPY_STANDALONE),1) +# Build libffi from source. +GIT_SUBMODULES += lib/libffi +DEPLIBS += libffi LIBFFI_CFLAGS_MOD := -I$(shell ls -1d $(BUILD)/lib/libffi/out/lib/libffi-*/include) ifeq ($(MICROPY_FORCE_32BIT),1) LIBFFI_LDFLAGS_MOD = $(BUILD)/lib/libffi/out/lib32/libffi.a @@ -209,6 +212,7 @@ LIBFFI_CFLAGS_MOD := -I$(shell ls -1d $(BUILD)/lib/libffi/out/lib/libffi-*/inclu LIBFFI_LDFLAGS_MOD = $(BUILD)/lib/libffi/out/lib/libffi.a endif else +# Use system version of libffi. LIBFFI_CFLAGS_MOD := $(shell pkg-config --cflags libffi) LIBFFI_LDFLAGS_MOD := $(shell pkg-config --libs libffi) endif @@ -325,7 +329,7 @@ else CROSS_COMPILE_HOST = endif -deplibs: libffi +deplibs: $(DEPLIBS) libffi: $(BUILD)/lib/libffi/include/ffi.h