diff options
author | midipix <writeonce@midipix.org> | 2018-12-08 01:16:54 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-12-10 20:49:41 -0500 |
commit | f7cf5cd105b082729bd41fad9acb13afafbe5dd2 (patch) | |
tree | 8140c19c3a4e88a278ef323f5d8b9df4853aed7b | |
parent | 03cc75bba4f50253d6bfbcae0d392accd35789ce (diff) | |
download | ntux-f7cf5cd105b082729bd41fad9acb13afafbe5dd2.tar.bz2 ntux-f7cf5cd105b082729bd41fad9acb13afafbe5dd2.tar.xz |
build system: support custom configuration via cfgdefs.sh (and usrdefs.mk).
-rw-r--r-- | Makefile.in | 13 | ||||
-rw-r--r-- | config.project | 3 | ||||
-rwxr-xr-x | configure | 86 |
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 d5f5900..c11f2d3 100644 --- a/config.project +++ b/config.project @@ -72,3 +72,6 @@ mb_all_shared= mb_disable_frontend= mb_disable_static=yes mb_disable_shared=yes + +mb_use_custom_cfgdefs=no +mb_use_custom_usrdefs=no @@ -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 |