diff options
author | Dave Martin <dave.martin@linaro.org> | 2011-12-12 16:58:18 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2012-03-19 09:24:04 +0800 |
commit | 9a3ecc88fc93aef7f6ced90a85d6c5f21539e624 (patch) | |
tree | 7964bc6430656db9404cd42adaab24c974bd72c6 /Makefile | |
parent | e5788e2ee2e58ad494c86514444f6b87185e35f6 (diff) |
kbuild: Introduce -D__linux_kernel__ to indicate building of the Linux kernel
The __linux__ macro is defined by gcc to indicate that the compiler
is configured for a target running Linux. However, it also makes
sense to use a bare-metal-targeted compiler to build the kernel,
particularly when cross-building. Such compilers won't (and
shouldn't) define __linux__.
Code which tests for __linux__ should only appear in code which
will never be built into the kernel, such as build-time tools and
some parts of userspace headers.
In general, it is reasonable for Linux to share some source code
with other projects which could predictably be using __KERNEL__ for
their own purposes. This patch introduces a separate macro
__linux_kernel__ to help to disambiguate such cases.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -362,7 +362,7 @@ LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \ $(if $(KBUILD_SRC), -I$(srctree)/include) \ -include $(srctree)/include/linux/kconfig.h -KBUILD_CPPFLAGS := -D__KERNEL__ +KBUILD_CPPFLAGS := -D__KERNEL__ -D__linux_kernel__ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ |