apps/tools/mkkconfig.sh: The top-level Kconfig file is not auto-generated. The autogenerated Kconfig file will be constructed so that every second level directory that contains a Kconfig file will automatically be sourced

This commit is contained in:
Gregory Nutt 2015-08-11 17:49:10 -06:00
parent c9e0baeb52
commit 74801cf38e
16 changed files with 176 additions and 52 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ Make.dep
core
.gdbinit
cscope.out
/Kconfig
/bin
/external
/.context

View File

@ -1373,3 +1373,20 @@
* apps/system/readline and apps/nshlib: Add support for an in-memory
command line history that can be retrieved using the up and down
arrows. Contributed by Nghia Ho (2015-08-09).
* apps/Makefile: No longer depends on hardcoded lists of directories.
Instead, it does a wildcard search to find all appropriate
directories. This means that to install a new application, you
simply have to copy the directory (or link it) into the apps/
directory. If the new directory includes a Makefile and Make.defs
file, the it will automatically be included in the build (2015-08-11).
* apps/Makefile, Kconfig, */Kconfig, tools/mkkconfig.sh: Add the tool
mkkconfig.sh that dynamically builds the apps/Kconfig file at
configuration time. The hardcoded configuration file has been removed
and now the top-level Makefile executes tools/mkkconfig.sh to auto-
generate the top-level Kconfig file. A new apps/ make target call
preconfig: was added to support this operation. Now you do not have
to modify the top-level Kconfig file to add a new directory into the
configuration; the top-level subdirectory simply needs to include a
Kconfig file and it will automatically be included in the
configuration. The native Windows build is temporarily broken until
a new apps/tools/mkconfig.bat script is generated (2015-08-11).

44
Kconfig
View File

@ -1,44 +0,0 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "Built-In Applications"
source "$APPSDIR/builtin/Kconfig"
endmenu
menu "Examples"
source "$APPSDIR/examples/Kconfig"
endmenu
menu "Graphics Support"
source "$APPSDIR/graphics/Kconfig"
endmenu
menu "Interpreters"
source "$APPSDIR/interpreters/Kconfig"
endmenu
menu "Network Utilities"
source "$APPSDIR/netutils/Kconfig"
endmenu
menu "FreeModBus"
source "$APPSDIR/modbus/Kconfig"
endmenu
menu "NSH Library"
source "$APPSDIR/nshlib/Kconfig"
endmenu
menu "NxWidgets/NxWM"
source "$APPSDIR/NxWidgets/Kconfig"
endmenu
menu "Platform-specific Support"
source "$APPSDIR/platform/Kconfig"
endmenu
menu "System Libraries and NSH Add-Ons"
source "$APPSDIR/system/Kconfig"
endmenu

View File

@ -40,15 +40,21 @@ TOPDIR ?= $(APPDIR)/import
-include $(TOPDIR)/Make.defs
# Tools
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
MKKCONFIG = ${shell $(APPDIR)\tools\mkkconfig.bat}
else
MKKCONFIG = ${shell $(APPDIR)/tools/mkkconfig.sh}
endif
# Application Directories
# BUILDIRS is the list of top-level directories containing Make.defs files
# CONFIGDIRS is the list all top-level directories containing Kconfig files
# CLEANDIRS is the list of all top-level directories containing Makefiles.
# It is used only for cleaning.
BUILDIRS := $(dir $(filter-out import/Make.defs,$(wildcard */Make.defs)))
CONFIGDIRS := $(dir $(wildcard */Kconfig))
CLEANDIRS := $(dir $(wildcard */Makefile))
# CONFIGURED_APPS is the application directories that should be built in
@ -77,7 +83,7 @@ BIN = libapps$(LIBEXT)
# Build targets
all: $(BIN)
.PHONY: import install context context_serialize context_rest .depdirs depend clean distclean
.PHONY: import install context context_serialize context_rest .depdirs preconfig depend clean distclean
define SDIR_template
$(1)_$(2):
@ -113,6 +119,11 @@ context_serialize:
context: context_serialize
Kconfig: $(MKKCONFIG)
$(MKKCONFIG)
preconfig: Kconfig
.depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
.depend: context Makefile .depdirs
@ -122,6 +133,7 @@ depend: .depend
clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BIN_DIR))
$(call CLEAN)
@ -141,4 +153,7 @@ else
)
endif
$(call DELFILE, .depend)
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BIN_DIR))
$(call CLEAN)

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "NxWidgets/NxWM"
config NXWIDGETS
bool "Enable NxWidgets"
default n
@ -1281,3 +1283,4 @@ endif # NXWM_MEDIAPLAYER
endmenu # NxWM Media Player Display Settings
endif # NXWM
endmenu # NxWidgets/NxWM

View File

@ -83,7 +83,7 @@ asynchronously with NSH. If you want to force NSH to execute commands
then wait for the command to execute, you can enable that feature by
adding the following to the NuttX configuration file:
CONFIG_SCHED_WAITPID=y
CONFIG_SCHED_WAITPID=y
The configuration option enables support for the waitpid() RTOS interface.
When that interface is enabled, NSH will use it to wait, sleeping until

View File

@ -3,7 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
if BUILTIN
menu "Built-In Applications"
depends on BUILTIN
config BUILTIN_PROXY_STACKSIZE
int "Builtin Proxy Stack Size"
@ -14,4 +15,4 @@ config BUILTIN_PROXY_STACKSIZE
configuration item specifies the stack size used for the proxy. Default:
1024 bytes.
endif
endmenu # Built-In Applications

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "Examples"
source "$APPSDIR/examples/adc/Kconfig"
source "$APPSDIR/examples/ajoystick/Kconfig"
source "$APPSDIR/examples/bastest/Kconfig"
@ -83,3 +85,5 @@ source "$APPSDIR/examples/watchdog/Kconfig"
source "$APPSDIR/examples/wget/Kconfig"
source "$APPSDIR/examples/wgetjson/Kconfig"
source "$APPSDIR/examples/xmlrpc/Kconfig"
endmenu # Examples

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "Graphics Support"
config TIFF
bool "TIFF file generation library"
default n
@ -31,4 +33,4 @@ source "$APPSDIR/graphics/traveler/Kconfig"
endmenu
endif # GRAPHICS_TRAVELER
endmenu # Graphics Support

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "Interpreters"
source "$APPSDIR/interpreters/bas/Kconfig"
source "$APPSDIR/interpreters/ficl/Kconfig"
@ -20,3 +22,4 @@ if INTERPRETERS_PCODE
endif
source "$APPSDIR/interpreters/micropython/Kconfig"
endmenu # Interpreters

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "FreeModBus"
config MODBUS
bool "Modbus support via FreeModBus"
default n
@ -159,3 +161,4 @@ config MB_MASTER_TOTAL_SLAVE_NUM
endif # MB_ASCII_MASTER || MB_RTU_MASTER
endif # MODBUS
endmenu # FreeModBus

View File

@ -3,7 +3,7 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
comment "Networking Utilities"
menu "Network Utilities"
source "$APPSDIR/netutils/codecs/Kconfig"
source "$APPSDIR/netutils/dhcpc/Kconfig"
@ -22,3 +22,5 @@ source "$APPSDIR/netutils/ntpclient/Kconfig"
source "$APPSDIR/netutils/discover/Kconfig"
source "$APPSDIR/netutils/xmlrpc/Kconfig"
source "$APPSDIR/netutils/pppd/Kconfig"
endmenu # Network Utilities

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "NSH Library"
config NSH_LIBRARY
bool "NSH Library"
default n
@ -1381,3 +1383,4 @@ endif # NSH_TELNET_LOGIN
endif # NSH_TELNET
endmenu # Telnet Configuration
endif # NSH_LIBRARY
endmenu # NSH Library

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "Platform-specific Support"
config PLATFORM_CONFIGDATA
bool "Platform configuration data"
default n
@ -15,3 +17,5 @@ config PLATFORM_CONFIGDATA
FLASH, etc.
source "$APPSDIR/platform/mikroe-stm32f4/Kconfig"
endmenu # Platform-specific Support

View File

@ -3,6 +3,8 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "System Libraries and NSH Add-Ons"
source "$APPSDIR/system/free/Kconfig"
source "$APPSDIR/system/cle/Kconfig"
source "$APPSDIR/system/cu/Kconfig"
@ -30,3 +32,4 @@ source "$APPSDIR/system/usbmonitor/Kconfig"
source "$APPSDIR/system/zmodem/Kconfig"
source "$APPSDIR/system/zoneinfo/Kconfig"
endmenu # System Libraries and NSH Add-Ons

107
tools/mkkconfig.sh Executable file
View File

@ -0,0 +1,107 @@
#!/bin/bash
# apps/tools/mkkconfig.sh
#
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Get the input parameter list
USAGE="USAGE: mkkconfig.sh [-d] [-h] [-t <topdir>] [-o <kconfig-file>]"
unset TOPDIR
KCONFIG=Kconfig
while [ ! -z "$1" ]; do
case $1 in
-d )
set -x
;;
-t )
shift
TOPDIR=$1
;;
-o )
shift
KCONFIG=$1
;;
-h )
echo $USAGE
exit 0
;;
* )
echo "ERROR: Unrecognized argument: $1"
echo $USAGE
exit 1
;;
esac
shift
done
# Check arguments
if [ -z "$TOPDIR" ]; then
if [ -x "tools/mkkconfig.sh" ]; then
TOPDIR=$PWD
else
cd .. || { echo "cd .. failed"; exit 1; }
if [ -x "tools/mkkconfig.sh" ]; then
TOPDIR=$PWD
else
echo "ERROR: This script must be executed from a known location"
echo " OR you must provide the <topdir> path in the command line"
echo $USAGE
exit 1
fi
fi
else
if [ ! -x "${TOPDIR}/tools/mkkconfig.sh" ]; then
echo "ERROR: <topdir> \"${TOPDIR}\" is not correct"
echo $USAGE
exit 1
fi
cd ${TOPDIR} || { echo "cd ${TOPDIR} failed"; exit 1; }
fi
if [ -f ${TOPDIR}/${KCONFIG} ]; then
rm ${TOPDIR}/${KCONFIG} || { echo "ERROR: Failed to remove ${TOPDIR}/${KCONFIG}"; exit 1; }
fi
KCONFIG_LIST=`ls -1 */Kconfig`
echo "#" > ${TOPDIR}/${KCONFIG}
echo "# For a description of the syntax of this configuration file," >> ${TOPDIR}/${KCONFIG}
echo "# see the file kconfig-language.txt in the NuttX tools repository." >> ${TOPDIR}/${KCONFIG}
echo "#" >> ${TOPDIR}/${KCONFIG}
echo "" >> ${TOPDIR}/${KCONFIG}
for FILE in ${KCONFIG_LIST}; do
echo "source \"\$APPSDIR/${FILE}\"" >> ${TOPDIR}/${KCONFIG}
done