From a9aa753fa4d282bc0aa48333ece593bdb5dc707b Mon Sep 17 00:00:00 2001 From: Sebastien Lorquet Date: Thu, 2 Jun 2016 16:34:00 +0200 Subject: [PATCH] Recursive Kconfig autogeneration --- Application.mk | 4 +- Directory.mk | 5 ++ Make.defs | 8 ++++ Makefile | 15 ++---- canutils/.gitignore | 2 + canutils/Kconfig | 11 ----- examples/.gitignore | 2 + examples/Kconfig | 102 ---------------------------------------- fsutils/.gitignore | 2 + fsutils/Kconfig | 12 ----- gpsutils/.gitignore | 2 + gpsutils/Kconfig | 10 ---- graphics/.gitignore | 2 + graphics/Kconfig | 36 -------------- interpreters/.gitignore | 2 + interpreters/Kconfig | 25 ---------- netutils/.gitignore | 4 +- netutils/Kconfig | 28 ----------- system/.gitignore | 2 + system/Kconfig | 36 -------------- tools/mkkconfig.sh | 62 ++++++++++-------------- 21 files changed, 62 insertions(+), 310 deletions(-) create mode 100644 canutils/.gitignore delete mode 100644 canutils/Kconfig create mode 100644 examples/.gitignore delete mode 100644 examples/Kconfig create mode 100644 fsutils/.gitignore delete mode 100644 fsutils/Kconfig create mode 100644 gpsutils/.gitignore delete mode 100644 gpsutils/Kconfig create mode 100644 graphics/.gitignore delete mode 100644 graphics/Kconfig delete mode 100644 interpreters/Kconfig delete mode 100644 netutils/Kconfig create mode 100644 system/.gitignore delete mode 100644 system/Kconfig diff --git a/Application.mk b/Application.mk index 5b7a4e5ad..cc62e8dc6 100644 --- a/Application.mk +++ b/Application.mk @@ -69,7 +69,7 @@ ROOTDEPPATH = --dep-path . VPATH = all: .built -.PHONY: clean depend distclean +.PHONY: clean preconfig depend distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -103,6 +103,8 @@ else install: endif +preconfig: + ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) ifneq ($(APPNAME),) ifneq ($(PRIORITY),) diff --git a/Directory.mk b/Directory.mk index 9c233fe9c..a9880178e 100644 --- a/Directory.mk +++ b/Directory.mk @@ -34,6 +34,7 @@ ############################################################################ -include $(TOPDIR)/.config # Current configuration +include $(APPDIR)/Make.defs # Sub-directories @@ -48,6 +49,7 @@ $(1)_$(2): $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" endef +$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),preconfig))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),context))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) @@ -57,6 +59,9 @@ nothing: install: +preconfig: $(foreach SDIR, $(SUBDIRS), $(SDIR)_preconfig) + $(MKKCONFIG) -m "$(shell cat Kmenu)" + context: $(foreach SDIR, $(SUBDIRS), $(SDIR)_context) depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) diff --git a/Make.defs b/Make.defs index 77007503b..ab9f3fe6c 100644 --- a/Make.defs +++ b/Make.defs @@ -53,3 +53,11 @@ define REGISTER $(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated" endef endif + +# Tools + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + MKKCONFIG = $(APPDIR)\tools\mkkconfig.bat +else + MKKCONFIG = $(APPDIR)/tools/mkkconfig.sh +endif diff --git a/Makefile b/Makefile index 76b23eddd..6039d15b6 100644 --- a/Makefile +++ b/Makefile @@ -39,14 +39,7 @@ APPDIR = ${shell pwd} 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 +-include $(APPDIR)/Make.defs # Application Directories @@ -90,6 +83,7 @@ $(1)_$(2): $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BIN_DIR="$(BIN_DIR)" endef +$(foreach SDIR, $(BUILDIRS), $(eval $(call SDIR_template,$(SDIR),preconfig))) $(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all))) $(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install))) $(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context))) @@ -119,11 +113,10 @@ context_serialize: context: context_serialize -Kconfig: $(MKKCONFIG) +preconfig:$(foreach SDIR, $(BUILDIRS), $(SDIR)_preconfig) + echo subdirs done $(MKKCONFIG) -preconfig: Kconfig - .depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend) .depend: context Makefile .depdirs diff --git a/canutils/.gitignore b/canutils/.gitignore new file mode 100644 index 000000000..99f41601f --- /dev/null +++ b/canutils/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/canutils/Kconfig b/canutils/Kconfig deleted file mode 100644 index 5fe2e45ce..000000000 --- a/canutils/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -menu "CAN Utilities" - -source "$APPSDIR/canutils/libcanard/Kconfig" -source "$APPSDIR/canutils/libuavcan/Kconfig" - -endmenu # CAN Utilities diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 000000000..99f41601f --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/examples/Kconfig b/examples/Kconfig deleted file mode 100644 index bf8a2b3de..000000000 --- a/examples/Kconfig +++ /dev/null @@ -1,102 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# 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/alarm/Kconfig" -source "$APPSDIR/examples/bastest/Kconfig" -source "$APPSDIR/examples/bridge/Kconfig" -source "$APPSDIR/examples/buttons/Kconfig" -source "$APPSDIR/examples/can/Kconfig" -source "$APPSDIR/examples/cc3000/Kconfig" -source "$APPSDIR/examples/chat/Kconfig" -source "$APPSDIR/examples/configdata/Kconfig" -source "$APPSDIR/examples/cpuhog/Kconfig" -source "$APPSDIR/examples/cxxtest/Kconfig" -source "$APPSDIR/examples/dhcpd/Kconfig" -source "$APPSDIR/examples/djoystick/Kconfig" -source "$APPSDIR/examples/elf/Kconfig" -source "$APPSDIR/examples/fstest/Kconfig" -source "$APPSDIR/examples/ftpc/Kconfig" -source "$APPSDIR/examples/ftpd/Kconfig" -source "$APPSDIR/examples/hello/Kconfig" -source "$APPSDIR/examples/helloxx/Kconfig" -source "$APPSDIR/examples/json/Kconfig" -source "$APPSDIR/examples/hidkbd/Kconfig" -source "$APPSDIR/examples/keypadtest/Kconfig" -source "$APPSDIR/examples/igmp/Kconfig" -source "$APPSDIR/examples/i2schar/Kconfig" -source "$APPSDIR/examples/lcdrw/Kconfig" -source "$APPSDIR/examples/leds/Kconfig" -source "$APPSDIR/examples/ltdc/Kconfig" -source "$APPSDIR/examples/media/Kconfig" -source "$APPSDIR/examples/mm/Kconfig" -source "$APPSDIR/examples/modbus/Kconfig" -source "$APPSDIR/examples/module/Kconfig" -source "$APPSDIR/examples/mount/Kconfig" -source "$APPSDIR/examples/mtdpart/Kconfig" -source "$APPSDIR/examples/mtdrwb/Kconfig" -source "$APPSDIR/examples/netloop/Kconfig" -source "$APPSDIR/examples/netpkt/Kconfig" -source "$APPSDIR/examples/nettest/Kconfig" -source "$APPSDIR/examples/nrf24l01_term/Kconfig" -source "$APPSDIR/examples/nsh/Kconfig" -source "$APPSDIR/examples/null/Kconfig" -source "$APPSDIR/examples/nx/Kconfig" -source "$APPSDIR/examples/nxterm/Kconfig" -source "$APPSDIR/examples/nxffs/Kconfig" -source "$APPSDIR/examples/nxflat/Kconfig" -source "$APPSDIR/examples/nxhello/Kconfig" -source "$APPSDIR/examples/nximage/Kconfig" -source "$APPSDIR/examples/nxlines/Kconfig" -source "$APPSDIR/examples/nxtext/Kconfig" -source "$APPSDIR/examples/ostest/Kconfig" -source "$APPSDIR/examples/pashello/Kconfig" -source "$APPSDIR/examples/pca9635/Kconfig" -source "$APPSDIR/examples/pipe/Kconfig" -source "$APPSDIR/examples/poll/Kconfig" -source "$APPSDIR/examples/pppd/Kconfig" -source "$APPSDIR/examples/pwm/Kconfig" -source "$APPSDIR/examples/posix_spawn/Kconfig" -source "$APPSDIR/examples/qencoder/Kconfig" -source "$APPSDIR/examples/random/Kconfig" -source "$APPSDIR/examples/relays/Kconfig" -source "$APPSDIR/examples/rgbled/Kconfig" -source "$APPSDIR/examples/rgmp/Kconfig" -source "$APPSDIR/examples/romfs/Kconfig" -source "$APPSDIR/examples/sendmail/Kconfig" -source "$APPSDIR/examples/serialblaster/Kconfig" -source "$APPSDIR/examples/serialrx/Kconfig" -source "$APPSDIR/examples/serloop/Kconfig" -source "$APPSDIR/examples/slcd/Kconfig" -source "$APPSDIR/examples/flash_test/Kconfig" -source "$APPSDIR/examples/smart_test/Kconfig" -source "$APPSDIR/examples/smart/Kconfig" -source "$APPSDIR/examples/smp/Kconfig" -source "$APPSDIR/examples/tcpecho/Kconfig" -source "$APPSDIR/examples/telnetd/Kconfig" -source "$APPSDIR/examples/thttpd/Kconfig" -source "$APPSDIR/examples/timer/Kconfig" -source "$APPSDIR/examples/tiff/Kconfig" -source "$APPSDIR/examples/touchscreen/Kconfig" -source "$APPSDIR/examples/uavcan/Kconfig" -source "$APPSDIR/examples/udp/Kconfig" -source "$APPSDIR/examples/udpblaster/Kconfig" -source "$APPSDIR/examples/discover/Kconfig" -source "$APPSDIR/examples/webserver/Kconfig" -source "$APPSDIR/examples/unionfs/Kconfig" -source "$APPSDIR/examples/usbserial/Kconfig" -source "$APPSDIR/examples/usbterm/Kconfig" -source "$APPSDIR/examples/udgram/Kconfig" -source "$APPSDIR/examples/ustream/Kconfig" -source "$APPSDIR/examples/watchdog/Kconfig" -source "$APPSDIR/examples/wget/Kconfig" -source "$APPSDIR/examples/wgetjson/Kconfig" -source "$APPSDIR/examples/xmlrpc/Kconfig" -source "$APPSDIR/examples/zerocross/Kconfig" - -endmenu # Examples diff --git a/fsutils/.gitignore b/fsutils/.gitignore new file mode 100644 index 000000000..99f41601f --- /dev/null +++ b/fsutils/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/fsutils/Kconfig b/fsutils/Kconfig deleted file mode 100644 index b6f57cc34..000000000 --- a/fsutils/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -menu "File System Utilities" - -source "$APPSDIR/fsutils/inifile/Kconfig" -source "$APPSDIR/fsutils/mksmartfs/Kconfig" -source "$APPSDIR/fsutils/passwd/Kconfig" - -endmenu # FS Utilities diff --git a/gpsutils/.gitignore b/gpsutils/.gitignore new file mode 100644 index 000000000..99f41601f --- /dev/null +++ b/gpsutils/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/gpsutils/Kconfig b/gpsutils/Kconfig deleted file mode 100644 index 9797cd6f3..000000000 --- a/gpsutils/Kconfig +++ /dev/null @@ -1,10 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -menu "GPS Utilities" - -source "$APPSDIR/gpsutils/minmea/Kconfig" - -endmenu # GPS Utilities diff --git a/graphics/.gitignore b/graphics/.gitignore new file mode 100644 index 000000000..99f41601f --- /dev/null +++ b/graphics/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/graphics/Kconfig b/graphics/Kconfig deleted file mode 100644 index e8cdcaed5..000000000 --- a/graphics/Kconfig +++ /dev/null @@ -1,36 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -menu "Graphics Support" - -config TIFF - bool "TIFF file generation library" - default n - ---help--- - Enable support for the TIFF file generation program. - -if TIFF - -menu "TIFF Screenshot Utility" -source "$APPSDIR/graphics/screenshot/Kconfig" -endmenu - -endif # TIFF - -config GRAPHICS_TRAVELER - bool "Traveler game" - default n - select FSUTILS_INIFILE - ---help--- - Enable or disable the graphic Traveler game - -if GRAPHICS_TRAVELER - -menu "Traveler game" -source "$APPSDIR/graphics/traveler/Kconfig" -endmenu - -endif # GRAPHICS_TRAVELER -endmenu # Graphics Support diff --git a/interpreters/.gitignore b/interpreters/.gitignore index e69de29bb..99f41601f 100644 --- a/interpreters/.gitignore +++ b/interpreters/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/interpreters/Kconfig b/interpreters/Kconfig deleted file mode 100644 index bed828685..000000000 --- a/interpreters/Kconfig +++ /dev/null @@ -1,25 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -menu "Interpreters" - -source "$APPSDIR/interpreters/bas/Kconfig" -source "$APPSDIR/interpreters/ficl/Kconfig" - -config INTERPRETERS_PCODE - bool "Pascal p-code interpreter" - default n - ---help--- - Enable support for the Pascal p-code interpreter. See the README.txt - file at located in the NuttX Pascal repository and also the - README.txt file in the apps/interpreter directory. Use of this - configuration implies that you have performed the required - installation of the Pascal run-time code. - -if INTERPRETERS_PCODE -endif - -source "$APPSDIR/interpreters/micropython/Kconfig" -endmenu # Interpreters diff --git a/netutils/.gitignore b/netutils/.gitignore index 123ef2355..6b672f6b9 100644 --- a/netutils/.gitignore +++ b/netutils/.gitignore @@ -12,4 +12,6 @@ *.sym *.adb *.lib -*.src +*.srci +/Kconfig + diff --git a/netutils/Kconfig b/netutils/Kconfig deleted file mode 100644 index 2f439ce7d..000000000 --- a/netutils/Kconfig +++ /dev/null @@ -1,28 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -menu "Network Utilities" - -source "$APPSDIR/netutils/chat/Kconfig" -source "$APPSDIR/netutils/codecs/Kconfig" -source "$APPSDIR/netutils/dhcpc/Kconfig" -source "$APPSDIR/netutils/dhcpd/Kconfig" -source "$APPSDIR/netutils/esp8266/Kconfig" -source "$APPSDIR/netutils/ftpc/Kconfig" -source "$APPSDIR/netutils/ftpd/Kconfig" -source "$APPSDIR/netutils/json/Kconfig" -source "$APPSDIR/netutils/smtp/Kconfig" -source "$APPSDIR/netutils/telnetd/Kconfig" -source "$APPSDIR/netutils/tftpc/Kconfig" -source "$APPSDIR/netutils/thttpd/Kconfig" -source "$APPSDIR/netutils/netlib/Kconfig" -source "$APPSDIR/netutils/webclient/Kconfig" -source "$APPSDIR/netutils/webserver/Kconfig" -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/system/.gitignore b/system/.gitignore new file mode 100644 index 000000000..99f41601f --- /dev/null +++ b/system/.gitignore @@ -0,0 +1,2 @@ +/Kconfig + diff --git a/system/Kconfig b/system/Kconfig deleted file mode 100644 index 3a57198fb..000000000 --- a/system/Kconfig +++ /dev/null @@ -1,36 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# 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" -source "$APPSDIR/system/install/Kconfig" -source "$APPSDIR/system/flash_eraseall/Kconfig" -source "$APPSDIR/system/hex2bin/Kconfig" -source "$APPSDIR/system/i2c/Kconfig" -source "$APPSDIR/system/hexed/Kconfig" -source "$APPSDIR/system/netdb/Kconfig" -source "$APPSDIR/system/nxplayer/Kconfig" -source "$APPSDIR/system/ramtest/Kconfig" -source "$APPSDIR/system/readline/Kconfig" -source "$APPSDIR/system/prun/Kconfig" -source "$APPSDIR/system/mdio/Kconfig" -source "$APPSDIR/system/sudoku/Kconfig" -source "$APPSDIR/system/lm75/Kconfig" -source "$APPSDIR/system/vi/Kconfig" -source "$APPSDIR/system/sched_note/Kconfig" -source "$APPSDIR/system/stackmonitor/Kconfig" -source "$APPSDIR/system/symtab/Kconfig" -source "$APPSDIR/system/cdcacm/Kconfig" -source "$APPSDIR/system/composite/Kconfig" -source "$APPSDIR/system/ubloxmodem/Kconfig" -source "$APPSDIR/system/usbmsc/Kconfig" -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 index 714ca5117..0be3245f2 100755 --- a/tools/mkkconfig.sh +++ b/tools/mkkconfig.sh @@ -34,18 +34,18 @@ # Get the input parameter list -USAGE="USAGE: mkkconfig.sh [-d] [-h] [-t ] [-o ]" -unset TOPDIR +USAGE="USAGE: mkkconfig.sh [-d] [-h] [-m ] [-o ]" KCONFIG=Kconfig +unset MENU while [ ! -z "$1" ]; do case $1 in -d ) set -x ;; - -t ) + -m ) shift - TOPDIR=$1 + MENU=$1 ;; -o ) shift @@ -64,44 +64,32 @@ while [ ! -z "$1" ]; do 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; } +if [ -f ${KCONFIG} ]; then + rm ${KCONFIG} || { echo "ERROR: Failed to remove $PWD/${KCONFIG}"; exit 1; } fi -if [ -f ${TOPDIR}/${KCONFIG} ]; then - rm ${TOPDIR}/${KCONFIG} || { echo "ERROR: Failed to remove ${TOPDIR}/${KCONFIG}"; exit 1; } +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 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 -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} + echo "source \"${FILE}\"" >> ${KCONFIG} done +if [ ! -z "${MENU}" ]; then + echo "endmenu # ${MENU}" >> ${KCONFIG} +fi +