2019-08-10 19:16:33 +02:00
|
|
|
#!/usr/bin/env bash
|
2015-08-12 01:49:10 +02:00
|
|
|
# apps/tools/mkkconfig.sh
|
|
|
|
#
|
2021-06-10 07:37:15 +02:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
2015-08-12 01:49:10 +02:00
|
|
|
#
|
2021-06-10 07:37:15 +02:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2015-08-12 01:49:10 +02:00
|
|
|
#
|
2021-06-10 07:37:15 +02:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2015-08-12 01:49:10 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
# Get the input parameter list
|
|
|
|
|
2016-06-02 16:34:00 +02:00
|
|
|
USAGE="USAGE: mkkconfig.sh [-d] [-h] [-m <menu>] [-o <kconfig-file>]"
|
2015-08-12 01:49:10 +02:00
|
|
|
KCONFIG=Kconfig
|
2016-06-02 16:34:00 +02:00
|
|
|
unset MENU
|
2015-08-12 01:49:10 +02:00
|
|
|
|
|
|
|
while [ ! -z "$1" ]; do
|
|
|
|
case $1 in
|
|
|
|
-d )
|
|
|
|
set -x
|
|
|
|
;;
|
2016-06-02 16:34:00 +02:00
|
|
|
-m )
|
2015-08-12 01:49:10 +02:00
|
|
|
shift
|
2016-06-02 16:34:00 +02:00
|
|
|
MENU=$1
|
2015-08-12 01:49:10 +02:00
|
|
|
;;
|
|
|
|
-o )
|
|
|
|
shift
|
|
|
|
KCONFIG=$1
|
|
|
|
;;
|
|
|
|
-h )
|
|
|
|
echo $USAGE
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo "ERROR: Unrecognized argument: $1"
|
|
|
|
echo $USAGE
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2016-06-02 16:34:00 +02:00
|
|
|
if [ -f ${KCONFIG} ]; then
|
|
|
|
rm ${KCONFIG} || { echo "ERROR: Failed to remove $PWD/${KCONFIG}"; exit 1; }
|
2015-08-12 01:49:10 +02:00
|
|
|
fi
|
|
|
|
|
2016-06-02 16:34:00 +02:00
|
|
|
echo mkkconfig in $PWD
|
2015-08-12 01:49:10 +02:00
|
|
|
|
2016-06-02 16:34:00 +02:00
|
|
|
KCONFIG_LIST=`ls -1 $PWD/*/Kconfig`
|
2015-08-12 01:49:10 +02:00
|
|
|
|
2016-06-02 16:34:00 +02:00
|
|
|
echo "#" > ${KCONFIG}
|
|
|
|
echo "# For a description of the syntax of this configuration file," >> ${KCONFIG}
|
|
|
|
echo "# see the file kconfig-language.txt in the NuttX tools repository." >> ${KCONFIG}
|
|
|
|
echo "#" >> ${KCONFIG}
|
|
|
|
echo "# This file is autogenerated, do not edit." >> ${KCONFIG}
|
|
|
|
echo "#" >> ${KCONFIG}
|
|
|
|
echo "" >> ${KCONFIG}
|
|
|
|
|
|
|
|
if [ ! -z "${MENU}" ]; then
|
|
|
|
echo "menu \"${MENU}\"" >> ${KCONFIG}
|
|
|
|
fi
|
2015-08-12 01:49:10 +02:00
|
|
|
|
|
|
|
for FILE in ${KCONFIG_LIST}; do
|
2016-06-02 16:34:00 +02:00
|
|
|
echo "source \"${FILE}\"" >> ${KCONFIG}
|
2015-08-12 01:49:10 +02:00
|
|
|
done
|
|
|
|
|
2016-06-02 16:34:00 +02:00
|
|
|
if [ ! -z "${MENU}" ]; then
|
|
|
|
echo "endmenu # ${MENU}" >> ${KCONFIG}
|
|
|
|
fi
|