Commit 273175d0 authored by Eric Andersen's avatar Eric Andersen
Browse files

update kbuild system

parent a18f3641
Loading
Loading
Loading
Loading
+43 −16
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ organized in a tree structure:
	+- ...

Every entry has its own dependencies. These dependencies are used
to determine the visible of an entry. Any child entry is only
to determine the visibility of an entry. Any child entry is only
visible if its parent entry is also visible.

Menu entries
@@ -50,7 +50,7 @@ applicable everywhere (see syntax).

- type definition: "bool"/"tristate"/"string"/"hex"/"integer"
  Every config option must have a type. There are only two basic types:
  tristate and string, the other types base on these two. The type
  tristate and string, the other types are based on these two. The type
  definition optionally accepts an input prompt, so these two examples
  are equivalent:

@@ -64,12 +64,12 @@ applicable everywhere (see syntax).
  to the user. Optionally dependencies only for this prompt can be added
  with "if".

- default value: "default" <symbol> ["if" <expr>]
- default value: "default" <expr> ["if" <expr>]
  A config option can have any number of default values. If multiple
  default values are visible, only the first defined one is active.
  Default values are not limited to the menu entry, where they are
  defined, this means the default can be defined somewhere else or be
  overriden by an earlier definition.
  overridden by an earlier definition.
  The default value is only assigned to the config symbol if no other
  value was set by the user (via the input prompt above). If an input
  prompt is visible the default value is presented to the user and can
@@ -81,7 +81,7 @@ applicable everywhere (see syntax).
  This defines a dependency for this menu entry. If multiple
  dependencies are defined they are connected with '&&'. Dependencies
  are applied to all other options within this menu entry (which also
  accept "if" expression), so these two examples are equivalent:
  accept an "if" expression), so these two examples are equivalent:

	bool "foo" if BAR
	default y if BAR
@@ -90,10 +90,28 @@ applicable everywhere (see syntax).
	bool "foo"
	default y

- help text: "help"
- reverse dependencies: "select" <symbol> ["if" <expr>]
  While normal dependencies reduce the upper limit of a symbol (see
  below), reverse dependencies can be used to force a lower limit of
  another symbol. The value of the current menu symbol is used as the
  minimal value <symbol> can be set to. If <symbol> is selected multiple
  times, the limit is set to the largest selection.
  Reverse dependencies can only be used with boolean or tristate
  symbols.

- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
  This allows to limit the range of possible input values for integer
  and hex symbols. The user can only input a value which is larger than
  or equal to the first symbol and smaller than or equal to the second
  symbol.

- help text: "help" or "---help---"
  This defines a help text. The end of the help text is determined by
  the level indentation, this means it ends at the first line which has
  the indentation level, this means it ends at the first line which has
  a smaller indentation than the first line of the help text.
  "---help---" and "help" do not differ in behaviour, "---help---" is
  used to help visually seperate configuration logic from help within
  the file as an aid to developers.


Menu dependencies
@@ -109,8 +127,8 @@ module state. Dependency expressions have the following syntax:
           <symbol> '!=' <symbol>               (3)
           '(' <expr> ')'                       (4)
           '!' <expr>                           (5)
           <expr> '||' <expr>                   (6)
           <expr> '&&' <expr>                   (7)
           <expr> '&&' <expr>                   (6)
           <expr> '||' <expr>                   (7)

Expressions are listed in decreasing order of precedence. 

@@ -130,7 +148,7 @@ An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
respectively for calculations). A menu entry becomes visible when it's
expression evaluates to 'm' or 'y'.

There are two type of symbols: constant and nonconstant symbols.
There are two types of symbols: constant and nonconstant symbols.
Nonconstant symbols are the most common ones and are defined with the
'config' statement. Nonconstant symbols consist entirely of alphanumeric
characters or underscores.
@@ -142,7 +160,7 @@ Menu structure
--------------

The position of a menu entry in the tree is determined in two ways. First
it can be specified explicitely:
it can be specified explicitly:

menu "Network device support"
	depends NET
@@ -159,8 +177,8 @@ dependency list of the config option NETDEVICES.

The other way to generate the menu structure is done by analyzing the
dependencies. If a menu entry somehow depends on the previous entry, it
can be made a submenu of it. First the the previous (parent) symbol must
be part of the dependency list and then one of these two condititions
can be made a submenu of it. First, the previous (parent) symbol must
be part of the dependency list and then one of these two conditions
must be true:
- the child entry must become invisible, if the parent is set to 'n'
- the child entry must only be visible, if the parent is visible
@@ -177,7 +195,7 @@ comment "module support disabled"

MODVERSIONS directly depends on MODULES, this means it's only visible if
MODULES is different from 'n'. The comment on the other hand is always
visible when MODULES it's visible (the (empty) dependency of MODULES is
visible when MODULES is visible (the (empty) dependency of MODULES is
also part of the comment dependencies).


@@ -188,12 +206,13 @@ The configuration file describes a series of menu entries, where every
line starts with a keyword (except help texts). The following keywords
end a menu entry:
- config
- menuconfig
- choice/endchoice
- comment
- menu/endmenu
- if/endif
- source
The first four also start the definition of a menu entry.
The first five also start the definition of a menu entry.

config:

@@ -203,6 +222,14 @@ config:
This defines a config symbol <symbol> and accepts any of above
attributes as options.

menuconfig:
	"menuconfig" <symbol>
	<config options>

This is similiar to the simple config entry above, but it also gives a
hint to front ends, that all suboptions should be displayed as a
separate list of options.

choices:

	"choice"
+35 −13
Original line number Diff line number Diff line
# Makefile for buildroot2
#
# Copyright (C) 2002-2004 Erik Andersen <andersen@codepoet.org>

# Copyright (C) 2002-2005 Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Library General Public License as published by the Free
# Software Foundation; either version 2 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 Library General Public License for more
# details.
#
# You should have received a copy of the GNU Library General Public License
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# Select the compiler needed to build binaries for your development system
HOSTCC    = gcc
@@ -9,10 +22,13 @@ HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
LC_ALL:= C


all: ncurses conf mconf

ifeq ($(shell uname),SunOS)
LIBS = -lcurses
else
LIBS = -lncurses
endif
ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h))
	HOSTNCURSES += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"
else
@@ -36,11 +52,14 @@ endif
endif

CONF_SRC     = conf.c
MCONF_SRC =mconf.c checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c
MCONF_SRC    = mconf.c
LXD_SRC      = lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \
               lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \
               lxdialog/msgbox.c
SHARED_SRC   = zconf.tab.c
SHARED_DEPS := lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h
CONF_OBJS    = $(patsubst %.c,%.o, $(CONF_SRC))
MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
MCONF_OBJS   = $(patsubst %.c,%.o, $(MCONF_SRC) $(LXD_SRC))
SHARED_OBJS  = $(patsubst %.c,%.o, $(SHARED_SRC))

conf: $(CONF_OBJS) $(SHARED_OBJS)
@@ -94,19 +113,22 @@ endif
ncurses:
	@echo "main() {}" > lxtemp.c
	@if $(HOSTCC) lxtemp.c $(LIBS) ; then \
		rm -f lxtemp.c a.out; \
		$(RM) lxtemp.c a.out; \
	else \
		rm -f lxtemp.c; \
		$(RM) lxtemp.c; \
		echo -e "\007" ;\
		echo ">> Unable to find the Ncurses libraries." ;\
		echo ">>" ;\
		echo ">> You must have Ncurses installed in order" ;\
		echo ">> to use 'make menuconfig'" ;\
		echo ">>" ;\
		echo ">> Maybe you want to try 'make config', which" ;\
		echo ">> doesn't depend on the Ncurses libraries." ;\
		echo ;\
		exit 1 ;\
	fi

clean:
	rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
	$(RM) *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \
		conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h
+3 −3
Original line number Diff line number Diff line
@@ -31,14 +31,14 @@ char *defconfig_file;
static int indent = 1;
static int valid_stdin = 1;
static int conf_cnt;
static char line[128];
static signed char line[128];
static struct menu *rootEntry;

static char nohelp_text[] = "Sorry, no help available for this option yet.\n";

static void strip(char *str)
static void strip(signed char *str)
{
	char *p = str;
	signed char *p = str;
	int l;

	while ((isspace(*p)))
+4 −55
Original line number Diff line number Diff line
@@ -23,10 +23,10 @@ const char *conf_confnames[] = {
	NULL,
};

static char *conf_expand_value(const char *in)
static char *conf_expand_value(const signed char *in)
{
	struct symbol *sym;
	const char *src;
	const signed char *src;
	static char res_value[SYMBOL_MAXLENGTH];
	char *dst, name[SYMBOL_MAXLENGTH];

@@ -257,7 +257,7 @@ int conf_read(const char *name)

int conf_write(const char *name)
{
	FILE *out, *out_h;
	FILE *out;
	struct symbol *sym;
	struct menu *menu;
	const char *basename;
@@ -287,34 +287,13 @@ int conf_write(const char *name)
	} else
		basename = conf_def_filename;

	sprintf(newname, "%s.tmpconfig.%d", dirname, getpid());
	sprintf(newname, "%s.tmpconfig.%d", dirname, (int)getpid());
	out = fopen(newname, "w");
	if (!out)
		return 1;
	out_h = NULL;
	if (!name) {
		out_h = fopen(".tmpconfig.h", "w");
		if (!out_h)
			return 1;
	}
	fprintf(out, "#\n"
		     "# Automatically generated make config: don't edit\n"
		     "#\n");
	if (out_h) {
		fprintf(out_h, "/*\n"
			     " * Automatically generated header file: don't edit\n"
			     " */\n\n"
			     "#define AUTOCONF_INCLUDED\n\n"
			     "/* Version Number */\n"
			     "#define BB_VER \"%s\"\n"
			     "#define BB_BT \"%s\"\n",
			     getenv("VERSION"),
			     getenv("BUILDTIME"));
		if (getenv("EXTRA_VERSION"))
			fprintf(out_h, "#define BB_EXTRA_VERSION \"%s\"\n",
				     getenv("EXTRA_VERSION"));
		fprintf(out_h, "\n");
	}

	if (!sym_change_count)
		sym_clear_all_valid();
@@ -330,11 +309,6 @@ int conf_write(const char *name)
				     "#\n"
				     "# %s\n"
				     "#\n", str);
			if (out_h)
				fprintf(out_h, "\n"
					       "/*\n"
					       " * %s\n"
					       " */\n", str);
		} else if (!(sym->flags & SYMBOL_CHOICE)) {
			sym_calc_value(sym);
			if (!(sym->flags & SYMBOL_WRITE))
@@ -352,20 +326,12 @@ int conf_write(const char *name)
				switch (sym_get_tristate_value(sym)) {
				case no:
					fprintf(out, "# %s is not set\n", sym->name);
					if (out_h)
						fprintf(out_h, "#undef %s\n", sym->name);
					break;
				case mod:
#if 0
					fprintf(out, "%s=m\n", sym->name);
					if (out_h)
						fprintf(out_h, "#define %s_MODULE 1\n", sym->name);
#endif
					break;
				case yes:
					fprintf(out, "%s=y\n", sym->name);
					if (out_h)
						fprintf(out_h, "#define %s 1\n", sym->name);
					break;
				}
				break;
@@ -373,40 +339,28 @@ int conf_write(const char *name)
				// fix me
				str = sym_get_string_value(sym);
				fprintf(out, "%s=\"", sym->name);
				if (out_h)
					fprintf(out_h, "#define %s \"", sym->name);
				do {
					l = strcspn(str, "\"\\");
					if (l) {
						fwrite(str, l, 1, out);
						if (out_h)
							fwrite(str, l, 1, out_h);
					}
					str += l;
					while (*str == '\\' || *str == '"') {
						fprintf(out, "\\%c", *str);
						if (out_h)
							fprintf(out_h, "\\%c", *str);
						str++;
					}
				} while (*str);
				fputs("\"\n", out);
				if (out_h)
					fputs("\"\n", out_h);
				break;
			case S_HEX:
				str = sym_get_string_value(sym);
				if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
					fprintf(out, "%s=%s\n", sym->name, str);
					if (out_h)
						fprintf(out_h, "#define %s 0x%s\n", sym->name, str);
					break;
				}
			case S_INT:
				str = sym_get_string_value(sym);
				fprintf(out, "%s=%s\n", sym->name, str);
				if (out_h)
					fprintf(out_h, "#define %s %s\n", sym->name, str);
				break;
			}
		}
@@ -426,11 +380,6 @@ int conf_write(const char *name)
		}
	}
	fclose(out);
	if (out_h) {
		fclose(out_h);
		rename(".tmpconfig.h", "include/config.h");
		file_write_dep(NULL);
	}
	if (!name || basename != conf_def_filename) {
		if (!name)
			name = conf_def_filename;
+10 −0
Original line number Diff line number Diff line
@@ -1087,3 +1087,13 @@ void expr_fprint(struct expr *e, FILE *out)
{
	expr_print(e, expr_print_file_helper, out, E_NONE);
}

static void expr_print_gstr_helper(void *data, const char *str)
{
	str_append((struct gstr*)data, str);
}

void expr_gstr_print(struct expr *e, struct gstr *gs)
{
	expr_print(e, expr_print_gstr_helper, gs, E_NONE);
}
Loading