Revert "build: scripts/config - update to kconfig-v5.6"
This reverts commit dcf3e63a35
.
The kconfig update requires further testing and refinement until it can
remain in tree. Main problems are:
- Recursive deps are now fatal instead of a warning
- Previously legal syntax now leads to hard failures
- It fails all package builds since multiple days
The updated kconfig implementation needs to cope with the current status
quo in the various package feeds before we can reconsider it for master.
It is not desirable that single broken packages can hard-fail the entire
build pipeline.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
master
parent
6c16d64b2a
commit
7b1d809a8d
@ -1,14 +1,15 @@
|
||||
#
|
||||
# Generated files
|
||||
#
|
||||
*.moc
|
||||
*conf-cfg
|
||||
|
||||
#
|
||||
# configuration programs
|
||||
#
|
||||
conf
|
||||
mconf
|
||||
nconf
|
||||
qconf
|
||||
gconf
|
||||
*.o
|
||||
conf*
|
||||
!conf*.c
|
||||
!conf*.h
|
||||
mconf*
|
||||
!mconf*.c
|
||||
!mconf*.h
|
||||
mconf_check
|
||||
*.*.c
|
||||
qconf*
|
||||
qconf*.moc
|
||||
!qconf*.cc
|
||||
!qconf*.h
|
||||
!images*.c
|
||||
.tmp_qtcheck
|
||||
|
@ -1,124 +1,102 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# ===========================================================================
|
||||
# OpenWrt configuration targets
|
||||
|
||||
.PHONY: clean all
|
||||
all: conf mconf
|
||||
clean:
|
||||
rm -f *.o lxdialog/*.o *.moc $(clean-files) conf mconf qconf
|
||||
|
||||
clean-files :=
|
||||
# These targets are used from top-level makefile
|
||||
|
||||
# ===========================================================================
|
||||
# Variables needed by the upstream Makefile
|
||||
|
||||
# Avoids displaying 'UPD mconf-cfg' in an otherwise quiet make menuconfig
|
||||
kecho:=true
|
||||
|
||||
CONFIG_SHELL:=$(SHELL)
|
||||
srctree:=.
|
||||
src:=.
|
||||
obj:=.
|
||||
Q:=$(if $V,,@)
|
||||
cmd = $(cmd_$(1))
|
||||
dot-target = $(dir $@).$(notdir $@)
|
||||
|
||||
# taken from ../Kbuild.include
|
||||
define filechk
|
||||
$(Q)set -e; \
|
||||
mkdir -p $(dir $@); \
|
||||
trap "rm -f $(dot-target).tmp" EXIT; \
|
||||
{ $(filechk_$(1)); } > $(dot-target).tmp; \
|
||||
if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then \
|
||||
$(kecho) ' UPD $@'; \
|
||||
mv -f $(dot-target).tmp $@; \
|
||||
fi
|
||||
endef
|
||||
|
||||
### Stripped down upstream Makefile follows:
|
||||
# ===========================================================================
|
||||
# Shared Makefile for the various kconfig executables:
|
||||
# conf: Used for defconfig, oldconfig and related targets
|
||||
# mconf: Used for the mconfig target.
|
||||
# Utilizes the lxdialog package
|
||||
# qconf: Used for the xconfig target
|
||||
# Based on Qt which needs to be installed to compile it
|
||||
# object files used by all kconfig flavours
|
||||
common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
|
||||
symbol.o util.o
|
||||
|
||||
$(obj)/lexer.lex.o: $(obj)/parser.tab.h
|
||||
HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
|
||||
HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)
|
||||
|
||||
# conf: Used for defconfig, oldconfig and related targets
|
||||
hostprogs-y += conf
|
||||
conf-objs := conf.o $(common-objs)
|
||||
|
||||
# mconf: Used for the menuconfig target based on lxdialog
|
||||
hostprogs-y += mconf
|
||||
lxdialog := $(addprefix lxdialog/, \
|
||||
checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
|
||||
mconf-objs := mconf.o $(lxdialog) $(common-objs)
|
||||
# Platform specific fixes
|
||||
#
|
||||
# FreeBSD
|
||||
|
||||
HOSTLDLIBS_mconf = $(shell . $(obj)/mconf-cfg && echo $$libs)
|
||||
$(foreach f, mconf.o $(lxdialog), \
|
||||
$(eval HOSTCFLAGS_$f = $$(shell . $(obj)/mconf-cfg && echo $$$$cflags)))
|
||||
check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1))
|
||||
export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags)
|
||||
export CXXFLAGS += -DKBUILD_NO_NLS
|
||||
|
||||
$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg
|
||||
|
||||
# qconf: Used for the xconfig target based on Qt
|
||||
hostprogs-y += qconf
|
||||
conf-objs := conf.o zconf.tab.o
|
||||
mconf-objs := mconf.o zconf.tab.o
|
||||
qconf-cxxobjs := qconf.o
|
||||
qconf-objs := images.o $(common-objs)
|
||||
|
||||
HOSTLDLIBS_qconf = $(shell . $(obj)/qconf-cfg && echo $$libs)
|
||||
HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/qconf-cfg && echo $$cflags)
|
||||
qconf-objs := zconf.tab.o
|
||||
|
||||
$(obj)/qconf.o: $(obj)/qconf-cfg $(obj)/qconf.moc
|
||||
lxdialog-objs := \
|
||||
lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \
|
||||
lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
|
||||
|
||||
quiet_cmd_moc = MOC $@
|
||||
cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) -i $< -o $@
|
||||
clean-files := zconf.tab.c zconf.lex.c zconf.hash.c
|
||||
# Remove qconf junk files
|
||||
clean-files += $(qconf-cxxobjs) qconf.moc .tmp_qtcheck qconf
|
||||
|
||||
$(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg
|
||||
$(call cmd,moc)
|
||||
|
||||
# check if necessary packages are available, and configure build flags
|
||||
filechk_conf_cfg = $(CONFIG_SHELL) $<
|
||||
|
||||
$(obj)/%conf-cfg: $(src)/%conf-cfg.sh FORCE
|
||||
$(call filechk,conf_cfg)
|
||||
all: conf mconf
|
||||
|
||||
clean-files += *conf-cfg
|
||||
conf: $(conf-objs)
|
||||
mconf: $(mconf-objs) $(lxdialog-objs)
|
||||
$(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC))
|
||||
qconf: $(qconf-cxxobjs) $(qconf-objs)
|
||||
$(CXX) -o $@ $^ $(HOSTLOADLIBES_qconf)
|
||||
|
||||
# ===========================================================================
|
||||
# OpenWrt rules and final adjustments that need to be made after reading the
|
||||
# full upstream Makefile
|
||||
clean:
|
||||
rm -f *.o lxdialog/*.o $(clean-files) conf mconf
|
||||
|
||||
FORCE:
|
||||
zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c
|
||||
|
||||
ifdef BUILD_SHIPPED_FILES
|
||||
shipped-files := lexer.lex.c parser.tab.c parser.tab.h
|
||||
clean-files += $(shipped-files)
|
||||
kconfig_load.o: lkc_defs.h
|
||||
|
||||
.SECONDARY: $(shipped-files)
|
||||
zconf.tab.c: zconf.y $(wildcard zconf.tab.c_shipped)
|
||||
zconf.lex.c: zconf.l $(wildcard zconf.lex.c_shipped)
|
||||
zconf.hash.c: zconf.gperf $(wildcard zconf.hash.c_shipped)
|
||||
|
||||
%.tab.c %.tab.h: %.y
|
||||
bison -l -d -b $* $<
|
||||
%.tab.c: %.y
|
||||
cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<
|
||||
|
||||
%.lex.c: %.l
|
||||
flex -L -o$@ $<
|
||||
cp $@_shipped $@ || flex -L -P$(notdir $*) -o$@ $<
|
||||
|
||||
%.hash.c: %.gperf
|
||||
cp $@_shipped $@ || gperf < $< > $@
|
||||
|
||||
ifeq ($(MAKECMDGOALS),qconf)
|
||||
qconf.o: .tmp_qtcheck
|
||||
.tmp_qtcheck: Makefile
|
||||
-include .tmp_qtcheck
|
||||
|
||||
# Qt needs some extra effort...
|
||||
.tmp_qtcheck:
|
||||
@set -e; echo " CHECK qt"; \
|
||||
if pkg-config --exists Qt5Core; then \
|
||||
cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \
|
||||
libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \
|
||||
moc=`pkg-config --variable=host_bins Qt5Core`/moc; \
|
||||
elif pkg-config --exists QtCore; then \
|
||||
cflags=`pkg-config --cflags QtCore QtGui`; \
|
||||
libs=`pkg-config --libs QtCore QtGui`; \
|
||||
moc=`pkg-config --variable=moc_location QtCore`; \
|
||||
else \
|
||||
echo >&2 "*"; \
|
||||
echo >&2 "* Could not find Qt via pkg-config."; \
|
||||
echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \
|
||||
echo >&2 "*"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo "KC_QT_CFLAGS=$$cflags" > $@; \
|
||||
echo "KC_QT_LIBS=$$libs" >> $@; \
|
||||
echo "KC_QT_MOC=$$moc" >> $@
|
||||
endif
|
||||
|
||||
$(foreach f, mconf.o $(lxdialog), \
|
||||
$(eval $f: CFLAGS+=$$(HOSTCFLAGS_$f)))
|
||||
#Define compiler flags to build qconf
|
||||
HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
|
||||
HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
|
||||
|
||||
$(obj)/lexer.lex.o: CFLAGS += $(HOSTCFLAGS_lexer.lex.o)
|
||||
$(obj)/parser.tab.o: CFLAGS += $(HOSTCFLAGS_parser.tab.o)
|
||||
$(obj)/qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o)
|
||||
|
||||
conf: $(conf-objs)
|
||||
qconf.o: qconf.moc
|
||||
qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o)
|
||||
|
||||
# The *conf-cfg file is used (then filtered out) as the first prerequisite to
|
||||
# avoid sourcing it before the script is built, when trying to compute CFLAGS
|
||||
# for the actual first prerequisite. This avoids errors like:
|
||||
# '/bin/sh: ./mconf-cfg: No such file or directory'
|
||||
mconf: mconf-cfg $(mconf-objs)
|
||||
$(CC) -o $@ $(filter-out mconf-cfg,$^) $(HOSTLDLIBS_mconf)
|
||||
moc = $(KC_QT_MOC) -i $< -o $@
|
||||
|
||||
qconf: qconf-cfg $(qconf-cxxobjs) $(qconf-objs)
|
||||
$(CXX) -o $@ $(filter-out qconf-cfg,$^) $(HOSTLDLIBS_qconf)
|
||||
%.moc: %.h .tmp_qtcheck
|
||||
$(call moc)
|
||||
|
@ -1,24 +1,2 @@
|
||||
These files were taken from the Linux Kernel Configuration System at commit
|
||||
089b7d890f972f6b649fedc9259f6b93a18fb970 (Feb 4, 2020) and modified for the
|
||||
OpenWrt Buildroot:
|
||||
- removed nconf, gconf, tests and kernel configuration targets
|
||||
- adjusted the Makefile to compile outside the kernel
|
||||
- always use default file when running make all{no,mod,yes}config
|
||||
- added a 'reset' command to reset config when the target changes
|
||||
- allow config reading from & writing to a different file
|
||||
- allow 'source' command to use globs to include multiple files
|
||||
- don't write auto.conf and other files under include/ directory
|
||||
- reverted a commit to allow use of '/' & '.' in unquoted config symbols.
|
||||
There are too many of those in OpenWrt right now.
|
||||
- reverted a commit that was issuing a warning when there were more than
|
||||
one help text. This is used in a few packages to use different texts
|
||||
for the menuconfig help, and the ipkg package description.
|
||||
- reverted an upstream change that avoids writing symbols that are not
|
||||
visible to .config, which breaks OpenWrt busybox's '.config' generation
|
||||
logic.
|
||||
- use pre-built *.lex.c *.tab.[ch] files by default, to avoid depending on
|
||||
flex & bison. Rebuild/remove these files only if running make with
|
||||
BUILD_SHIPPED_FILES defined
|
||||
|
||||
For a full list of changes, see the repository at:
|
||||
https://github.com/cotequeiroz/linux/commits/openwrt/scripts/kconfig
|
||||
These files were taken from the Linux 3.9 Kernel
|
||||
Configuration System and modified for the OpenWrt Buildroot.
|
||||
|
@ -1,33 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
|
||||
*/
|
||||
|
||||
#ifndef IMAGES_H
|
||||
#define IMAGES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char *xpm_load[];
|
||||
extern const char *xpm_save[];
|
||||
extern const char *xpm_back[];
|
||||
extern const char *xpm_tree_view[];
|
||||
extern const char *xpm_single_view[];
|
||||
extern const char *xpm_split_view[];
|
||||
extern const char *xpm_symbol_no[];
|
||||
extern const char *xpm_symbol_mod[];
|
||||
extern const char *xpm_symbol_yes[];
|
||||
extern const char *xpm_choice_no[];
|
||||
extern const char *xpm_choice_yes[];
|
||||
extern const char *xpm_menu[];
|
||||
extern const char *xpm_menu_inv[];
|
||||
extern const char *xpm_menuback[];
|
||||
extern const char *xpm_void[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* IMAGES_H */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@
|
||||
lxdialog
|
||||
*.o
|
@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
# Check ncurses compatibility
|
||||
|
||||
# What library to link
|
||||
ldflags()
|
||||
{
|
||||
pkg-config --libs ncursesw 2>/dev/null && exit
|
||||
pkg-config --libs ncurses 2>/dev/null && exit
|
||||
for ext in so a dll.a dylib ; do
|
||||
for lib in ncursesw ncurses curses ; do
|
||||
$cc -print-file-name=lib${lib}.${ext} | grep -q /
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "-l${lib}"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
done
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Where is ncurses.h?
|
||||
ccflags()
|
||||
{
|
||||
if pkg-config --cflags ncursesw 2>/dev/null; then
|
||||
echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
|
||||
elif pkg-config --cflags ncurses 2>/dev/null; then
|
||||
echo '-DCURSES_LOC="<ncurses.h>"'
|
||||
elif [ -f /usr/include/ncursesw/curses.h ]; then
|
||||
echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
|
||||
echo ' -DNCURSES_WIDECHAR=1'
|
||||
elif [ -f /usr/include/ncurses/ncurses.h ]; then
|
||||
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
|
||||
elif [ -f /usr/include/ncurses/curses.h ]; then
|
||||
echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"'
|
||||
elif [ -f /usr/include/ncurses.h ]; then
|
||||
echo '-DCURSES_LOC="<ncurses.h>"'
|
||||
else
|
||||
echo '-DCURSES_LOC="<curses.h>"'
|
||||
fi
|
||||
}
|
||||
|
||||
# Temp file, try to clean up after us
|
||||
tmp=.lxdialog.tmp
|
||||
trap "rm -f $tmp" 0 1 2 3 15
|
||||
|
||||
# Check if we can link to ncurses
|
||||
check() {
|
||||
$cc -x c - -o $tmp 2>/dev/null <<'EOF'
|
||||
#include CURSES_LOC
|
||||
main() {}
|
||||
EOF
|
||||
if [ $? != 0 ]; then
|
||||
echo " *** Unable to find the ncurses libraries or the" 1>&2
|
||||
echo " *** required header files." 1>&2
|
||||
echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
|
||||
echo " *** " 1>&2
|
||||
echo " *** Install ncurses (ncurses-devel) and try again." 1>&2
|
||||
echo " *** " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n"
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cc=""
|
||||
case "$1" in
|
||||
"-check")
|
||||
shift
|
||||
cc="$@"
|
||||
check
|
||||
;;
|
||||
"-ccflags")
|
||||
ccflags
|
||||
;;
|
||||
"-ldflags")
|
||||
shift
|
||||
cc="$@"
|
||||
ldflags
|
||||
;;
|
||||
"*")
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@ -1,50 +0,0 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
PKG="ncursesw"
|
||||
PKG2="ncurses"
|
||||
|
||||
if [ -n "$(command -v pkg-config)" ]; then
|
||||
if pkg-config --exists $PKG; then
|
||||
echo cflags=\"$(pkg-config --cflags $PKG)\"
|
||||
echo libs=\"$(pkg-config --libs $PKG)\"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if pkg-config --exists $PKG2; then
|
||||
echo cflags=\"$(pkg-config --cflags $PKG2)\"
|
||||
echo libs=\"$(pkg-config --libs $PKG2)\"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check the default paths in case pkg-config is not installed.
|
||||
# (Even if it is installed, some distributions such as openSUSE cannot
|
||||
# find ncurses by pkg-config.)
|
||||
if [ -f /usr/include/ncursesw/ncurses.h ]; then
|
||||
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
|
||||
echo libs=\"-lncursesw\"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f /usr/include/ncurses/ncurses.h ]; then
|
||||
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\"
|
||||
echo libs=\"-lncurses\"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f /usr/include/ncurses.h ]; then
|
||||
echo cflags=\"-D_GNU_SOURCE\"
|
||||
echo libs=\"-lncurses\"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo >&2 "*"
|
||||
echo >&2 "* Unable to find the ncurses package."
|
||||
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
|
||||
echo >&2 "* depending on your distribution)."
|
||||
echo >&2 "*"
|
||||
echo >&2 "* You may also need to install pkg-config to find the"
|
||||
echo >&2 "* ncurses installed in a non-default location."
|
||||
echo >&2 "*"
|
||||
exit 1
|
@ -1,129 +0,0 @@
|
||||
/* A Bison parser, made by GNU Bison 3.1. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_YY_PARSER_TAB_H_INCLUDED
|
||||
# define YY_YY_PARSER_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int yydebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
T_HELPTEXT = 258,
|
||||
T_WORD = 259,
|
||||
T_WORD_QUOTE = 260,
|
||||
T_ALLNOCONFIG_Y = 261,
|
||||
T_BOOL = 262,
|
||||
T_CHOICE = 263,
|
||||
T_CLOSE_PAREN = 264,
|
||||
T_COLON_EQUAL = 265,
|
||||
T_COMMENT = 266,
|
||||
T_CONFIG = 267,
|
||||
T_DEFAULT = 268,
|
||||
T_DEFCONFIG_LIST = 269,
|
||||
T_DEF_BOOL = 270,
|
||||
T_DEF_TRISTATE = 271,
|
||||
T_DEPENDS = 272,
|
||||
T_ENDCHOICE = 273,
|
||||
T_ENDIF = 274,
|
||||
T_ENDMENU = 275,
|
||||
T_HELP = 276,
|
||||
T_HEX = 277,
|
||||
T_IF = 278,
|
||||
T_IMPLY = 279,
|
||||
T_INT = 280,
|
||||
T_MAINMENU = 281,
|
||||
T_MENU = 282,
|
||||
T_MENUCONFIG = 283,
|
||||
T_MODULES = 284,
|
||||
T_ON = 285,
|
||||
T_OPEN_PAREN = 286,
|
||||
T_OPTION = 287,
|
||||
T_OPTIONAL = 288,
|
||||
T_PLUS_EQUAL = 289,
|
||||
T_PROMPT = 290,
|
||||
T_RANGE = 291,
|
||||
T_RESET = 292,
|
||||
T_SELECT = 293,
|
||||
T_SOURCE = 294,
|
||||
T_STRING = 295,
|
||||
T_TRISTATE = 296,
|
||||
T_VISIBLE = 297,
|
||||
T_EOL = 298,
|
||||
T_ASSIGN_VAL = 299,
|
||||
T_OR = 300,
|
||||
T_AND = 301,
|
||||
T_EQUAL = 302,
|
||||
T_UNEQUAL = 303,
|
||||
T_LESS = 304,
|
||||
T_LESS_EQUAL = 305,
|
||||
T_GREATER = 306,
|
||||
T_GREATER_EQUAL = 307,
|
||||
T_NOT = 308
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
||||
union YYSTYPE
|
||||
{
|
||||
|
||||
|
||||
char *string;
|
||||
struct symbol *symbol;
|
||||
struct expr *expr;
|
||||
struct menu *menu;
|
||||
enum symbol_type type;
|
||||
enum variable_flavor flavor;
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
int yyparse (void);
|
||||
|
||||
#endif /* !YY_YY_PARSER_TAB_H_INCLUDED */
|
@ -1,575 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "list.h"
|
||||
#include "lkc.h"
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
static char *expand_string_with_args(const char *in, int argc, char *argv[]);
|
||||
static char *expand_string(const char *in);
|
||||
|
||||
static void __attribute__((noreturn)) pperror(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
fprintf(stderr, "%s:%d: ", current_file->name, yylineno);
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Environment variables
|
||||
*/
|
||||
static LIST_HEAD(env_list);
|
||||
|
||||
struct env {
|
||||
char *name;
|
||||
char *value;
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
static void env_add(const char *name, const char *value)
|
||||
{
|
||||
struct env *e;
|
||||
|
||||
e = xmalloc(sizeof(*e));
|
||||
e->name = xstrdup(name);
|
||||
e->value = xstrdup(value);
|
||||
|
||||
list_add_tail(&e->node, &env_list);
|
||||
}
|
||||
|
||||
static void env_del(struct env *e)
|
||||
{
|
||||
list_del(&e->node);
|
||||
free(e->name);
|
||||
free(e->value);
|
||||
free(e);
|
||||
}
|
||||
|
||||
/* The returned pointer must be freed when done */
|
||||
static char *env_expand(const char *name)
|
||||
{
|
||||
struct env *e;
|
||||
const char *value;
|
||||
|
||||
if (!*name)
|
||||
return NULL;
|
||||
|
||||
list_for_each_entry(e, &env_list, node) {
|
||||
if (!strcmp(name, e->name))
|
||||
return xstrdup(e->value);
|
||||
}
|
||||
|
||||
value = getenv(name);
|
||||
if (!value)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* We need to remember all referenced environment variables.
|
||||
* They will be written out to include/config/auto.conf.cmd
|
||||
*/
|
||||
env_add(name, value);
|
||||
|
||||
return xstrdup(value);
|
||||
}
|
||||
|
||||
void env_write_dep(FILE *f, const char *autoconfig_name)
|
||||
{
|
||||
struct env *e, *tmp;
|
||||
|
||||
list_for_each_entry_safe(e, tmp, &env_list, node) {
|
||||
fprintf(f, "ifneq \"$(%s)\" \"%s\"\n", e->name, e->value);
|
||||
fprintf(f, "%s: FORCE\n", autoconfig_name);
|
||||
fprintf(f, "endif\n");
|
||||
env_del(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Built-in functions
|
||||
*/
|
||||
struct function {
|
||||
const char *name;
|
||||
unsigned int min_args;
|
||||
unsigned int max_args;
|
||||
char *(*func)(int argc, char *argv[]);
|
||||
};
|
||||
|
||||
static char *do_error_if(int argc, char *argv[])
|
||||
{
|
||||
if (!strcmp(argv[0], "y"))
|
||||
pperror("%s", argv[1]);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *do_filename(int argc, char *argv[])
|
||||
{
|
||||
return xstrdup(current_file->name);
|
||||
}
|
||||
|
||||
static char *do_info(int argc, char *argv[])
|
||||
{
|
||||
printf("%s\n", argv[0]);
|
||||
|
||||
return xstrdup("");
|
||||
}
|
||||
|
||||
static char *do_lineno(int argc, char *argv[])
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
sprintf(buf, "%d", yylineno);
|
||||
|
||||
return xstrdup(buf);
|
||||
}
|
||||
|
||||
static char *do_shell(int argc, char *argv[])
|
||||
{
|
||||
FILE *p;
|
||||
char buf[256];
|
||||
char *cmd;
|
||||
size_t nread;
|
||||
int i;
|
||||
|
||||
cmd = argv[0];
|
||||
|
||||
p = popen(cmd, "r");
|
||||
if (!p) {
|
||||
perror(cmd);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nread = fread(buf, 1, sizeof(buf), p);
|
||||
if (nread == sizeof(buf))
|
||||
nread--;
|
||||
|
||||
/* remove trailing new lines */
|
||||
while (nread > 0 && buf[nread - 1] == '\n')
|
||||
nread--;
|
||||
|
||||
buf[nread] = 0;
|
||||
|
||||
/* replace a new line with a space */
|
||||
for (i = 0; i < nread; i++) {
|
||||
if (buf[i] == '\n')
|
||||
buf[i] = ' ';
|
||||
}
|
||||
|
||||
if (pclose(p) == -1) {
|
||||
perror(cmd);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return xstrdup(buf);
|
||||
}
|
||||
|
||||
static char *do_warning_if(int argc, char *argv[])
|
||||
{
|
||||
if (!strcmp(argv[0], "y"))
|
||||
fprintf(stderr, "%s:%d: %s\n",
|
||||
current_file->name, yylineno, argv[1]);
|
||||
|
||||
return xstrdup("");
|
||||
}
|
||||
|
||||
static const struct function function_table[] = {
|
||||
/* Name MIN MAX Function */
|
||||
{ "error-if", 2, 2, do_error_if },
|
||||
{ "filename", 0, 0, do_filename },
|
||||
{ "info", 1, 1, do_info },
|
||||
{ "lineno", 0, 0, do_lineno },
|
||||
{ "shell", 1, 1, do_shell },
|
||||
{ "warning-if", 2, 2, do_warning_if },
|
||||
};
|
||||
|
||||
#define FUNCTION_MAX_ARGS 16
|
||||
|
||||
static char *function_expand(const char *name, int argc, char *argv[])
|
||||
{
|
||||
const struct function *f;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(function_table); i++) {
|
||||
f = &function_table[i];
|
||||
if (strcmp(f->name, name))
|
||||
continue;
|
||||
|
||||
if (argc < f->min_args)
|
||||
pperror("too few function arguments passed to '%s'",
|
||||
name);
|
||||
|
||||
if (argc > f->max_args)
|
||||
pperror("too many function arguments passed to '%s'",
|
||||
name);
|
||||
|
||||
return f->func(argc, argv);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Variables (and user-defined functions)
|
||||
*/
|
||||
static LIST_HEAD(variable_list);
|
||||
|
||||
struct variable {
|
||||
char *name;
|
||||
char *value;
|
||||
enum variable_flavor flavor;
|
||||
int exp_count;
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
static struct variable *variable_lookup(const char *name)
|
||||
{
|
||||
struct variable *v;
|
||||
|
||||
list_for_each_entry(v, &variable_list, node) {
|
||||
if (!strcmp(name, v->name))
|
||||
return v;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *variable_expand(const char *name, int argc, char *argv[])
|
||||
{
|
||||
struct variable *v;
|
||||
char *res;
|
||||
|
||||
v = variable_lookup(name);
|
||||
if (!v)
|
||||
return NULL;
|
||||
|
||||
if (argc == 0 && v->exp_count)
|
||||
pperror("Recursive variable '%s' references itself (eventually)",
|
||||
name);
|
||||
|
||||
if (v->exp_count > 1000)
|
||||
pperror("Too deep recursive expansion");
|
||||
|
||||
v->exp_count++;
|
||||
|
||||
if (v->flavor == VAR_RECURSIVE)
|
||||
res = expand_string_with_args(v->value, argc, argv);
|
||||
else
|
||||
res = xstrdup(v->value);
|
||||
|
||||
v->exp_count--;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void variable_add(const char *name, const char *value,
|
||||
enum variable_flavor flavor)
|
||||
{
|
||||
struct variable *v;
|
||||
char *new_value;
|
||||
bool append = false;
|
||||
|
||||
v = variable_lookup(name);
|
||||
if (v) {
|
||||
/* For defined variables, += inherits the existing flavor */
|
||||
if (flavor == VAR_APPEND) {
|
||||
flavor = v->flavor;
|
||||
append = true;
|
||||
} else {
|
||||
free(v->value);
|
||||
}
|
||||
} else {
|
||||
/* For undefined variables, += assumes the recursive flavor */
|
||||
if (flavor == VAR_APPEND)
|
||||
flavor = VAR_RECURSIVE;
|
||||
|
||||
v = xmalloc(sizeof(*v));
|
||||
v->name = xstrdup(name);
|
||||
v->exp_count = 0;
|
||||
list_add_tail(&v->node, &variable_list);
|
||||
}
|
||||
|
||||
v->flavor = flavor;
|
||||
|
||||
if (flavor == VAR_SIMPLE)
|
||||
new_value = expand_string(value);
|
||||
else
|
||||
new_value = xstrdup(value);
|
||||
|
||||
if (append) {
|
||||
v->value = xrealloc(v->value,
|
||||
strlen(v->value) + strlen(new_value) + 2);
|
||||
strcat(v->value, " ");
|
||||
strcat(v->value, new_value);
|
||||
free(new_value);
|
||||
} else {
|
||||
v->value = new_value;
|
||||
}
|
||||
}
|
||||
|
||||
static void variable_del(struct variable *v)
|
||||
{
|
||||
list_del(&v->node);
|
||||
free(v->name);
|
||||
free(v->value);
|
||||
free(v);
|
||||
}
|
||||
|
||||
void variable_all_del(void)
|
||||
{
|
||||
struct variable *v, *tmp;
|
||||
|
||||
list_for_each_entry_safe(v, tmp, &variable_list, node)
|
||||
variable_del(v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Evaluate a clause with arguments. argc/argv are arguments from the upper
|
||||
* function call.
|
||||
*
|
||||
* Returned string must be freed when done
|
||||
*/
|
||||
static char *eval_clause(const char *str, size_t len, int argc, char *argv[])
|
||||
{
|
||||
char *tmp, *name, *res, *endptr, *prev, *p;
|
||||
int new_argc = 0;
|
||||
char *new_argv[FUNCTION_MAX_ARGS];
|
||||
int nest = 0;
|
||||
int i;
|
||||
unsigned long n;
|
||||
|
||||
tmp = xstrndup(str, len);
|
||||
|
||||
/*
|
||||
* If variable name is '1', '2', etc. It is generally an argument
|
||||
* from a user-function call (i.e. local-scope variable). If not
|
||||
* available, then look-up global-scope variables.
|
||||
*/
|
||||
n = strtoul(tmp, &endptr, 10);
|
||||
if (!*endptr && n > 0 && n <= argc) {
|
||||
res = xstrdup(argv[n - 1]);
|
||||
goto free_tmp;
|
||||
}
|
||||
|
||||
prev = p = tmp;
|
||||
|
||||
/*
|
||||
* Split into tokens
|
||||
* The function name and arguments are separated by a comma.
|
||||
* For example, if the function call is like this:
|
||||
* $(foo,$(x),$(y))
|
||||
*
|
||||
* The input string for this helper should be:
|
||||
* foo,$(x),$(y)
|
||||
*
|
||||
* and split into:
|
||||
* new_argv[0] = 'foo'
|
||||
* new_argv[1] = '$(x)'
|
||||
* new_argv[2] = '$(y)'
|
||||
*/
|
||||
while (*p) {
|
||||
if (nest == 0 && *p == ',') {
|
||||
*p = 0;
|
||||
if (new_argc >= FUNCTION_MAX_ARGS)
|
||||
pperror("too many function arguments");
|
||||
new_argv[new_argc++] = prev;
|
||||
prev = p + 1;
|
||||
} else if (*p == '(') {
|
||||
nest++;
|
||||
} else if (*p == ')') {
|
||||
nest--;
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
new_argv[new_argc++] = prev;
|
||||
|
||||
/*
|
||||
* Shift arguments
|
||||
* new_argv[0] represents a function name or a variable name. Put it
|
||||
* into 'name', then shift the rest of the arguments. This simplifies
|
||||
* 'const' handling.
|
||||
*/
|
||||
name = expand_string_with_args(new_argv[0], argc, argv);
|
||||
new_argc--;
|
||||
for (i = 0; i < new_argc; i++)
|
||||
new_argv[i] = expand_string_with_args(new_argv[i + 1],
|
||||
argc, argv);
|
||||
|
||||
/* Search for variables */
|
||||
res = variable_expand(name, new_argc, new_argv);
|
||||
if (res)
|
||||
goto free;
|
||||
|
||||
/* Look for built-in functions */
|
||||
res = function_expand(name, new_argc, new_argv);
|
||||
if (res)
|
||||
goto free;
|
||||
|
||||
/* Last, try environment variable */
|
||||
if (new_argc == 0) {
|
||||
res = env_expand(name);
|
||||
if (res)
|
||||
goto free;
|
||||
}
|
||||
|
||||
res = xstrdup("");
|
||||
free:
|
||||
for (i = 0; i < new_argc; i++)
|
||||
free(new_argv[i]);
|
||||
free(name);
|
||||
free_tmp:
|
||||
free(tmp);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand a string that follows '$'
|
||||
*
|
||||
* For example, if the input string is
|
||||
* ($(FOO)$($(BAR)))$(BAZ)
|
||||
* this helper evaluates
|
||||
* $($(FOO)$($(BAR)))
|
||||
* and returns a new string containing the expansion (note that the string is
|
||||
* recursively expanded), also advancing 'str' to point to the next character
|
||||
* after the corresponding closing parenthesis, in this case, *str will be
|
||||
* $(BAR)
|
||||
*/
|
||||
static char *expand_dollar_with_args(const char **str, int argc, char *argv[])
|
||||
{
|
||||
const char *p = *str;
|
||||
const char *q;
|
||||
int nest = 0;
|
||||
|
||||
/*
|
||||
* In Kconfig, variable/function references always start with "$(".
|
||||
* Neither single-letter variables as in $A nor curly braces as in ${CC}
|
||||
* are supported. '$' not followed by '(' loses its special meaning.
|
||||
*/
|
||||
if (*p != '(') {
|
||||
*str = p;
|
||||
return xstrdup("$");
|
||||
}
|
||||
|
||||
p++;
|
||||
q = p;
|
||||
while (*q) {
|
||||
if (*q == '(') {
|
||||
nest++;
|
||||
} else if (*q == ')') {
|
||||
if (nest-- == 0)
|
||||
break;
|
||||
}
|
||||
q++;
|
||||
}
|
||||
|
||||
if (!*q)
|
||||
pperror("unterminated reference to '%s': missing ')'", p);
|
||||
|
||||
/* Advance 'str' to after the expanded initial portion of the string */
|
||||
*str = q + 1;
|
||||
|
||||
return eval_clause(p, q - p, argc, argv);
|
||||
}
|
||||
|
||||
char *expand_dollar(const char **str)
|
||||
{
|
||||
return expand_dollar_with_args(str, 0, NULL);
|
||||
}
|
||||
|
||||
static char *__expand_string(const char **str, bool (*is_end)(char c),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
const char *in, *p;
|
||||
char *expansion, *out;
|
||||
size_t in_len, out_len;
|
||||
|
||||
out = xmalloc(1);
|
||||
*out = 0;
|
||||
out_len = 1;
|
||||
|
||||
p = in = *str;
|
||||
|
||||
while (1) {
|
||||
if (*p == '$') {
|
||||
in_len = p - in;
|
||||
p++;
|
||||
expansion = expand_dollar_with_args(&p, argc, argv);
|
||||
out_len += in_len + strlen(expansion);
|
||||
out = xrealloc(out, out_len);
|
||||
strncat(out, in, in_len);
|
||||
strcat(out, expansion);
|
||||
free(expansion);
|
||||
in = p;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_end(*p))
|
||||
break;
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
in_len = p - in;
|
||||
out_len += in_len;
|
||||
out = xrealloc(out, out_len);
|
||||
strncat(out, in, in_len);
|
||||
|
||||
/* Advance 'str' to the end character */
|
||||
*str = p;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
static bool is_end_of_str(char c)
|
||||
{
|
||||
return !c;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand variables and functions in the given string. Undefined variables
|
||||
* expand to an empty string.
|
||||
* The returned string must be freed when done.
|
||||
*/
|
||||
static char *expand_string_with_args(const char *in, int argc, char *argv[])
|
||||
{
|
||||
return __expand_string(&in, is_end_of_str, argc, argv);
|
||||
}
|
||||
|
||||
static char *expand_string(const char *in)
|
||||
{
|
||||
return expand_string_with_args(in, 0, NULL);
|
||||
}
|
||||
|
||||
static bool is_end_of_token(char c)
|
||||
{
|
||||
/* Why are '.' and '/' valid characters for symbols? */
|
||||
return !(isalnum(c) || c == '_' || c == '-' || c == '.' || c == '/');
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand variables in a token. The parsing stops when a token separater
|
||||
* (in most cases, it is a whitespace) is encountered. 'str' is updated to
|
||||
* point to the next character.
|
||||
*
|
||||
* The returned string must be freed when done.
|
||||
*/
|
||||
char *expand_one_token(const char **str)
|
||||
{
|
||||
return __expand_string(str, is_end_of_token, 0, NULL);
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
PKG="Qt5Core Qt5Gui Qt5Widgets"
|
||||
PKG2="QtCore QtGui"
|
||||
|
||||
if [ -z "$(command -v pkg-config)" ]; then
|
||||
echo >&2 "*"
|
||||
echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it."
|
||||
echo >&2 "*"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if pkg-config --exists $PKG; then
|
||||
echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\"
|
||||
echo libs=\"$(pkg-config --libs $PKG)\"
|
||||
echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if pkg-config --exists $PKG2; then
|
||||
echo cflags=\"$(pkg-config --cflags $PKG2)\"
|
||||
echo libs=\"$(pkg-config --libs $PKG2)\"
|
||||
echo moc=\"$(pkg-config --variable=moc_location QtCore)\"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo >&2 "*"
|
||||
echo >&2 "* Could not find Qt via pkg-config."
|
||||
echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"
|
||||
echo >&2 "*"
|
||||
exit 1
|
@ -0,0 +1,49 @@
|
||||
%language=ANSI-C
|
||||
%define hash-function-name kconf_id_hash
|
||||
%define lookup-function-name kconf_id_lookup
|
||||
%define string-pool-name kconf_id_strings
|
||||
%compare-strncmp
|
||||
%enum
|
||||
%pic
|
||||
%struct-type
|
||||
|
||||
struct kconf_id;
|
||||
|
||||
|
||||
%%
|
||||
mainmenu, T_MAINMENU, TF_COMMAND
|
||||
menu, T_MENU, TF_COMMAND
|
||||
endmenu, T_ENDMENU, TF_COMMAND
|
||||
source, T_SOURCE, TF_COMMAND
|
||||
choice, T_CHOICE, TF_COMMAND
|
||||
endchoice, T_ENDCHOICE, TF_COMMAND
|
||||
comment, T_COMMENT, TF_COMMAND
|
||||
config, T_CONFIG, TF_COMMAND
|
||||
menuconfig, T_MENUCONFIG, TF_COMMAND
|
||||
help, T_HELP, TF_COMMAND
|
||||
---help---, T_HELP, TF_COMMAND
|
||||
if, T_IF, TF_COMMAND|TF_PARAM
|
||||
endif, T_ENDIF, TF_COMMAND
|
||||
depends, T_DEPENDS, TF_COMMAND
|
||||
optional, T_OPTIONAL, TF_COMMAND
|
||||
default, T_DEFAULT, TF_COMMAND, S_UNKNOWN
|
||||
prompt, T_PROMPT, TF_COMMAND
|
||||
tristate, T_TYPE, TF_COMMAND, S_TRISTATE
|
||||
def_tristate, T_DEFAULT, TF_COMMAND, S_TRISTATE
|
||||
bool, T_TYPE, TF_COMMAND, S_BOOLEAN
|
||||
boolean, T_TYPE, TF_COMMAND, S_BOOLEAN
|
||||
def_bool, T_DEFAULT, TF_COMMAND, S_BOOLEAN
|
||||
int, T_TYPE, TF_COMMAND, S_INT
|
||||
hex, T_TYPE, TF_COMMAND, S_HEX
|
||||
string, T_TYPE, TF_COMMAND, S_STRING
|
||||
select, T_SELECT, TF_COMMAND
|
||||
range, T_RANGE, TF_COMMAND
|
||||
visible, T_VISIBLE, TF_COMMAND
|
||||
option, T_OPTION, TF_COMMAND
|
||||
on, T_ON, TF_PARAM
|
||||
modules, T_OPT_MODULES, TF_OPTION
|
||||
defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
|
||||
env, T_OPT_ENV, TF_OPTION
|
||||
allnoconfig_y, T_OPT_ALLNOCONFIG_Y,TF_OPTION
|
||||
reset, T_RESET, TF_COMMAND
|
||||
%%
|
@ -0,0 +1,250 @@
|
||||
/* ANSI-C code produced by gperf version 3.0.4 */
|
||||
/* Command-line: gperf */
|
||||
/* Computed positions: -k'1,3' */
|
||||
|
||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||
/* The character set is not based on ISO-646. */
|
||||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
struct kconf_id;
|
||||
/* maximum key range = 47, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static unsigned int
|
||||
kconf_id_hash (register const char *str, register unsigned int len)
|
||||
{
|
||||
static unsigned char asso_values[] =
|
||||
{
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 10, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 20, 40, 5,
|
||||
0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
|
||||
5, 0, 35, 49, 0, 15, 0, 10, 15, 49,
|
||||
25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
|
||||
49, 49, 49, 49, 49, 49
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
hval += asso_values[(unsigned char)str[2]];
|
||||
/*FALLTHROUGH*/
|
||||
case 2:
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval;
|
||||
}
|
||||
|
||||
struct kconf_id_strings_t
|
||||
{
|
||||
char kconf_id_strings_str2[sizeof("on")];
|
||||
char kconf_id_strings_str5[sizeof("endif")];
|
||||
char kconf_id_strings_str6[sizeof("option")];
|
||||
char kconf_id_strings_str7[sizeof("endmenu")];
|
||||
char kconf_id_strings_str8[sizeof("optional")];
|
||||
char kconf_id_strings_str9[sizeof("endchoice")];
|
||||
char kconf_id_strings_str10[sizeof("range")];
|
||||
char kconf_id_strings_str11[sizeof("choice")];
|
||||
char kconf_id_strings_str12[sizeof("default")];
|
||||
char kconf_id_strings_str13[sizeof("def_bool")];
|
||||
char kconf_id_strings_str14[sizeof("help")];
|
||||
char kconf_id_strings_str16[sizeof("config")];
|
||||
char kconf_id_strings_str17[sizeof("def_tristate")];
|
||||
char kconf_id_strings_str18[sizeof("env")];
|
||||
char kconf_id_strings_str19[sizeof("defconfig_list")];
|
||||
char kconf_id_strings_str20[sizeof("reset")];
|
||||
char kconf_id_strings_str21[sizeof("string")];
|
||||
char kconf_id_strings_str22[sizeof("if")];
|
||||
char kconf_id_strings_str23[sizeof("int")];
|
||||
char kconf_id_strings_str26[sizeof("select")];
|
||||
char kconf_id_strings_str27[sizeof("modules")];
|
||||
char kconf_id_strings_str28[sizeof("tristate")];
|
||||
char kconf_id_strings_str29[sizeof("menu")];
|
||||
char kconf_id_strings_str30[sizeof("---help---")];
|
||||
char kconf_id_strings_str31[sizeof("source")];
|
||||
char kconf_id_strings_str32[sizeof("comment")];
|
||||
char kconf_id_strings_str33[sizeof("hex")];
|
||||
char kconf_id_strings_str35[sizeof("menuconfig")];
|
||||
char kconf_id_strings_str37[sizeof("visible")];
|
||||
char kconf_id_strings_str38[sizeof("allnoconfig_y")];
|
||||
char kconf_id_strings_str41[sizeof("prompt")];
|
||||
char kconf_id_strings_str42[sizeof("depends")];
|
||||
char kconf_id_strings_str44[sizeof("bool")];
|
||||
char kconf_id_strings_str47[sizeof("boolean")];
|
||||
char kconf_id_strings_str48[sizeof("mainmenu")];
|
||||
};
|
||||
static struct kconf_id_strings_t kconf_id_strings_contents =
|
||||
{
|
||||
"on",
|
||||
"endif",
|
||||
"option",
|
||||
"endmenu",
|
||||
"optional",
|
||||
"endchoice",
|
||||
"range",
|
||||
"choice",
|
||||
"default",
|
||||
"def_bool",
|
||||
"help",
|
||||
"config",
|
||||
"def_tristate",
|
||||
"env",
|
||||
"defconfig_list",
|
||||
"reset",
|
||||
"string",
|
||||
"if",
|
||||
"int",
|
||||
"select",
|
||||
"modules",
|
||||
"tristate",
|
||||
"menu",
|
||||
"---help---",
|
||||
"source",
|
||||
"comment",
|
||||
"hex",
|
||||
"menuconfig",
|
||||
"visible",
|
||||
"allnoconfig_y",
|
||||
"prompt",
|
||||
"depends",
|
||||
"bool",
|
||||
"boolean",
|
||||
"mainmenu"
|
||||
};
|
||||
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
|
||||
__attribute__ ((__gnu_inline__))
|
||||
#endif
|
||||
#endif
|
||||
struct kconf_id *
|
||||
kconf_id_lookup (register const char *str, register unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 35,
|
||||
MIN_WORD_LENGTH = 2,
|
||||
MAX_WORD_LENGTH = 14,
|
||||
MIN_HASH_VALUE = 2,
|
||||
MAX_HASH_VALUE = 48
|
||||
};
|
||||
|
||||
static struct kconf_id wordlist[] =
|
||||
{
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_OPTIONAL, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_CHOICE, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPT_ENV, TF_OPTION},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_RESET, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str30, T_HELP, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_HEX},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str38, T_OPT_ALLNOCONFIG_Y,TF_OPTION},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND},
|
||||
{-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||
{-1}, {-1},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
|
||||
{(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = kconf_id_hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register int o = wordlist[key].name;
|
||||
if (o >= 0)
|
||||
{
|
||||
register const char *s = o + kconf_id_strings;
|
||||
|
||||
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue