menuconfig: optionally use pkg-config to detect ncurses libs

When building ncurses with --with-termlib several symbols get moved from
libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one
additionally needs to link with libtinfo.so.

The ncurses pkg-config module will be used to detect the necessary libs for
linking. If not available the old heuristic for detection of the ncurses libs
will be used.

Signed-off-by: Justin Lecher <jlec@gentoo.org>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
kconfig: optionally use pkg-config to detect ncurses libs

When building ncurses with --with-termlib several symbols get moved from
libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one
additionally needs to link with libtinfo.so.

The ncurses pkg-config module will be used to detect the necessary libs for
linking. If not available the old way of directly specifying libs will be
used.

Signed-off-by: Justin Lecher <jlec@gentoo.org>
[yann.morin.1998@free.fr: fix typo: '-ncurses' --> '-lncurses']
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Merge branch 'yem-kconfig-rc-fixes' of git://gitorious.org/linux-kconfig/linux-kconfig into kbuild/kconfig
scripts/tags.sh: Add magic for OFFSET and DEFINE

Add rules for definitions which is generally used in asm-offsets files.

Signed-off-by: Kirill V Tkhai <tkhai@yandex.ru>
CC: Michal Marek <mmarek@suse.cz>
CC: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: fix ld-option function

The kbuild's ld-option function is broken because
the command
  $(CC) /dev/null -c -o "$$TMPO"
does not create object file!

I have used a relatively old mips gcc 3.4.6 cross-compiler
and a relatively new gcc 4.7.2 to check this fact
but the results are the same.

EXAMPLE:
  $ rm /tmp/1.o
  $ mips-linux-gcc /dev/null -c -o /tmp/1.o
  mips-linux-gcc: /dev/null: linker input file unused because linking not done
  $ ls -la /tmp/1.o
  ls: cannot access /tmp/1.o: No such file or directory

We can easily fix the problem by adding
the '-x c' compiler option.

EXAMPLE:
  $ rm /tmp/1.o
  $ mips-linux-gcc -x c /dev/null -c -o /tmp/1.o
  $ ls -la /tmp/1.o
  -rw-r--r-- 1 antony antony 778 Apr  2 20:40 /tmp/1.o

Also fix wrong ld-option example.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
doc: change example to existing Makefile fragment

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Acked-by: Rob Landley <rob@landley.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/package/Makefile: compare objtree with srctree instead of test KBUILD_OUTPUT

KBUILD_OUTPUT is always empty here, so it is useless to test it. But
while use O=.., objtree and srctree will be different. I compare them
instead.

Signed-off-by: Bin Wang <wbin00@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Coccinelle: Restore coccicheck verbosity in ONLINE mode (C=1 or C=2)

A recent patch have introduce the VERBOSE variable and comments
now depend on it. However, the message printed for each cocci file
such not be printed when the ONLINE mode is active, whatever is
the value of VERBOSE.

Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Coccinelle: Cleanup the setting of the FLAGS and OPTIONS variables

The FLAGS variable is factorized independently of the ONLINE mode.
The OPTIONS variable is now based on LINUXINCLUDE and explicit
includes are thus removed.

The format of the -I option differs between gcc and spatch.
The COCCIINCLUDE is used to adapt the format. This rewritting
needs bash.

Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Coccinelle: Add support to the SPFLAGS variable

The SPFLAGS variable allows to pass additional options
to spatch, e.g. -use_glimpse.

Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Coccinelle: Fix patch output when coccicheck is used with M= and C=

When the M variable is used, the -patch option should be given
to spatch. This patch fixes the case where C is used.

Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
buildtar: Add ARCH to the archive name

When dealing with multiple sub-arches (like 32- and 64-bit on x86, for
example) generating a bunch of kernel tar archives with the same name
but for different sub-arches could get confusing and error-prone. Also,
the build process could overwrite otherwise unrelated builds and you
probably don't want that. So, add the architecture to the archive name
for more clarity and less shoot-yourself-in-the-foot practices.

Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>
headers_install.pl: convert to headers_install.sh

Remove perl from make headers_install by replacing a perl script (doing a
simple regex search and replace) with a smaller, faster, simpler,
POSIX-2008 shell script implementation.  The new shell script is a single
for loop calling sed and piping its output through unifdef to produce the
target file.

Same as last time except for minor tweak to deal with code review from
here: http://lkml.indiana.edu/hypermail/linux/kernel/1302.3/00078.html

(Note that this drops the "arch" argument, which isn't used. Kbuild
already points to the right input files on the command line.)

Signed-off-by: Rob Landley <rob@landley.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: David Howells <dhowell@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
merge_config.sh: Avoid creating unnessary source softlinks

Viresh noticed when using merge_config.sh that a source softlink
was being created even when he didn't specify the -O option.

The problem arises due to the previous commit 409f117e2d6b
which added the -O option. Basically if -O is not specified,
we still pass '-O=.' to the make command, which then generates
a source softlink to ./

This patch adds an extra check so if there is no -O specified
to merge_config.sh, we don't pass one on to make.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Bruce Ashfield <bruce.ashfield@windriver.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Reported-and-tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
menuconfig: Fix memory leak introduced by jump keys feature

Fixes the memory leak of struct jump_key allocated in get_prompt_str()

Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: stable@vger.kernel.org
menuconfig: Add "breadcrumbs" navigation aid

Displays a trail of the menu entries used to get to the current menu.

Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[yann.morin.1998@free.fr: small, trivial code re-ordering]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
kconfig/lxdialog: rationalise the include paths where to find {.n}curses{,w}.h

The current code does this:

    if [ -f /usr/include/ncursesw/curses.h ]; then
        echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
    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="<ncurses/curses.h>"'
    [...]

This is merely inconsistent:
  - adding the full path to the directory in the -I directive,
  - especially since that path is already a sub-path of the system
    include path,
  - and then repeating the sub-path in the #include directive.

Rationalise each include directive:
  - only use the filename in the #include directive,
  - keep the -I directives: they are always searched for before the
    system include path; this ensures the correct header is used.

Using the -I directives and the filename-only in #include is more in
line with how pkg-config behaves, eg.:
    $ pkg-config --cflags ncursesw
    -I/usr/include/ncursesw

This paves the way for using pkg-config for CFLAGS, too, now we use it
to find the libraries.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
rpm-pkg: Do not package the whole source directory

The source tree can contain lots of uninteresting data like tag or
cscope files, packaging which slows down make rpm needlessly. It can
also break the build, if the tree contains an unrelated file named
*.spec. The downside of this change is that new subdirectories have to
be added to the KBUILD_ALLDIRS variable in the top-level Makefile. The
upside is that the behavior is more predictable.

Signed-off-by: Michal Marek <mmarek@suse.cz>
rpm-pkg: Do not write to the parent directory

Now that we only package explicitly listed files to the tarball, there
is no need to abuse the parent directory.

Signed-off-by: Michal Marek <mmarek@suse.cz>
rpm-pkg: Always regenerate the specfile

The *pkg targets are always run, so it makes no sense to cache the
generated specfile. This also fixes build errors when the specfile
becomes out of date, without the Makefile noticing it:

$ make rpm
  works
$ echo yadadada >localversion-test
$ make rpm
  fails, because kernel.spec assumes the old kernel release string

Signed-off-by: Michal Marek <mmarek@suse.cz>