diff --git a/.gitignore b/.gitignore index 7a658a38b..64741c525 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ Make.dep core .gdbinit cscope.out +/Kconfig /bin /external /.context diff --git a/ChangeLog.txt b/ChangeLog.txt index 3d104f937..b5039789a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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). diff --git a/Kconfig b/Kconfig deleted file mode 100644 index 7b21c6387..000000000 --- a/Kconfig +++ /dev/null @@ -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 diff --git a/Makefile b/Makefile index f444765d6..76b23eddd 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/NxWidgets/Kconfig b/NxWidgets/Kconfig index 018e5f9b6..d0026e492 100644 --- a/NxWidgets/Kconfig +++ b/NxWidgets/Kconfig @@ -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 diff --git a/README.txt b/README.txt index 909499378..b65a175e6 100644 --- a/README.txt +++ b/README.txt @@ -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 diff --git a/builtin/Kconfig b/builtin/Kconfig index 8ea51b38a..e8384234a 100644 --- a/builtin/Kconfig +++ b/builtin/Kconfig @@ -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 diff --git a/examples/Kconfig b/examples/Kconfig index bd90ae004..eaae41035 100644 --- a/examples/Kconfig +++ b/examples/Kconfig @@ -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 diff --git a/graphics/Kconfig b/graphics/Kconfig index 4e8b40809..8bfad9e8d 100644 --- a/graphics/Kconfig +++ b/graphics/Kconfig @@ -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 diff --git a/interpreters/Kconfig b/interpreters/Kconfig index 3bace79e4..bed828685 100644 --- a/interpreters/Kconfig +++ b/interpreters/Kconfig @@ -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 diff --git a/modbus/Kconfig b/modbus/Kconfig index 29b073c16..33b3b517a 100644 --- a/modbus/Kconfig +++ b/modbus/Kconfig @@ -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 diff --git a/netutils/Kconfig b/netutils/Kconfig index 4031a8b87..8c214c0c5 100644 --- a/netutils/Kconfig +++ b/netutils/Kconfig @@ -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 diff --git a/nshlib/Kconfig b/nshlib/Kconfig index d6a17d23b..d1de1e8c0 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -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 diff --git a/platform/Kconfig b/platform/Kconfig index 218119e85..8fd145b6e 100644 --- a/platform/Kconfig +++ b/platform/Kconfig @@ -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 diff --git a/system/Kconfig b/system/Kconfig index 7e4a61fe8..1d32f3a7e 100644 --- a/system/Kconfig +++ b/system/Kconfig @@ -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 diff --git a/tools/mkkconfig.sh b/tools/mkkconfig.sh new file mode 100755 index 000000000..714ca5117 --- /dev/null +++ b/tools/mkkconfig.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# apps/tools/mkkconfig.sh +# +# Copyright (C) 2015 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 ] [-o ]" +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 path in the command line" + echo $USAGE + exit 1 + fi + fi +else + if [ ! -x "${TOPDIR}/tools/mkkconfig.sh" ]; then + echo "ERROR: \"${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 +