Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abbf1590 authored by David Howells's avatar David Howells
Browse files

UAPI: Partition the header include path sets and add uapi/ header directories



Partition the header include path flags into two sets, one for kernelspace
builds and one for userspace builds.

Add the following directories to build after the ordinary include directories
so that #include will pick up the UAPI header directly if the kernel header
has been moved there.

The userspace set (represented by the USERINCLUDE make variable) contains:

	-I $(srctree)/arch/$(hdr-arch)/include/uapi
	-I arch/$(hdr-arch)/include/generated/uapi
	-I $(srctree)/include/uapi
	-I include/generated/uapi
	-include $(srctree)/include/linux/kconfig.h

and the kernelspace set (represented by the LINUXINCLUDE make variable)
contains:

	-I $(srctree)/arch/$(hdr-arch)/include
	-I arch/$(hdr-arch)/include/generated
	-I $(srctree)/include
	-I include		--- if not building in the source tree

plus everything in the USERINCLUDE set.

Then use USERINCLUDE in building the x86 boot code.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: default avatarDave Jones <davej@redhat.com>
parent a1ce3928
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -350,12 +350,22 @@ AFLAGS_KERNEL =
CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage


# Use USERINCLUDE when you must reference the UAPI directories only.
USERINCLUDE    := \
		-I$(srctree)/arch/$(hdr-arch)/include/uapi \
		-Iarch/$(hdr-arch)/include/generated/uapi \
		-I$(srctree)/include/uapi \
		-Iinclude/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    := -I$(srctree)/arch/$(hdr-arch)/include \
                   -Iarch/$(hdr-arch)/include/generated -Iinclude \
LINUXINCLUDE    := \
		-I$(srctree)/arch/$(hdr-arch)/include \
		-Iarch/$(hdr-arch)/include/generated \
		$(if $(KBUILD_SRC), -I$(srctree)/include) \
                   -include $(srctree)/include/linux/kconfig.h
		-Iinclude \
		$(USERINCLUDE)

KBUILD_CPPFLAGS := -D__KERNEL__

+3 −1
Original line number Diff line number Diff line
@@ -23,7 +23,9 @@ mach-$(CONFIG_ETRAXFS) := fs

ifneq ($(arch-y),)
SARCH := arch-$(arch-y)
inc := -Iarch/cris/include/$(SARCH)
inc := -Iarch/cris/include/uapi/$(SARCH)
inc += -Iarch/cris/include/$(SARCH)
inc += -Iarch/cris/include/uapi/$(SARCH)/arch
inc += -Iarch/cris/include/$(SARCH)/arch
else
SARCH :=
+3 −1
Original line number Diff line number Diff line
@@ -66,7 +66,9 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)

KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
		   -I$(HOST_DIR)/include/generated
		   -I$(srctree)/$(HOST_DIR)/include/uapi \
		   -I$(HOST_DIR)/include/generated \
		   -I$(HOST_DIR)/include/generated/uapi

# -Derrno=kernel_errno - This turns all kernel references to errno into
# kernel_errno to separate them from the libc errno.  This allows -fno-common
+2 −2
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ setup-y += video-bios.o
targets		+= $(setup-y)
hostprogs-y	:= mkcpustr tools/build

HOST_EXTRACFLAGS += -I$(srctree)/tools/include $(LINUXINCLUDE) \
HOST_EXTRACFLAGS += -I$(srctree)/tools/include $(USERINCLUDE) \
	            -D__EXPORTED_HEADERS__

$(obj)/cpu.o: $(obj)/cpustr.h
@@ -52,7 +52,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE

# How to compile the 16-bit code.  Note we always compile for -march=i386,
# that way we can complain to the user if the CPU is insufficient.
KBUILD_CFLAGS	:= $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
KBUILD_CFLAGS	:= $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
		   -DDISABLE_BRANCH_PROFILING \
		   -Wall -Wstrict-prototypes \
		   -march=i386 -mregparm=3 \
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@

#include <stdio.h>

#include "../include/asm/required-features.h"
#include "../include/asm/cpufeature.h"
#include "../kernel/cpu/capflags.c"

int main(void)
Loading