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-03-19 09:24:04 +0800
commit9a3ecc88fc93aef7f6ced90a85d6c5f21539e624 (patch)
tree7964bc6430656db9404cd42adaab24c974bd72c6 /Makefile
parente5788e2ee2e58ad494c86514444f6b87185e35f6 (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 1932984478c1..80e357523e35 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 \