aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-10-02 13:01:26 -0400
committerDavid Howells <dhowells@redhat.com>2012-10-02 13:01:26 -0400
commitabbf1590de22a6d2240a59383477da50d1402f6a (patch)
treee67f6a35d2c26328c878065e7796ccbcd8d90142
parenta1ce39288e6fbefdd8d607021d02384eb4a20b99 (diff)
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: David Howells <dhowells@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
-rw-r--r--Makefile18
-rw-r--r--arch/cris/Makefile4
-rw-r--r--arch/um/Makefile4
-rw-r--r--arch/x86/boot/Makefile4
-rw-r--r--arch/x86/boot/mkcpustr.c2
-rw-r--r--arch/x86/include/asm/cpufeature.h2
-rw-r--r--arch/x86/kernel/cpu/mkcapflags.pl5
7 files changed, 30 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 846dd7607854..da1707c3904b 100644
--- a/Makefile
+++ b/Makefile
@@ -350,12 +350,22 @@ AFLAGS_KERNEL =
350CFLAGS_GCOV = -fprofile-arcs -ftest-coverage 350CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
351 351
352 352
353# Use USERINCLUDE when you must reference the UAPI directories only.
354USERINCLUDE := \
355 -I$(srctree)/arch/$(hdr-arch)/include/uapi \
356 -Iarch/$(hdr-arch)/include/generated/uapi \
357 -I$(srctree)/include/uapi \
358 -Iinclude/generated/uapi \
359 -include $(srctree)/include/linux/kconfig.h
360
353# Use LINUXINCLUDE when you must reference the include/ directory. 361# Use LINUXINCLUDE when you must reference the include/ directory.
354# Needed to be compatible with the O= option 362# Needed to be compatible with the O= option
355LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \ 363LINUXINCLUDE := \
356 -Iarch/$(hdr-arch)/include/generated -Iinclude \ 364 -I$(srctree)/arch/$(hdr-arch)/include \
357 $(if $(KBUILD_SRC), -I$(srctree)/include) \ 365 -Iarch/$(hdr-arch)/include/generated \
358 -include $(srctree)/include/linux/kconfig.h 366 $(if $(KBUILD_SRC), -I$(srctree)/include) \
367 -Iinclude \
368 $(USERINCLUDE)
359 369
360KBUILD_CPPFLAGS := -D__KERNEL__ 370KBUILD_CPPFLAGS := -D__KERNEL__
361 371
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 29c2ceb38a76..39dc7d00083e 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -23,7 +23,9 @@ mach-$(CONFIG_ETRAXFS) := fs
23 23
24ifneq ($(arch-y),) 24ifneq ($(arch-y),)
25SARCH := arch-$(arch-y) 25SARCH := arch-$(arch-y)
26inc := -Iarch/cris/include/$(SARCH) 26inc := -Iarch/cris/include/uapi/$(SARCH)
27inc += -Iarch/cris/include/$(SARCH)
28inc += -Iarch/cris/include/uapi/$(SARCH)/arch
27inc += -Iarch/cris/include/$(SARCH)/arch 29inc += -Iarch/cris/include/$(SARCH)/arch
28else 30else
29SARCH := 31SARCH :=
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 097091059aaa..133f7de2a13d 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -66,7 +66,9 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
66include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) 66include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
67 67
68KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \ 68KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
69 -I$(HOST_DIR)/include/generated 69 -I$(srctree)/$(HOST_DIR)/include/uapi \
70 -I$(HOST_DIR)/include/generated \
71 -I$(HOST_DIR)/include/generated/uapi
70 72
71# -Derrno=kernel_errno - This turns all kernel references to errno into 73# -Derrno=kernel_errno - This turns all kernel references to errno into
72# kernel_errno to separate them from the libc errno. This allows -fno-common 74# kernel_errno to separate them from the libc errno. This allows -fno-common
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index f7535bedc33f..ce03476d8c8f 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -37,7 +37,7 @@ setup-y += video-bios.o
37targets += $(setup-y) 37targets += $(setup-y)
38hostprogs-y := mkcpustr tools/build 38hostprogs-y := mkcpustr tools/build
39 39
40HOST_EXTRACFLAGS += -I$(srctree)/tools/include $(LINUXINCLUDE) \ 40HOST_EXTRACFLAGS += -I$(srctree)/tools/include $(USERINCLUDE) \
41 -D__EXPORTED_HEADERS__ 41 -D__EXPORTED_HEADERS__
42 42
43$(obj)/cpu.o: $(obj)/cpustr.h 43$(obj)/cpu.o: $(obj)/cpustr.h
@@ -52,7 +52,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE
52 52
53# How to compile the 16-bit code. Note we always compile for -march=i386, 53# How to compile the 16-bit code. Note we always compile for -march=i386,
54# that way we can complain to the user if the CPU is insufficient. 54# that way we can complain to the user if the CPU is insufficient.
55KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ 55KBUILD_CFLAGS := $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
56 -DDISABLE_BRANCH_PROFILING \ 56 -DDISABLE_BRANCH_PROFILING \
57 -Wall -Wstrict-prototypes \ 57 -Wall -Wstrict-prototypes \
58 -march=i386 -mregparm=3 \ 58 -march=i386 -mregparm=3 \
diff --git a/arch/x86/boot/mkcpustr.c b/arch/x86/boot/mkcpustr.c
index 919257f526f2..4579eff0ef4d 100644
--- a/arch/x86/boot/mkcpustr.c
+++ b/arch/x86/boot/mkcpustr.c
@@ -15,6 +15,8 @@
15 15
16#include <stdio.h> 16#include <stdio.h>
17 17
18#include "../include/asm/required-features.h"
19#include "../include/asm/cpufeature.h"
18#include "../kernel/cpu/capflags.c" 20#include "../kernel/cpu/capflags.c"
19 21
20int main(void) 22int main(void)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 16cae425d1f8..8c297aa53eef 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -4,7 +4,9 @@
4#ifndef _ASM_X86_CPUFEATURE_H 4#ifndef _ASM_X86_CPUFEATURE_H
5#define _ASM_X86_CPUFEATURE_H 5#define _ASM_X86_CPUFEATURE_H
6 6
7#ifndef _ASM_X86_REQUIRED_FEATURES_H
7#include <asm/required-features.h> 8#include <asm/required-features.h>
9#endif
8 10
9#define NCAPINTS 10 /* N 32-bit words worth of info */ 11#define NCAPINTS 10 /* N 32-bit words worth of info */
10 12
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl
index c7b3fe2d72e0..091972ef49de 100644
--- a/arch/x86/kernel/cpu/mkcapflags.pl
+++ b/arch/x86/kernel/cpu/mkcapflags.pl
@@ -8,7 +8,10 @@
8open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n"; 8open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n";
9open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n"; 9open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
10 10
11print OUT "#include <asm/cpufeature.h>\n\n"; 11print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n";
12print OUT "#include <asm/cpufeature.h>\n";
13print OUT "#endif\n";
14print OUT "\n";
12print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; 15print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
13 16
14%features = (); 17%features = ();