summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lechner <david@pybricks.com>2022-07-18 11:40:27 -0500
committerDamien George <damien@micropython.org>2022-07-19 11:17:16 +1000
commitc947c2529427fedea2b6d7b1dead8b61f6e8a28d (patch)
treecf4045bb6605cc93b60d30b9a4f4f57b79fbce58
parente82aa2abc46f93abcbed2843c4f23f1838abb844 (diff)
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 <david@pybricks.com>
-rw-r--r--ports/unix/Makefile8
1 files changed, 6 insertions, 2 deletions
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index 04d2242a2..3b339c3d3 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