mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
scripts/config: allow alternate prefix to config option symbol
While the Linux kernel uses 'CONFIG_' as a prefix to the config options symbols, many projects that use kconfig may use different prefixes, or even none at all. If the CONFIG_ environment variable is set, use it as the prefix (empty is a valid prefix). Otherwise, use the default prefix 'CONFIG_'. This matches the support for alternate prefixes in scripts/kconfig/lkc.h, which uses the same logic (albeit with a C define instead of an environment variable). Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
parent
4edc7e32af
commit
f5ef2f7bf2
@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
# Manipulate options in a .config file from the command line
|
||||
|
||||
# If no prefix forced, use the default CONFIG_
|
||||
CONFIG_="${CONFIG_-CONFIG_}"
|
||||
|
||||
usage() {
|
||||
cat >&2 <<EOL
|
||||
Manipulate options in a .config file from the command line.
|
||||
@ -34,6 +37,9 @@ make time.
|
||||
|
||||
By default, config will upper-case the given symbol. Use --keep-case to keep
|
||||
the case of all following symbols unchanged.
|
||||
|
||||
config uses 'CONFIG_' as the default symbol prefix. Set the environment
|
||||
variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
|
||||
EOL
|
||||
exit 1
|
||||
}
|
||||
@ -44,8 +50,8 @@ checkarg() {
|
||||
usage
|
||||
fi
|
||||
case "$ARG" in
|
||||
CONFIG_*)
|
||||
ARG="${ARG/CONFIG_/}"
|
||||
${CONFIG_}*)
|
||||
ARG="${ARG/${CONFIG_}/}"
|
||||
;;
|
||||
esac
|
||||
if [ "$MUNGE_CASE" = "yes" ] ; then
|
||||
@ -107,37 +113,37 @@ while [ "$1" != "" ] ; do
|
||||
esac
|
||||
case "$CMD" in
|
||||
--enable|-e)
|
||||
set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
|
||||
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
|
||||
;;
|
||||
|
||||
--disable|-d)
|
||||
set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
|
||||
set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
|
||||
;;
|
||||
|
||||
--module|-m)
|
||||
set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
|
||||
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
|
||||
;;
|
||||
|
||||
--set-str)
|
||||
# sed swallows one level of escaping, so we need double-escaping
|
||||
set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\""
|
||||
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
|
||||
shift
|
||||
;;
|
||||
|
||||
--set-val)
|
||||
set_var "CONFIG_$ARG" "CONFIG_$ARG=$1"
|
||||
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
|
||||
shift
|
||||
;;
|
||||
|
||||
--state|-s)
|
||||
if grep -q "# CONFIG_$ARG is not set" $FN ; then
|
||||
if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
|
||||
echo n
|
||||
else
|
||||
V="$(grep "^CONFIG_$ARG=" $FN)"
|
||||
V="$(grep "^${CONFIG_}$ARG=" $FN)"
|
||||
if [ $? != 0 ] ; then
|
||||
echo undef
|
||||
else
|
||||
V="${V/#CONFIG_$ARG=/}"
|
||||
V="${V/#${CONFIG_}$ARG=/}"
|
||||
V="${V/#\"/}"
|
||||
V="${V/%\"/}"
|
||||
V="${V/\\\"/\"}"
|
||||
@ -147,15 +153,15 @@ while [ "$1" != "" ] ; do
|
||||
;;
|
||||
|
||||
--enable-after|-E)
|
||||
set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
|
||||
set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
|
||||
;;
|
||||
|
||||
--disable-after|-D)
|
||||
set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
|
||||
set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
|
||||
;;
|
||||
|
||||
--module-after|-M)
|
||||
set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
|
||||
set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
|
||||
;;
|
||||
|
||||
# undocumented because it ignores --file (fixme)
|
||||
|
Loading…
Reference in New Issue
Block a user