summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2021-02-22 08:05:57 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-02-22 10:24:00 +0100
commit9e48729c073ae28a9b59c597011aabf11f3658bd (patch)
tree38b49a0d86d3f98b14feda69a459ccf5cd2f01eb
parent3a5917ddaedb1256a712a6287f7f050038021a98 (diff)
downloadbarebox-9e48729c073ae28a9b59c597011aabf11f3658bd.tar.gz
barebox-9e48729c073ae28a9b59c597011aabf11f3658bd.tar.xz
kbuild: add include/uapi to path
Import the necessary bits out of the Linux Makefile, so include/uapi goes into the path. This allows importing Linux headers without changing the includes too much. Like with Linux <linux/*.h> is first searched in include/, then include/uapi. Code that explicitly needs the uapi header can include <uapi/linux/*.h>. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--Makefile10
1 files changed, 9 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ea1d5dae1c..d13065d29d 100644
--- a/Makefile
+++ b/Makefile
@@ -408,13 +408,21 @@ LDFLAGS_MODULE = -T common/module.lds
# even be read-only.
export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
+# Use USERINCLUDE when you must reference the UAPI directories only.
+USERINCLUDE := \
+ -I$(srctree)/arch/$(SRCARCH)/include/uapi \
+ -I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
+ -I$(srctree)/include/uapi \
+ -I$(objtree)/include/generated/uapi \
+ -include $(srctree)/include/linux/kconfig.h
+
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
LINUXINCLUDE := -Iinclude -I$(srctree)/dts/include \
$(if $(building_out_of_srctree), -I$(srctree)/include) \
-I$(srctree)/arch/$(SRCARCH)/include \
-I$(objtree)/arch/$(SRCARCH)/include \
- -include $(srctree)/include/linux/kconfig.h
+ $(USERINCLUDE)
KBUILD_CPPFLAGS := -D__KERNEL__ -D__BAREBOX__ $(LINUXINCLUDE) -fno-builtin -ffreestanding