From d8dd1e3d44eae0abc9df7d673178cd9777b62c67 Mon Sep 17 00:00:00 2001 From: heck Date: Mon, 28 Aug 2023 18:56:56 +0200 Subject: [PATCH] Build: add propper build configuration concept --- Makefile.conf | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile.conf b/Makefile.conf index a095768..17b3c36 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -3,8 +3,23 @@ # This file may be used under the terms of the GNU General Public License version 3 # see LICENSE -BUILD_CONF?=./build.conf --include $(BUILD_CONF) +# BUILD_CONF must be specified relative to the repo root or must be an absolute path +# BUILD_CONF defaults to ./build.conf +REPO_ROOT_REL:=$(dir $(lastword $(MAKEFILE_LIST))) +ifndef BUILD_CONF + BUILD_CONF=$(REPO_ROOT_REL)/build.conf + -include $(BUILD_CONF) +else + BUILD_CONF_EFF=$(BUILD_CONF) + ifeq ($(dir $(BUILD_CONF)),./) + BUILD_CONF_EFF=$(REPO_ROOT_REL)/$(BUILD_CONF) + endif + ifeq ($(wildcard $(BUILD_CONF_EFF)),) + $(info BUILD_CONF must be specified relative to the repo root or must be an absolute path) + $(error file specified using BUILD_CONF ($(BUILD_CONF)) not found) + endif + include $(BUILD_CONF_EFF) +endif TARGET=libpEpCxx11.a