summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2011-10-25 10:47:42 +0800
committerAndy Green <andy.green@linaro.org>2011-10-25 10:47:42 +0800
commit03407d053e7512b772e7a500245b6c918483f0ed (patch)
tree2483bd688745c06976558cc0ed917ef711410308 /Makefile
parent20951399442abc59861d6ba584bae9adf7738ac8 (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 07bc92544e9c..a074cad3af48 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 \