From a9a310e40cd8f6505464dd595dd28f2987cdbf5c Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 24 Jul 2017 10:12:13 +0100 Subject: [CMake] Add a sanity check to the runtime build system so that we provide a better error message (and stop earlier) when no C source files are found. --- runtime/Makefile.cmake.bitcode.rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/Makefile.cmake.bitcode.rules b/runtime/Makefile.cmake.bitcode.rules index 472c979b..6ad23aed 100644 --- a/runtime/Makefile.cmake.bitcode.rules +++ b/runtime/Makefile.cmake.bitcode.rules @@ -82,6 +82,12 @@ endif LOCAL_BUILD_DIR := $(abspath $(ROOT_OBJ)/$(DIR_SUFFIX)) C_SRCS := $(sort $(shell echo $(SRC_DIR)/*.c)) + +# Sanity check: Make sure at least one source file was found +ifneq ($(strip $(filter %*.c,$(C_SRCS))),) +$(error Failed to find C source files in $(SRC_DIR)) +endif + C_SRCS_NO_DIR := $(notdir $(C_SRCS)) BC_FILES_NO_DIR := $(C_SRCS_NO_DIR:.c=.bc) BC_FILES := $(addprefix $(LOCAL_BUILD_DIR)/,$(BC_FILES_NO_DIR)) -- cgit 1.4.1