diff options
author | Dave Martin <dave.martin@linaro.org> | 2011-12-12 16:58:18 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-12-26 14:56:47 +0800 |
commit | b8302c9567faf77457ac5fd06e0e789b0ed2a76e (patch) | |
tree | d502369326876a55f11c2d5907740df0f33c7b5c /Makefile | |
parent | ae016c6c870afd7f471728b6231c09d4887150b0 (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 \ |