From f798b8890e179aad762c4e1e80503773676edc25 Mon Sep 17 00:00:00 2001 From: Hubert Badocha Date: Fri, 4 Oct 2024 14:06:32 +0200 Subject: [PATCH] target: introduce HAVE_SHLIB variable JIRA: RTOS-664 --- makes/binary-dyn.mk | 4 ++++ makes/check-env.mk | 6 ++++++ makes/shared-lib.mk | 3 +++ target/armv7a.mk | 1 + target/armv7m.mk | 1 + target/armv8m.mk | 1 + target/armv8r.mk | 1 + target/ia32.mk | 1 + target/riscv64.mk | 1 + target/sparcv8leon.mk | 3 +++ 10 files changed, 22 insertions(+) diff --git a/makes/binary-dyn.mk b/makes/binary-dyn.mk index 38cd296d..33d9f208 100644 --- a/makes/binary-dyn.mk +++ b/makes/binary-dyn.mk @@ -3,6 +3,10 @@ # - DEP_LIBS_SHARED - shared libraries from current repo needed to be compiled/installed before this component (shortcut for putting something in LIBS and DEPS) # - LIBS_SHARED - names of the shared libs to link the binary against (without .so suffix) +ifeq (${HAVE_SHLIB},n) + $(warning "binary-dyn.mk called on target not supporting dynamic linking!") +endif + RESOLVED_LIBS_SHARED := $(patsubst lib%,-l%, $(DEP_LIBS_SHARED) $(LIBS_SHARED)) DEPS += $(DEP_LIBS_SHARED) diff --git a/makes/check-env.mk b/makes/check-env.mk index cb1b3478..2ebbd150 100644 --- a/makes/check-env.mk +++ b/makes/check-env.mk @@ -24,3 +24,9 @@ ifeq ($(HAVE_MMU), n) $(error "KERNEL_PHADDR is not set for NOMMU target, please check project configuration") endif endif + +ifeq ($(HAVE_SHLIB), n) + ifeq ($(LIBPHOENIX_SHARED), y) + $(error "LIBPHOENIX_SHARED is set for target without shared lib support, please check project configuration") + endif +endif diff --git a/makes/shared-lib.mk b/makes/shared-lib.mk index f7d936f2..3c332a1d 100644 --- a/makes/shared-lib.mk +++ b/makes/shared-lib.mk @@ -20,6 +20,9 @@ # # - LOCAL_INSTALL_PATH - custom rootfs dir for the shared library to be installed (if not provided - DEFAULT_INSTALL_PATH_SO) +ifeq (${HAVE_SHLIB},n) + $(warning "shared-lib.mk called on target not supporting shared libraries!") +endif # directory with current Makefile - relative to the repository root # filter-out all Makefiles outside of TOPDIR diff --git a/target/armv7a.mk b/target/armv7a.mk index b6efe35c..001b34bd 100644 --- a/target/armv7a.mk +++ b/target/armv7a.mk @@ -48,3 +48,4 @@ LIBPHOENIX_PIC ?= y LIBPHOENIX_SHARED ?= y HAVE_MMU := y +HAVE_SHLIB := y diff --git a/target/armv7m.mk b/target/armv7m.mk index 673795c4..a4d362a2 100644 --- a/target/armv7m.mk +++ b/target/armv7m.mk @@ -53,3 +53,4 @@ OBJCOPY := $(CROSS)objcopy OBJDUMP := $(CROSS)objdump HAVE_MMU := n +HAVE_SHLIB := n diff --git a/target/armv8m.mk b/target/armv8m.mk index 76a27ba7..ad512b67 100644 --- a/target/armv8m.mk +++ b/target/armv8m.mk @@ -48,3 +48,4 @@ OBJCOPY := $(CROSS)objcopy OBJDUMP := $(CROSS)objdump HAVE_MMU := n +HAVE_SHLIB := n diff --git a/target/armv8r.mk b/target/armv8r.mk index 2282cf19..3a903055 100644 --- a/target/armv8r.mk +++ b/target/armv8r.mk @@ -49,3 +49,4 @@ OBJCOPY := $(CROSS)objcopy OBJDUMP := $(CROSS)objdump HAVE_MMU := n +HAVE_SHLIB := n diff --git a/target/ia32.mk b/target/ia32.mk index ba057660..d900bc00 100644 --- a/target/ia32.mk +++ b/target/ia32.mk @@ -41,3 +41,4 @@ LIBPHOENIX_PIC ?= y LIBPHOENIX_SHARED ?= y HAVE_MMU := y +HAVE_SHLIB := y diff --git a/target/riscv64.mk b/target/riscv64.mk index 7c765443..21836233 100644 --- a/target/riscv64.mk +++ b/target/riscv64.mk @@ -41,3 +41,4 @@ LIBPHOENIX_PIC ?= y LIBPHOENIX_SHARED ?= y HAVE_MMU := y +HAVE_SHLIB := y diff --git a/target/sparcv8leon.mk b/target/sparcv8leon.mk index 55244ced..6496610b 100644 --- a/target/sparcv8leon.mk +++ b/target/sparcv8leon.mk @@ -37,6 +37,7 @@ ifeq ($(TARGET_SUBFAMILY), gr716) endif HAVE_MMU := n + HAVE_SHLIB := n else ifeq ($(TARGET_SUBFAMILY), gr712rc) ifeq ($(KERNEL), 1) @@ -52,6 +53,7 @@ else ifeq ($(TARGET_SUBFAMILY), gr712rc) LIBPHOENIX_SHARED ?= n HAVE_MMU := y + HAVE_SHLIB := n else ifeq ($(TARGET_SUBFAMILY), generic) ifeq ($(KERNEL), 1) CFLAGS += @@ -69,6 +71,7 @@ else ifeq ($(TARGET_SUBFAMILY), generic) LIBPHOENIX_SHARED ?= n HAVE_MMU := y + HAVE_SHLIB := n else $(error Incorrect TARGET.) endif