kbuild: sync top level Makefile with Linux 3.18-rc1

Since Linux 3.15, relative path feature and related fixes,
cleanups have been merged to the top Makefile.

This feature looks stable enough, so let's import it to U-Boot.

Commits imported from Linux (some need adjustment) are:

[1] commit 7e1c04779efd by Michal Marek <mmarek@suse.cz>
  kbuild: Use relative path for $(objtree)

[2] commit 890676c65d69 by Michal Marek <mmarek@suse.cz>
  kbuild: Use relative path when building in the source tree

[3] commit 9da0763bdd82 by Michal Marek <mmarek@suse.cz>
  kbuild: Use relative path when building in a subdir of the source tree

[4] commit c2e28dc975ea by Michal Marek <mmarek@suse.cz>
  kbuild: Print the name of the build directory

[5] commit 066b7ed95580 by Michal Marek <mmarek@suse.cz>
  kbuild: Do not print the build directory with make -s

[6] commit 3f1d9a6cec01 by Michal Marek <mmarek@suse.cz>
  kbuild: make -s should be used with kernelrelease/kernelversion/image_name

[7] commit 7ff525712acf by Masahiro Yamada <yamada.m@jp.panasonic.com>
  kbuild: fake the "Entering directory ..." message more simply

[8] commit 745a254322c8 by Masahiro Yamada <yamada.m@jp.panasonic.com>
  kbuild: use $(Q) for sub-make target

[9] commit aa55c8e2f7a3 by Masahiro Yamada <yamada.m@jp.panasonic.com>
  kbuild: handle C=... and M=... after entering into build directory

To use relative path feature, tools/Makefile and scripts/Makefile.autoconf
must be tweaked.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: Fix handling of backslashes in *.cmd files

Commit c353acba ("kbuild: make: fix if_changed when command contains
backslashes") attempted to handle backslashes in *.cmd files, but it
only handled double backslashes for some reason. Changing make-cmd to also
handle single backslashes fixes rebuilds with dash, but it breaks bash
again. The reason is that the two shells disagree about the
interpretation of backslash sequences in the echo builtin. The way out
of this is to print the command with printf '%s\n'. While at it,
document what the individual parts of make-cmd do and why.

Reported-and-tested-by: Konstantin Khlebnikov <koct9i@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
kbuild: remove obj-n and lib-n handling

Kconfig never defines CONFIG_* as 'n'.
Now obj-n is only used in firmware/Makefile and it can be
replaced with obj-.  No makefile uses lib-n.

Let's rip off obj-n and lib-n.

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: simplify build, clean, modbuiltin shorthands

$(if $(KBUILD_SRC),$(srctree)/) was a useful strategy
to omit a long absolute path for in-source-tree build
prior to commit 890676c65d699db3ad82e7dddd0cf8fb449031af
(kbuild: Use relative path when building in the source tree).

Now $(srctree) is "." when building in the source tree.
It would not be annoying to add "$(srctree)/" all the time.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/kernel-doc: handle object-like macros

Object-like macros are different than function-like macros:
https://gcc.gnu.org/onlinedocs/cpp/Object-like-Macros.html
https://gcc.gnu.org/onlinedocs/cpp/Function-like-Macros.html

They are not parsed correctly, generating invalid intermediate
files (xmls) for cases like:
    #define BIT_MASK    (0xFF << BIT_SHIFT)
where "OxFF <<" is considered to be parameter type.

When parsing, we can differentiate beween these two types of macros by
checking whether there is at least one whitespace b/w "#define" and
first opening parenthesis.

Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/kernel-doc: recognize __meminit

Fix scripts/kernel-doc to recognize __meminit in a function prototype
and to strip it, as done with many other attributes.

Fixes this warning:

  Warning(..//mm/page_alloc.c:2973): cannot understand function prototype: 'void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask) '

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
kbuild: Make scripts executable

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

(This commit follows commit 06ed5c2bfaca of Linux Kernel)

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
kbuild: drop clang-specific extra warnings

It is true clang has more warnings enabled by default but
Jeroen Hofstee are making lots of efforts to eliminate warnings.
Let's drop them and fix C sources.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Jeroen Hofstee <jeroen@myspectrum.nl>
kbuild: remove "clobber" target

Now we stick to Linux Kernel's build system, so squash
"clobber" to "clean" target.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>