summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-02-04 17:24:20 +0900
committerTom Rini <trini@ti.com>2014-02-19 11:07:50 -0500
commitfea1ca8e3418bac4b55f4cc8b66a6ae0d41e91e4 (patch)
tree8e501c701078793df021836689175de2c2c98d20 /Makefile
parent2b3c9d3ddd4e0b5a55d17e164e817b42cb555639 (diff)
Makefile: refactor include path settings
This commit merges commonly-used header include paths to UBOOTINCLUDE and NOSTDINC_FLAGS variables, which are placed at the top Makefile. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 13 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3a97483d453..9c3902274ba 100644
--- a/Makefile
+++ b/Makefile
@@ -226,6 +226,15 @@ CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
+# Use UBOOTINCLUDE when you must reference the include/ directory.
+# Needed to be compatible with the O= option
+UBOOTINCLUDE :=
+ifneq ($(OBJTREE),$(SRCTREE))
+UBOOTINCLUDE += -I$(OBJTREE)/include
+endif
+UBOOTINCLUDE += -I$(srctree)/include \
+ -I$(srctree)/arch/$(ARCH)/include
+
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
@@ -238,7 +247,7 @@ export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
export MAKE AWK
export DTC CHECK CHECKFLAGS
-export KBUILD_CPPFLAGS
+export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
export KBUILD_CFLAGS KBUILD_AFLAGS
KBUILD_CFLAGS += -Os #-fomit-frame-pointer
@@ -254,6 +263,9 @@ KBUILD_CFLAGS += -g
# option to the assembler.
KBUILD_AFLAGS += -g
+NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+CHECKFLAGS += $(NOSTDINC_FLAGS)
+
# Report stack usage if supported
KBUILD_CFLAGS += $(call cc-option,-fstack-usage)