d2a366
build system: support custom configuration via cfgdefs.sh (and usrdefs.mk).
@@ -100,6 +100,9 @@ DISABLE_FRONTEND = @disable_frontend@
|
|
100
100
|
DISABLE_SHARED = @disable_shared@
|
101
101
|
DISABLE_STATIC = @disable_static@
|
102
102
|
|
103
|
+
USE_CUSTOM_CFGDEFS = @use_custom_cfgdefs@
|
104
|
+
USE_CUSTOM_USRDEFS = @use_custom_usrdefs@
|
105
|
+
|
103
106
|
all:
|
104
107
|
install:
|
105
108
|
shared:
|
@@ -128,6 +131,13 @@ include $(PROJECT_DIR)/project/arch.mk
|
|
128
131
|
include $(PROJECT_DIR)/project/extras.mk
|
129
132
|
include $(PROJECT_DIR)/project/overrides.mk
|
130
133
|
|
134
|
+
ifeq ($(USE_CUSTOM_CFGDEFS),yes)
|
135
|
+
include ./cfgdefs.mk
|
136
|
+
endif
|
137
|
+
|
138
|
+
ifeq ($(USE_CUSTOM_USRDEFS),yes)
|
139
|
+
include ./usrdefs.mk
|
140
|
+
endif
|
131
141
|
|
132
142
|
|
133
143
|
(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP)
|
@@ -434,6 +444,9 @@ clean: clean-implib
|
|
434
444
|
@echo DISABLE_FRONTEND:' '$(DISABLE_FRONTEND)
|
435
445
|
@echo DISABLE_SHARED:' '$(DISABLE_SHARED)
|
436
446
|
@echo DISABLE_STATIC:' '$(DISABLE_STATIC)
|
447
|
+
@echo
|
448
|
+
@echo USE_CUSTOM_CFGDEFS:' '$(USE_CUSTOM_CFGDEFS)
|
449
|
+
@echo USE_CUSTOM_USRDEFS:' '$(USE_CUSTOM_USRDEFS)
|
437
450
|
|
438
451
|
.display-host:
|
439
452
|
@$(CC) $(CFLAGS) -dumpmachine
|
@@ -71,3 +71,6 @@ mb_all_shared=
|
|
71
71
|
mb_disable_frontend=
|
72
72
|
mb_disable_static=yes
|
73
73
|
mb_disable_shared=yes
|
74
|
+
|
75
|
+
mb_use_custom_cfgdefs=no
|
76
|
+
mb_use_custom_usrdefs=no
|
@@ -8,7 +8,28 @@
|
|
8
8
|
usage()
|
9
9
|
{
|
10
10
|
cat "$mb_project_dir"/config.usage
|
11
|
-
|
11
|
+
|
12
|
+
if [ $mb_use_custom_cfgdefs = 'yes' ]; then
|
13
|
+
printf '\n\n%s%s\n' \
|
14
|
+
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" \
|
15
|
+
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
16
|
+
|
17
|
+
printf '%s%s\n' \
|
18
|
+
"| Listed above are configure's common switches " \
|
19
|
+
"and environment variables. |"
|
20
|
+
|
21
|
+
printf '%s%s\n' \
|
22
|
+
"| Found below are project-specific variables " \
|
23
|
+
"and other customization options. |"
|
24
|
+
|
25
|
+
printf '%s%s\n\n\n' \
|
26
|
+
" ___________________________________________" \
|
27
|
+
"__________________________________"
|
28
|
+
|
29
|
+
cat "$mb_project_dir"/project/config/cfgdefs.usage
|
30
|
+
fi
|
31
|
+
|
32
|
+
exit 0
|
12
33
|
}
|
13
34
|
|
14
35
|
error_msg()
|
@@ -33,6 +54,18 @@ init_vars()
|
|
33
54
|
. "$mb_config" || exit 2
|
34
55
|
fi
|
35
56
|
|
57
|
+
if [ $mb_use_custom_cfgdefs = 'yes' ]; then
|
58
|
+
mb_custom_cfgdefs_wrapper=$(mktemp)
|
59
|
+
|
60
|
+
if [ -z $mb_custom_cfgdefs_wrapper ]; then
|
61
|
+
error_msg "failed to create a temporary file."
|
62
|
+
exit 2
|
63
|
+
fi
|
64
|
+
|
65
|
+
printf '. $mb_project_dir/project/config/cfgdefs.sh \\\n' \
|
66
|
+
> $mb_custom_cfgdefs_wrapper
|
67
|
+
fi
|
68
|
+
|
36
69
|
# project
|
37
70
|
mb_nickname=$NICKNAME
|
38
71
|
mb_source_dir=$SOURCE_DIR
|
@@ -551,8 +584,19 @@ config_copy()
|
|
551
584
|
-e 's^@disable_frontend@^'"$mb_disable_frontend"'^g' \
|
552
585
|
-e 's^@disable_static@^'"$mb_disable_static"'^g' \
|
553
586
|
-e 's^@disable_shared@^'"$mb_disable_shared"'^g' \
|
587
|
+
\
|
588
|
+
-e 's^@use_custom_cfgdefs@^'"$mb_use_custom_cfgdefs"'^g' \
|
589
|
+
-e 's^@use_custom_usrdefs@^'"$mb_use_custom_usrdefs"'^g' \
|
554
590
|
$mb_project_dir/Makefile.in > $mb_pwd/Makefile.tmp || exit 2
|
555
591
|
|
592
|
+
if [ $mb_use_custom_cfgdefs = 'yes' ]; then
|
593
|
+
touch cfgdefs.mk
|
594
|
+
fi
|
595
|
+
|
596
|
+
if [ $mb_use_custom_usrdefs = 'yes' ]; then
|
597
|
+
touch usrdefs.mk
|
598
|
+
fi
|
599
|
+
|
556
600
|
if [ -z "$mb_cchost" ]; then
|
557
601
|
if [ "$mb_host" = 'native' ]; then
|
558
602
|
mb_cchost=`make -s -f $mb_pwd/Makefile.tmp cchost`
|
@@ -560,7 +604,24 @@ config_copy()
|
|
560
604
|
mb_cchost=$mb_host
|
561
605
|
fi
|
562
606
|
fi
|
607
|
+
}
|
608
|
+
|
609
|
+
|
610
|
+
config_custom()
|
611
|
+
{
|
612
|
+
if [ $mb_use_custom_cfgdefs = 'yes' ]; then
|
613
|
+
. $mb_custom_cfgdefs_wrapper
|
614
|
+
config_copy
|
615
|
+
fi
|
563
616
|
|
617
|
+
if [ $mb_use_custom_usrdefs = 'yes' ]; then
|
618
|
+
. $mb_project_dir/project/usrdefs.sh
|
619
|
+
fi
|
620
|
+
}
|
621
|
+
|
622
|
+
|
623
|
+
config_cfghost()
|
624
|
+
{
|
564
625
|
if [ -z "$mb_cfghost" ]; then
|
565
626
|
mb_cfghost=$mb_cchost
|
566
627
|
fi
|
@@ -831,8 +892,25 @@ for arg ; do
|
|
831
892
|
;;
|
832
893
|
|
833
894
|
*)
|
834
|
-
|
835
|
-
|
895
|
+
if [ $mb_use_custom_cfgdefs = 'yes' ]; then
|
896
|
+
printf '\t' $mb_custom_cfgdefs_wrapper
|
897
|
+
|
898
|
+
mb_first='yes'
|
899
|
+
|
900
|
+
for mb_arg in $arg; do
|
901
|
+
if [ $mb_first = 'yes' ]; then
|
902
|
+
printf '%s' $mb_arg $mb_custom_cfgdefs_wrapper
|
903
|
+
mb_first='no'
|
904
|
+
else
|
905
|
+
printf '\\ %s' $mb_arg $mb_custom_cfgdefs_wrapper
|
906
|
+
fi
|
907
|
+
done
|
908
|
+
|
909
|
+
printf ' \\\n' $mb_custom_cfgdefs_wrapper
|
910
|
+
else
|
911
|
+
error_msg ${arg#}: "unsupported config argument."
|
912
|
+
exit 2
|
913
|
+
fi
|
836
914
|
;;
|
837
915
|
esac
|
838
916
|
done
|
@@ -858,6 +936,8 @@ cross_defaults
|
|
858
936
|
five: config
|
859
937
|
config_flags
|
860
938
|
config_copy
|
939
|
+
config_custom
|
940
|
+
config_cfghost
|
861
941
|
config_support
|
862
942
|
config_host
|
863
943
|
config_status
|