diff --git a/client/Makefile b/client/Makefile index 28ac1f87c..bbaee39b0 100644 --- a/client/Makefile +++ b/client/Makefile @@ -135,25 +135,6 @@ endif LDLIBS += $(LUALIB) INCLUDES += $(LUALIBINC) -## Python3 -PYTHONINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags python3 2>/dev/null) -PYTHONLDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs python3 2>/dev/null) -ifneq ($(PYTHONLDLIBS),) - PYTHONLIB = $(PYTHONLDLIBS) - PYTHONLIBINC = $(PYTHONINCLUDES) - PYTHON_FOUND = 1 -else - PYTHONINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags python3-embed 2>/dev/null) - PYTHONLDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs python3-embed 2>/dev/null) - ifneq ($(PYTHONLDLIBS),) - PYTHONLIB = $(PYTHONLDLIBS) - PYTHONLIBINC = $(PYTHONINCLUDES) - PYTHON_FOUND = 1 - endif -endif -LDLIBS += $(PYTHONLIB) -INCLUDES += $(PYTHONLIBINC) - ## mbed TLS # system library cannot be used because it is compiled by default without CMAC support LDLIBS +=$(MBEDTLSLIB) @@ -219,13 +200,6 @@ endif LDLIBS += $(BTLIB) INCLUDES += $(BTLIBINC) -## Readline -ifeq ($(platform),Darwin) - LDLIBS += -L/usr/local/opt/readline/lib - INCLUDES += -I/usr/local/opt/readline/include -endif -LDLIBS += -lreadline - ## Math LDLIBS += -lm @@ -235,6 +209,28 @@ ifneq ($(SKIPPTHREAD),1) LDLIBS += -lpthread endif +## Python3 (optional) +ifneq ($(SKIPPYTHON),1) + PYTHONINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags python3 2>/dev/null) + PYTHONLDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs python3 2>/dev/null) + ifneq ($(PYTHONLDLIBS),) + PYTHONLIB = $(PYTHONLDLIBS) + PYTHONLIBINC = $(PYTHONINCLUDES) + PYTHON_FOUND = 1 + else + # since python3.8, applications willing to embed python must use -embed: + PYTHONINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags python3-embed 2>/dev/null) + PYTHONLDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs python3-embed 2>/dev/null) + ifneq ($(PYTHONLDLIBS),) + PYTHONLIB = $(PYTHONLDLIBS) + PYTHONLIBINC = $(PYTHONINCLUDES) + PYTHON_FOUND = 1 + endif + endif +endif +LDLIBS += $(PYTHONLIB) +INCLUDES += $(PYTHONLIBINC) + ## QT5 (or QT4 fallback) (optional) ifneq ($(SKIPQT),1) # Check for correctly configured Qt5 @@ -275,8 +271,12 @@ endif LDLIBS += $(QTLDLIBS) CXXINCLUDES += $(QTINCLUDES) -## Python - +## Readline +ifeq ($(platform),Darwin) + LDLIBS += -L/usr/local/opt/readline/lib + INCLUDES += -I/usr/local/opt/readline/include +endif +LDLIBS += -lreadline ####################################################################################################### CFLAGS ?= $(DEFCFLAGS) @@ -373,9 +373,9 @@ else endif ifeq ($(PYTHON_FOUND),1) - $(info Python3 version: Python3 v${shell pkg-config --modversion python3} found, enabled) + $(info Python3 library: Python3 v$(shell pkg-config --modversion python3) found, enabled) else - $(info Python library: Python3 not found, disabled) + $(info Python3 library: Python3 not found, disabled) endif ifeq ($(SKIPWHEREAMISYSTEM),1) diff --git a/doc/md/Development/Maintainers.md b/doc/md/Development/Maintainers.md index 0ea33b924..293fd3999 100644 --- a/doc/md/Development/Maintainers.md +++ b/doc/md/Development/Maintainers.md @@ -61,6 +61,7 @@ It's also possible to skip parts even if libraries are present in the compilatio * `make client SKIPQT=1` to skip GUI even if Qt is present * `make client SKIPBT=1` to skip native Bluetooth support even if libbluetooth is present +* `make client SKIPPYTHON=1` to skip embedded Python 3 interpreter even if libpython3 is present * `make client SKIPLUASYSTEM=1` to skip system Lua lib even if liblua5.2 is present, use embedded Lua lib instead * `make client SKIPJANSSONSYSTEM=1` to skip system Jansson lib even if libjansson is present, use embedded Jansson lib instead * `make client SKIPWHEREAMISYSTEM=1` to skip system Whereami lib even if libwhereami is present, use embedded whereami lib instead