Recursive Kconfig autogeneration

This commit is contained in:
Sebastien Lorquet 2016-06-02 16:34:00 +02:00
parent ae6c0b832c
commit a9aa753fa4
21 changed files with 62 additions and 310 deletions

View File

@ -69,7 +69,7 @@ ROOTDEPPATH = --dep-path .
VPATH = VPATH =
all: .built all: .built
.PHONY: clean depend distclean .PHONY: clean preconfig depend distclean
$(AOBJS): %$(OBJEXT): %.S $(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@) $(call ASSEMBLE, $<, $@)
@ -103,6 +103,8 @@ else
install: install:
endif endif
preconfig:
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
ifneq ($(APPNAME),) ifneq ($(APPNAME),)
ifneq ($(PRIORITY),) ifneq ($(PRIORITY),)

View File

@ -34,6 +34,7 @@
############################################################################ ############################################################################
-include $(TOPDIR)/.config # Current configuration -include $(TOPDIR)/.config # Current configuration
include $(APPDIR)/Make.defs
# Sub-directories # Sub-directories
@ -48,6 +49,7 @@ $(1)_$(2):
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
endef 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),context)))
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) $(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
@ -57,6 +59,9 @@ nothing:
install: install:
preconfig: $(foreach SDIR, $(SUBDIRS), $(SDIR)_preconfig)
$(MKKCONFIG) -m "$(shell cat Kmenu)"
context: $(foreach SDIR, $(SUBDIRS), $(SDIR)_context) context: $(foreach SDIR, $(SUBDIRS), $(SDIR)_context)
depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend)

View File

@ -53,3 +53,11 @@ define REGISTER
$(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated" $(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated"
endef endef
endif endif
# Tools
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
MKKCONFIG = $(APPDIR)\tools\mkkconfig.bat
else
MKKCONFIG = $(APPDIR)/tools/mkkconfig.sh
endif

View File

@ -39,14 +39,7 @@ APPDIR = ${shell pwd}
TOPDIR ?= $(APPDIR)/import TOPDIR ?= $(APPDIR)/import
-include $(TOPDIR)/Make.defs -include $(TOPDIR)/Make.defs
-include $(APPDIR)/Make.defs
# Tools
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
MKKCONFIG = ${shell $(APPDIR)\tools\mkkconfig.bat}
else
MKKCONFIG = ${shell $(APPDIR)/tools/mkkconfig.sh}
endif
# Application Directories # Application Directories
@ -90,6 +83,7 @@ $(1)_$(2):
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BIN_DIR="$(BIN_DIR)" $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BIN_DIR="$(BIN_DIR)"
endef 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),all)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install))) $(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context))) $(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context)))
@ -119,11 +113,10 @@ context_serialize:
context: context_serialize context: context_serialize
Kconfig: $(MKKCONFIG) preconfig:$(foreach SDIR, $(BUILDIRS), $(SDIR)_preconfig)
echo subdirs done
$(MKKCONFIG) $(MKKCONFIG)
preconfig: Kconfig
.depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend) .depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
.depend: context Makefile .depdirs .depend: context Makefile .depdirs

2
canutils/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/Kconfig

View File

@ -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

2
examples/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/Kconfig

View File

@ -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

2
fsutils/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/Kconfig

View File

@ -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

2
gpsutils/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/Kconfig

View File

@ -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

2
graphics/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/Kconfig

View File

@ -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

View File

@ -0,0 +1,2 @@
/Kconfig

View File

@ -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

4
netutils/.gitignore vendored
View File

@ -12,4 +12,6 @@
*.sym *.sym
*.adb *.adb
*.lib *.lib
*.src *.srci
/Kconfig

View File

@ -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

2
system/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/Kconfig

View File

@ -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

View File

@ -34,18 +34,18 @@
# Get the input parameter list # Get the input parameter list
USAGE="USAGE: mkkconfig.sh [-d] [-h] [-t <topdir>] [-o <kconfig-file>]" USAGE="USAGE: mkkconfig.sh [-d] [-h] [-m <menu>] [-o <kconfig-file>]"
unset TOPDIR
KCONFIG=Kconfig KCONFIG=Kconfig
unset MENU
while [ ! -z "$1" ]; do while [ ! -z "$1" ]; do
case $1 in case $1 in
-d ) -d )
set -x set -x
;; ;;
-t ) -m )
shift shift
TOPDIR=$1 MENU=$1
;; ;;
-o ) -o )
shift shift
@ -64,44 +64,32 @@ while [ ! -z "$1" ]; do
shift shift
done done
# Check arguments
if [ -z "$TOPDIR" ]; then if [ -f ${KCONFIG} ]; then
if [ -x "tools/mkkconfig.sh" ]; then rm ${KCONFIG} || { echo "ERROR: Failed to remove $PWD/${KCONFIG}"; exit 1; }
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 fi
if [ -f ${TOPDIR}/${KCONFIG} ]; then echo mkkconfig in $PWD
rm ${TOPDIR}/${KCONFIG} || { echo "ERROR: Failed to remove ${TOPDIR}/${KCONFIG}"; exit 1; }
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 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 for FILE in ${KCONFIG_LIST}; do
echo "source \"\$APPSDIR/${FILE}\"" >> ${TOPDIR}/${KCONFIG} echo "source \"${FILE}\"" >> ${KCONFIG}
done done
if [ ! -z "${MENU}" ]; then
echo "endmenu # ${MENU}" >> ${KCONFIG}
fi