From f9bbe0de4c97ca532d052106bb471756e55742ae Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 4 Mar 2024 16:25:14 +0100 Subject: [PATCH] Show guidance if the framework is not found Signed-off-by: Gilles Peskine --- CMakeLists.txt | 3 +++ library/Makefile | 8 ++++++++ scripts/common.make | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 154c84af6..174a99f6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,6 +277,9 @@ if(LIB_INSTALL_DIR) set(CMAKE_INSTALL_LIBDIR "${LIB_INSTALL_DIR}") endif() +if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt") + message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/framework/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") +endif() add_subdirectory(framework) add_subdirectory(include) diff --git a/library/Makefile b/library/Makefile index 67f91f6b4..2f4212474 100644 --- a/library/Makefile +++ b/library/Makefile @@ -2,6 +2,14 @@ ifndef MBEDTLS_PATH MBEDTLS_PATH := .. endif +ifeq (,$(wildcard $(MBEDTLS_PATH)/framework/exported.make)) +define error_message +$(MBEDTLS_PATH)/framework/exported.make not found. +Run `git submodule update --init` to fetch the submodule contents. +This is a fatal error +endef +$(error $(error_message)) +endif include $(MBEDTLS_PATH)/framework/exported.make # Also see "include/mbedtls/mbedtls_config.h" diff --git a/scripts/common.make b/scripts/common.make index 2da58d00e..9908a3c26 100644 --- a/scripts/common.make +++ b/scripts/common.make @@ -4,6 +4,16 @@ ifndef MBEDTLS_PATH MBEDTLS_PATH := .. endif +ifeq (,$(wildcard $(MBEDTLS_PATH)/framework/exported.make)) + # Use the define keyword to get a multi-line message. + # GNU make appends ". Stop.", so tweak the ending of our message accordingly. + define error_message +$(MBEDTLS_PATH)/framework/exported.make not found. +Run `git submodule update --init` to fetch the submodule contents. +This is a fatal error + endef + $(error $(error_message)) +endif include $(MBEDTLS_PATH)/framework/exported.make CFLAGS ?= -O2