summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2011-12-12 16:58:18 +0800
committerAndy Green <andy.green@linaro.org>2012-05-22 14:34:20 +0800
commit9976d8e906833a093437a3b96128f090f599f0b4 (patch)
treeb3860b5b7d6c2ab3bba58ff761dca4924d5d7d1a /Makefile
parent68693127b6b89fc4d133829cbfb43dae7902c81f (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--Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index a6879630a3ea..f239b61284ee 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \