Autogenerate apps/Kconfig
authorjunmin kim <junmindd.kim@samsung.com>
Mon, 27 Mar 2017 13:12:13 +0000 (06:12 -0700)
committerjunmin kim <junmindd.kim@samsung.com>
Tue, 28 Mar 2017 04:48:30 +0000 (21:48 -0700)
Update nuttx-7.17 app structure

12 files changed:
apps/.gitignore
apps/Kconfig [deleted file]
apps/Make.defs
apps/Makefile
apps/examples/Kconfig
apps/netutils/Kconfig
apps/platform/Kconfig
apps/shell/Kconfig
apps/system/Kconfig
apps/tools/mkkconfig.bat [new file with mode: 0755]
apps/tools/mkkconfig.sh [new file with mode: 0755]
os/Makefile.unix

index 9c90dbe..1de4a40 100644 (file)
@@ -1,3 +1,4 @@
+/Kconfig
 /bin
 /external
 /.context
diff --git a/apps/Kconfig b/apps/Kconfig
deleted file mode 100644 (file)
index 21de00a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
-#
-
-menu "Examples"
-source "$APPSDIR/examples/Kconfig"
-endmenu
-
-menu "Network Utilities"
-source "$APPSDIR/netutils/Kconfig"
-endmenu
-
-menu "Platform-specific Support"
-source "$APPSDIR/platform/Kconfig"
-endmenu
-
-menu "Enable Shell"
-source "$APPSDIR/shell/Kconfig"
-endmenu
-
-menu "System Libraries"
-source "$APPSDIR/system/Kconfig"
-endmenu
index 4f388b2..7c974a1 100644 (file)
@@ -1,6 +1,6 @@
 ###########################################################################
 #
-# Copyright 2016 Samsung Electronics All Rights Reserved.
+# Copyright 2016-2017 Samsung Electronics All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
 # apps/Make.defs
 # Common make definitions provided to all applications
 #
-#   Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved.
+#   Copyright (C) 2011, 2014, 2016 Gregory Nutt. All rights reserved.
 #   Author: Gregory Nutt <gnutt@nuttx.org>
 #
 # Redistribution and use in source and binary forms, with or without
 #
 ############################################################################
 
+# Tools
 
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+  MKKCONFIG = $(APPDIR)\tools\mkkconfig.bat
+else
+  MKKCONFIG = $(APPDIR)/tools/mkkconfig.sh
+endif
index f196563..11d91bb 100644 (file)
@@ -56,6 +56,7 @@ APPDIR = ${shell pwd}
 TOPDIR ?= $(APPDIR)/import
 
 -include $(TOPDIR)/Make.defs
+-include $(APPDIR)/Make.defs
 
 # Application Directories
 
@@ -128,6 +129,12 @@ context_serialize:
 
 context: context_serialize
 
+Kconfig:
+       $(foreach SDIR, $(BUILDIRS), $(call MAKE_template,$(SDIR),preconfig))
+       $(Q) $(MKKCONFIG)
+
+preconfig: Kconfig
+
 .depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
 
 .depend: context Makefile .depdirs
@@ -137,6 +144,7 @@ depend: .depend
 
 clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
        $(call DELFILE, $(BIN))
+       $(call DELFILE, Kconfig)
        $(call DELDIR, $(BIN_DIR))
        $(call CLEAN)
 
@@ -156,6 +164,7 @@ else
        )
 endif
        $(call DELFILE, .depend)
+       $(call DELFILE, $(BIN))
+       $(call DELFILE, Kconfig)
        $(call DELDIR, $(BIN_DIR))
-
-
+       $(call CLEAN)
index fd6a8c0..546b63c 100644 (file)
@@ -3,6 +3,7 @@
 # see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
 #
 
+menu "Examples"
 if INIT_ENTRYPOINT
 choice
        prompt "Application entry point"
@@ -74,3 +75,4 @@ source "$APPSDIR/examples/webserver/Kconfig"
 source "$APPSDIR/examples/websocket/Kconfig"
 source "$APPSDIR/examples/workqueue/Kconfig"
 source "$APPSDIR/examples/artik_demo/Kconfig"
+endmenu
index 596d01b..df52d76 100644 (file)
@@ -2,6 +2,8 @@
 # For a description of the syntax of this configuration file,
 # see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
 #
+
+menu "Network Utilities"
 source "$APPSDIR/netutils/codecs/Kconfig"
 source "$APPSDIR/netutils/dhcpc/Kconfig"
 source "$APPSDIR/netutils/dhcpd/Kconfig"
@@ -18,4 +20,4 @@ source "$APPSDIR/netutils/websocket/Kconfig"
 source "$APPSDIR/netutils/ntpclient/Kconfig"
 source "$APPSDIR/netutils/xmlrpc/Kconfig"
 source "$APPSDIR/netutils/mdns/Kconfig"
-
+endmenu
index c1e8309..ed8a0a4 100644 (file)
@@ -3,6 +3,7 @@
 # see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
 #
 
+menu "Platform-specific Support"
 config PLATFORM_CONFIGDATA
        bool "Platform configuration data"
        default n
@@ -13,3 +14,4 @@ config PLATFORM_CONFIGDATA
                storage mechanism is not visible to applications so underlying non-
                volatile storage can be used:  A file, EEPROM, hardcoded values in
                FLASH, etc.
+endmenu
index 1f1b302..b63f3af 100644 (file)
@@ -1,5 +1,5 @@
 
-
+menu "Enable Shell"
 config TASH
        bool "Enable shell"
        default y
@@ -36,3 +36,4 @@ config TASH_CMDTASK_PRIORITY
        ---help---
                The priority set for TASH command task
 endif
+endmenu
index be403f8..a57403a 100644 (file)
@@ -3,6 +3,7 @@
 # see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
 #
 
+menu "System Libraries"
 menu "EMACS-like Command Line Editor"
 source "$APPSDIR/system/cle/Kconfig"
 endmenu
@@ -70,4 +71,5 @@ endmenu
 menu "VI Work-Alike Editor"
 source "$APPSDIR/system/vi/Kconfig"
 endmenu
+endmenu
 
diff --git a/apps/tools/mkkconfig.bat b/apps/tools/mkkconfig.bat
new file mode 100755 (executable)
index 0000000..aa5ab6f
--- /dev/null
@@ -0,0 +1,141 @@
+@Echo off
+REM
+REM
+REM Copyright 2017 Samsung Electronics All Rights Reserved.
+REM
+REM Licensed under the Apache License, Version 2.0 (the "License");
+REM you may not use this file except in compliance with the License.
+REM You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing,
+REM software distributed under the License is distributed on an
+REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+REM either express or implied. See the License for the specific
+REM language governing permissions and limitations under the License.
+REM
+REM
+REM apps/tools/mkkconfig.bat
+REM
+REM   Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
+REM   Author: Gregory Nutt <gnutt@nuttx.org>
+REM
+REM Redistribution and use in source and binary forms, with or without
+REM modification, are permitted provided that the following conditions
+REM are met:
+REM
+REM 1. Redistributions of source code must retain the above copyright
+REM    notice, this list of conditions and the following disclaimer.
+REM 2. Redistributions in binary form must reproduce the above copyright
+REM    notice, this list of conditions and the following disclaimer in
+REM    the documentation and/or other materials provided with the
+REM    distribution.
+REM 3. Neither the name NuttX nor the names of its contributors may be
+REM    used to endorse or promote products derived from this software
+REM    without specific prior written permission.
+REM
+REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+REM FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+REM COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+REM AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+REM LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+REM POSSIBILITY OF SUCH DAMAGE.
+REM
+
+REM Parse command line arguments
+
+SET menu=""
+SET kconfig=Kconfig
+
+:ArgLoop
+IF "%1"=="" GOTO :EndOfLoop
+IF "%1"=="-m" GOTO :SetMenu
+IF "%1"=="-o" GOTO :SetKconfig
+IF "%1"=="-h" GOTO :ShowUsage
+
+Echo ERROR: Unrecogized option %1
+GOTO :ShowUsage
+
+:SetDebug
+SET debug=-d
+GOTO :NextArg
+
+:SetMenu
+SHIFT
+SET menu=%1
+GOTO :NextArg
+
+:SetKconfig
+SHIFT
+SET kconfig=%1
+
+:NextArg
+SHIFT
+GOTO :ArgLoop
+
+REM Check input Parameters
+
+:EndOfLoop
+IF EXIST %kconfig% (
+  Del /f /q %kconfig%
+REM   IF %ERRORLEVEL% GTR 0 (
+REM     Echo ERROR: failed to remove %kconfig%
+REM     GOTO :End
+REM   )
+)
+
+Echo # > %kconfig%
+Echo # For a description of the syntax of this configuration file, >> %kconfig%
+Echo # see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt >> %kconfig%
+Echo # >> %kconfig%
+Echo # This file is autogenerated, do not edit. >> %kconfig%
+Echo # >> %kconfig%
+Echo[ >> %kconfig%
+
+IF %menu% NEQ "" (
+  Echo menu "%menu%" >> %kconfig%
+)
+
+DIR /B /A:D >_tmp_.dat
+
+FOR /F "tokens=*" %%s IN (_tmp_.dat) do (
+  IF EXIST %%s\Kconfig (
+    Echo source "$APPSDIR/%%s/Kconfig" >> %kconfig%
+  )
+)
+DEL _tmp_.dat
+
+IF %menu% NEQ "" (
+  Echo endmenu # %menu% >> %kconfig%
+)
+
+GOTO :End
+
+REM Exit showing usage
+
+:ShowUsage
+Echo USAGE: %0  [-d] [-m ^<menu^>] [-o ^<kconfig-file^>]
+Echo        %0  [-h]
+Echo Where:
+Echo  ^<-d^>:
+Echo    Enables debug output
+Echo  -m ^<menu^>:
+Echo    Menu description
+Echo  -o ^<kconfig-file^>:
+Echo    Identifies the specific configuratin for the selected ^<board-name^>.
+Echo    This must correspond to a sub-directory under the board directory at
+Echo    under build/configs/^<board-name^>/.
+Echo  ^<-h^>:
+Echo    Prints this message and exits.
+
+REM Exit
+
+:End
+
diff --git a/apps/tools/mkkconfig.sh b/apps/tools/mkkconfig.sh
new file mode 100755 (executable)
index 0000000..4de9eac
--- /dev/null
@@ -0,0 +1,126 @@
+#!/bin/bash
+###########################################################################
+#
+# Copyright 2017 Samsung Electronics All Rights Reserved.
+#
+# Licensed 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+###########################################################################
+# 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 () {
+  echo "USAGE: mkkconfig.sh [-d] [-h] [-m <menu>] [-o <kconfig-file>]"
+  echo "Where:"
+  echo " <-d>:"
+  echo "   Enables debug output"
+  echo " -m <menu>:"
+  echo "   Menu description"
+  echo " -o <kconfig-file>:"
+  echo "   Identifies the specific configuratin for the selected <board-name>."
+  echo "   This must correspond to a sub-directory under the board directory at"
+  echo "   under build/configs/<board-name>/."
+  echo " <-h>:"
+  echo "   Prints this message and exits."
+}
+
+KCONFIG=Kconfig
+unset MENU
+
+while [ ! -z "$1" ]; do
+  case $1 in
+    -d )
+      set -x
+      ;;
+    -m )
+      shift
+      MENU=$1
+      ;;
+    -o )
+      shift
+      KCONFIG=$1
+      ;;
+    -h )
+      USAGE
+      exit 0
+      ;;
+    * )
+      echo "ERROR: Unrecognized argument: $1"
+      USAGE
+      exit 1
+      ;;
+    esac
+  shift
+done
+
+
+if [ -f ${KCONFIG} ]; then
+  rm ${KCONFIG} || { echo "ERROR: Failed to remove $PWD/${KCONFIG}"; exit 1; }
+fi
+
+echo mkkconfig in $PWD
+
+KCONFIG_LIST=`ls -1 $PWD/*/Kconfig`
+
+echo "#" > ${KCONFIG}
+echo "# For a description of the syntax of this configuration file," >> ${KCONFIG}
+echo "# see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt" >> ${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
+
+for FILE in ${KCONFIG_LIST}; do
+  echo "source \"${FILE}\"" >> ${KCONFIG}
+done
+
+if [ ! -z "${MENU}" ]; then
+  echo "endmenu # ${MENU}" >> ${KCONFIG}
+fi
+
index 32f78e8..265aad5 100644 (file)
@@ -1,6 +1,6 @@
 ###########################################################################
 #
-# Copyright 2016 Samsung Electronics All Rights Reserved.
+# Copyright 2016-2017 Samsung Electronics All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
 ############################################################################
 # Makefile.unix
 #
-#   Copyright (C) 2007-2012, 2014 Gregory Nutt. All rights reserved.
+#   Copyright (C) 2007-2012, 2014-2015 Gregory Nutt. All rights reserved.
 #   Author: Gregory Nutt <gnutt@nuttx.org>
 #
 # Redistribution and use in source and binary forms, with or without
@@ -586,19 +586,19 @@ pass2dep: context tools/mkdeps$(HOSTEXEEXT)
 # must first download and install the kconfig-frontends package from this
 # location: http://ymorin.is-a-geek.org/projects/kconfig-frontends.
 
-config:
+config: apps_preconfig
        $(Q) APPSDIR=${CONFIG_APPS_DIR} CONFIGSDIR=${CONFIGS_DIR} EXTERNALDIR=${CONFIG_EXTERNAL_DIR} LIBDIR=${LIB_DIR} kconfig-conf Kconfig
 
-oldconfig:
+oldconfig: apps_preconfig
        $(Q) APPSDIR=${CONFIG_APPS_DIR} CONFIGSDIR=${CONFIGS_DIR} EXTERNALDIR=${CONFIG_EXTERNAL_DIR} LIBDIR=${LIB_DIR} kconfig-conf --oldconfig Kconfig
 
-menuconfig:
+menuconfig: apps_preconfig
        $(Q) APPSDIR=${CONFIG_APPS_DIR} CONFIGSDIR=${CONFIGS_DIR} EXTERNALDIR=${CONFIG_EXTERNAL_DIR} LIBDIR=${LIB_DIR} kconfig-mconf Kconfig
 
-qconfig:
+qconfig: apps_preconfig
        $(Q) APPSDIR=${CONFIG_APPS_DIR} CONFIGSDIR=${CONFIGS_DIR} EXTERNALDIR=${CONFIG_EXTERNAL_DIR} LIBDIR=${LIB_DIR} kconfig-qconf Kconfig
 
-gconfig:
+gconfig: apps_preconfig
        $(Q) APPSDIR=${CONFIG_APPS_DIR} CONFIGSDIR=${CONFIGS_DIR} EXTERNALDIR=${CONFIG_EXTERNAL_DIR} LIBDIR=${LIB_DIR} kconfig-gconf Kconfig
 
 # export
@@ -674,11 +674,17 @@ endif
 # as a convenience, the following targets are included to support housekeeping
 # functions in the user application directory from the TinyAra build directory.
 #
+# apps_preconfig: Prepare applications to be configured
 # apps_clean:     Perform the clean operation only in the user application
 #                 directory
 # apps_distclean: Perform the distclean operation only in the user application
 #                 directory.
 
+apps_preconfig:
+ifneq ($(APPDIR),)
+       $(Q) $(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" preconfig
+endif
+
 apps_clean:
 ifneq ($(APPDIR),)
        $(Q) $(MAKE) -C "$(TOPDIR)/$(APPDIR)" TOPDIR="$(TOPDIR)" clean