summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-08 01:16:54 -0500
committermidipix <writeonce@midipix.org>2018-12-10 20:49:14 -0500
commite271dd3b3992e68b2c0e70da3d3951b53a5a4dd9 (patch)
treedf877c82ae042915efc51846954329fceb0d3e76
parent9a5af6ba19b0ff2b1163162cd0515f9128538b70 (diff)
downloadmdso-e271dd3b3992e68b2c0e70da3d3951b53a5a4dd9.tar.bz2
mdso-e271dd3b3992e68b2c0e70da3d3951b53a5a4dd9.tar.xz
build system: support custom configuration via cfgdefs.sh (and usrdefs.mk).
-rw-r--r--Makefile.in13
-rw-r--r--config.project3
-rwxr-xr-xconfigure86
3 files changed, 99 insertions, 3 deletions
diff --git a/Makefile.in b/Makefile.in
index 89d4904..e117fa6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -100,6 +100,9 @@ DISABLE_FRONTEND = @disable_frontend@
DISABLE_SHARED = @disable_shared@
DISABLE_STATIC = @disable_static@
+USE_CUSTOM_CFGDEFS = @use_custom_cfgdefs@
+USE_CUSTOM_USRDEFS = @use_custom_usrdefs@
+
all:
install:
shared:
@@ -128,6 +131,13 @@ include $(PROJECT_DIR)/project/arch.mk
include $(PROJECT_DIR)/project/extras.mk
include $(PROJECT_DIR)/project/overrides.mk
+ifeq ($(USE_CUSTOM_CFGDEFS),yes)
+include ./cfgdefs.mk
+endif
+
+ifeq ($(USE_CUSTOM_USRDEFS),yes)
+include ./usrdefs.mk
+endif
$(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP)
@@ -434,6 +444,9 @@ clean: clean-implib
@echo DISABLE_FRONTEND:' '$(DISABLE_FRONTEND)
@echo DISABLE_SHARED:' '$(DISABLE_SHARED)
@echo DISABLE_STATIC:' '$(DISABLE_STATIC)
+ @echo
+ @echo USE_CUSTOM_CFGDEFS:' '$(USE_CUSTOM_CFGDEFS)
+ @echo USE_CUSTOM_USRDEFS:' '$(USE_CUSTOM_USRDEFS)
.display-host:
@$(CC) $(CFLAGS) -dumpmachine
diff --git a/config.project b/config.project
index 3844d0f..2bcbb56 100644
--- a/config.project
+++ b/config.project
@@ -71,3 +71,6 @@ mb_all_shared=
mb_disable_frontend=
mb_disable_static=
mb_disable_shared=
+
+mb_use_custom_cfgdefs=no
+mb_use_custom_usrdefs=no
diff --git a/configure b/configure
index e607fee..c75ad17 100755
--- a/configure
+++ b/configure
@@ -8,7 +8,28 @@
usage()
{
cat "$mb_project_dir"/config.usage
- exit $?
+
+ if [ $mb_use_custom_cfgdefs = 'yes' ]; then
+ printf '\n\n%s%s\n' \
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" \
+ "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
+
+ printf '%s%s\n' \
+ "| Listed above are configure's common switches " \
+ "and environment variables. |"
+
+ printf '%s%s\n' \
+ "| Found below are project-specific variables " \
+ "and other customization options. |"
+
+ printf '%s%s\n\n\n' \
+ " ___________________________________________" \
+ "__________________________________"
+
+ cat "$mb_project_dir"/project/config/cfgdefs.usage
+ fi
+
+ exit 0
}
error_msg()
@@ -33,6 +54,18 @@ init_vars()
. "$mb_config" || exit 2
fi
+ if [ $mb_use_custom_cfgdefs = 'yes' ]; then
+ mb_custom_cfgdefs_wrapper=$(mktemp)
+
+ if [ -z $mb_custom_cfgdefs_wrapper ]; then
+ error_msg "failed to create a temporary file."
+ exit 2
+ fi
+
+ printf '. $mb_project_dir/project/config/cfgdefs.sh \\\n' \
+ > $mb_custom_cfgdefs_wrapper
+ fi
+
# project
mb_nickname=$NICKNAME
mb_source_dir=$SOURCE_DIR
@@ -551,8 +584,19 @@ config_copy()
-e 's^@disable_frontend@^'"$mb_disable_frontend"'^g' \
-e 's^@disable_static@^'"$mb_disable_static"'^g' \
-e 's^@disable_shared@^'"$mb_disable_shared"'^g' \
+ \
+ -e 's^@use_custom_cfgdefs@^'"$mb_use_custom_cfgdefs"'^g' \
+ -e 's^@use_custom_usrdefs@^'"$mb_use_custom_usrdefs"'^g' \
$mb_project_dir/Makefile.in > $mb_pwd/Makefile.tmp || exit 2
+ if [ $mb_use_custom_cfgdefs = 'yes' ]; then
+ touch cfgdefs.mk
+ fi
+
+ if [ $mb_use_custom_usrdefs = 'yes' ]; then
+ touch usrdefs.mk
+ fi
+
if [ -z "$mb_cchost" ]; then
if [ "$mb_host" = 'native' ]; then
mb_cchost=`make -s -f $mb_pwd/Makefile.tmp cchost`
@@ -560,7 +604,24 @@ config_copy()
mb_cchost=$mb_host
fi
fi
+}
+
+
+config_custom()
+{
+ if [ $mb_use_custom_cfgdefs = 'yes' ]; then
+ . $mb_custom_cfgdefs_wrapper
+ config_copy
+ fi
+ if [ $mb_use_custom_usrdefs = 'yes' ]; then
+ . $mb_project_dir/project/usrdefs.sh
+ fi
+}
+
+
+config_cfghost()
+{
if [ -z "$mb_cfghost" ]; then
mb_cfghost=$mb_cchost
fi
@@ -831,8 +892,25 @@ for arg ; do
;;
*)
- error_msg ${arg#}: "unsupported config argument."
- exit 2
+ if [ $mb_use_custom_cfgdefs = 'yes' ]; then
+ printf '\t' >> $mb_custom_cfgdefs_wrapper
+
+ mb_first='yes'
+
+ for mb_arg in $arg; do
+ if [ $mb_first = 'yes' ]; then
+ printf '%s' $mb_arg >> $mb_custom_cfgdefs_wrapper
+ mb_first='no'
+ else
+ printf '\\ %s' $mb_arg >> $mb_custom_cfgdefs_wrapper
+ fi
+ done
+
+ printf ' \\\n' >> $mb_custom_cfgdefs_wrapper
+ else
+ error_msg ${arg#}: "unsupported config argument."
+ exit 2
+ fi
;;
esac
done
@@ -858,6 +936,8 @@ cross_defaults
# five: config
config_flags
config_copy
+config_custom
+config_cfghost
config_support
config_host
config_status