Documentation: kbuild: Remove obsolete include/asm symlink step

As of commit f7f16b7799ed68654850ab340ef812895aebcf4c ("kbuild: drop
include/asm"), the include/asm symlink is no longer created.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Documentation: kbuild: Improve if_changed documentation

  - These days if_changed is used with many more commands than ld,
    objcopy, and gzip, hence add an ellipsis,
  - Any target that utilises if_changed must be listed in $(targets),
    so it needs an assignment to "targets", not "target".

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Documentation: kbuild: Remove obsolete dtc_cpp section

Commit b40b25fff8205dd18124d8fc87b2c9c57f269b5f ("kbuild: always
run gcc -E on *.dts, remove cmd_dtc_cpp") improved the functionality of
cmd_dtc_cpp and merged it back into cmd_dtc.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Documentation: kbuild: Improve grammar

  - singular versus plural,
  - "by" versus "of",
  - missing "if", "it", "the",
  - consistent use of "xxx-specific" versus "xxx specific".

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: handle multi-objs dependency appropriately

The comment in scripts/Makefile.build says as follows:

  We would rather have a list of rules like
        foo.o: $(foo-objs)
  but that's not so easy, so we rather make all composite objects depend
  on the set of all their parts

This commit makes it possible!

For example, assume a Makefile like this

  obj-m = foo.o bar.o
  foo-objs := foo1.o foo2.o
  bar-objs := bar1.o bar2.o

Without this patch, foo.o depends on all of
foo1.o foo2.o bar1.o bar2.o.
It looks funny that foo.o is regenerated when bar1.c is updated.

Now we can handle the dependency of foo.o and bar.o separately.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: handle the dependency of multi-objs hostprogs appropriately

Assume we have a Makefile like:

hostprogs-y := foo bar
foo-objs := foo1.o foo2.o
bar-objs := bar1.o bar2.o

Without this commit, the host program foo depends on all of
foo1.o foo2.o bar1.o bar2.o.

This commit allows to handle the dependency of each host program
separately.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: refactor script/kconfig/Makefile

Now it is harmless to add all host programs to hostprogs-y.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: remove redundant clean-files from scripts/kconfig/Makefile

Now mconf, qconf, gconf, nconf are always added to hostprogs-y.
Files added to hostprogs-y are removed by "make clean".

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/tags.sh: Don't specify kind-spec for emacs' ctags/etags

Emacs' ctags/etags don't know about kind-spec in --regex and
produce warnings:

etags: invalid regexp modifier `v', ignoring
etags: invalid regexp modifier `/', ignoring

Fix it by removing kind-spec for the emacs case.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
Inspired-by: Masatake YAMATO <yamato@redhat.com>
Tested-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/tags.sh: remove *PCGFLAGS regular expressions

Commit 0a31bc97c80c3fa8 (mm: memcontrol: rewrite uncharge API)
removed the macros {TEST,SET,CLEAR,TESTCLEAR}PCFLAG.  Remove
corresponding entries from tags.sh -- in the emacs case they also
produced warnigs because of unmatched '\('.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
Inspired-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/tags.sh: fix DEFINE_HASHTABLE in emacs case

The emacs --regex for DEFINE_HASHTABLE produced a warning because of
an unmatched '\('.  Further, the whole entry did not work, because the
regex needs to match from the beginning of a line, including keywords
like 'static'.  Finally, '\w' should not be used, because it
stops at underscores which are often part of variable names in C,
resulting in wrong entries in the tags file.

Signed-off-by: Dirk Gouders <dirk@gouders.net>
Inspired-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: Make scripts executable

The Makefiles call the respective interpreter explicitly, but this makes
it easier to use the scripts manually.

Signed-off-by: Michal Marek <mmarek@suse.cz>
kconfig: lxdialog: fix spelling

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kconfig: nconfig: fix multi-byte UTF handling

Currently, Kconfig descriptions that use multi-byte UTF-8 characters
(such as MTD_NAND_CAFE) will have their menu entries dropped from the
'make nconfig' ncurses menu, and all subsequent entries in the same
window will be omitted. This seems to be due to the ncurses 'menu'
library, which does not traditionally handle UTF-8 >8-bit characters
properly.

The ncursesw library ('w' is for "wide") is written to handle these
UTF-8 characters, and is practically a drop-in replacement at the source
level. Use it by default, if available.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=43067
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Martin Walch <walch.martin@web.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
builddeb: put the dbg files into the correct directory

Since the conversion of objtree to use relative pathnames (commit
7e1c04779e, "kbuild: Use relative path for $(objtree)"), the debug
info files have been ending up in /debian/dbgtmp/ in the regular
linux-image package instead of the debug files package. Fix up the
paths so that the debug files end up in the -dbg package.

This is based on a similar patch by Darrick.

Reported-and-tested-by: "Darrick J. Wong" <darrick.wong@oracle.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
deb-pkg: Add support for powerpc little endian

The Debian powerpc little endian architecture is called ppc64el.  This
is the default architecture used by Ubuntu for powerpc.

The below checks the kernel config to see if we are compiling little
endian and sets the Debian arch appropriately.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kconfig/lxdialog: get ncurses CFLAGS with pkg-config

This makes "make menuconfig" also work on systems where ncurses is not
installed in a standard location (such as on NixOS).

This patch changes ccflags() so that it tries pkg-config first, and only
if pkg-config fails does it go back to the fallback/manual checks. This
is the same algorithm that ldflags() already uses.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
coccinelle: misc: semantic patch to delete overly complex return code processing

This semantic patch simplifies cases where the effect of the processing of
a function call's return code is just to return the result of the function
directly.  It may also delete a local return flag variable, if this is no
longer used.

This was proposed by Uwe Kleine-König.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: fake the "Entering directory ..." message more simply

Commit c2e28dc975ea87feed84415006ae143424912ac7
(kbuild: Print the name of the build directory)
added a gimmick to show the "Entering directory ...".

Instead of echoing the hard-coded message (that is, we need to know
the exact message), moving --no-print-directory would be easier.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Peter Foley <pefoley2@pefoley.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: use $(Q) for sub-make target

Since commit 066b7ed9558087a7957a1128f27d7a3462ff117f
(kbuild: Do not print the build directory with make -s),
"Q" is defined above the sub-make target.

This commit takes advantage of that and replaces
"$(if $(KBUILD_VERBOSE:1=),@)" with "$(Q)".

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Peter Foley <pefoley2@pefoley.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>