Skip to content

Commit

Permalink
unix/Makefile: Only checkout libffi submodule when used.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dlech authored and dpgeorge committed Jul 19, 2022
1 parent e82aa2a commit c947c25
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ports/unix/Makefile
Expand Up @@ -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)
Expand Down Expand Up @@ -202,13 +202,17 @@ 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
else
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
Expand Down Expand Up @@ -325,7 +329,7 @@ else
CROSS_COMPILE_HOST =
endif

deplibs: libffi
deplibs: $(DEPLIBS)

libffi: $(BUILD)/lib/libffi/include/ffi.h

Expand Down

0 comments on commit c947c25

Please sign in to comment.