linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, arnd@arndb.de, tglx@linutronix.de,
	mingo@kernel.org, davej@redhat.com
Subject: [PATCH 05/13] UAPI: Partition the header include path sets and add uapi/ header directories
Date: Fri, 20 Jul 2012 22:57:38 +0100	[thread overview]
Message-ID: <20120720215738.14854.55273.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20120720215636.14854.41208.stgit@warthog.procyon.org.uk>

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>
---

 Makefile                          |   18 ++++++++++++++----
 arch/cris/Makefile                |    4 +++-
 arch/x86/boot/Makefile            |    4 ++--
 arch/x86/boot/mkcpustr.c          |    2 ++
 arch/x86/include/asm/cpufeature.h |    2 ++
 arch/x86/kernel/cpu/mkcapflags.pl |    5 ++++-
 6 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index aa8e315..d6f09dd 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \
+		-Iinclude/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 \
-                   $(if $(KBUILD_SRC), -I$(srctree)/include) \
-                   -include $(srctree)/include/linux/kconfig.h
+LINUXINCLUDE    := \
+		-I$(srctree)/arch/$(hdr-arch)/include \
+		-Iarch/$(hdr-arch)/include/generated \
+		$(if $(KBUILD_SRC), -I$(srctree)/include) \
+		-Iinclude \
+		$(USERINCLUDE)
 
 KBUILD_CPPFLAGS := -D__KERNEL__
 
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 29c2ceb..39dc7d0 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -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 :=
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 5a747dd..33607c8 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -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 \
diff --git a/arch/x86/boot/mkcpustr.c b/arch/x86/boot/mkcpustr.c
index 919257f..4579eff 100644
--- a/arch/x86/boot/mkcpustr.c
+++ b/arch/x86/boot/mkcpustr.c
@@ -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)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index f91e80f..c89c55d 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -4,7 +4,9 @@
 #ifndef _ASM_X86_CPUFEATURE_H
 #define _ASM_X86_CPUFEATURE_H
 
+#ifndef _ASM_X86_REQUIRED_FEATURES_H
 #include <asm/required-features.h>
+#endif
 
 #define NCAPINTS	10	/* N 32-bit words worth of info */
 
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl
index c7b3fe2..091972e 100644
--- a/arch/x86/kernel/cpu/mkcapflags.pl
+++ b/arch/x86/kernel/cpu/mkcapflags.pl
@@ -8,7 +8,10 @@
 open(IN, "< $in\0")   or die "$0: cannot open: $in: $!\n";
 open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
 
-print OUT "#include <asm/cpufeature.h>\n\n";
+print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n";
+print OUT "#include <asm/cpufeature.h>\n";
+print OUT "#endif\n";
+print OUT "\n";
 print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
 
 %features = ();


  parent reply	other threads:[~2012-07-20 21:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 21:56 [PATCH 00/13] UAPI header file split David Howells
2012-07-20 21:56 ` [PATCH 01/13] UAPI: Refer to the DRM UAPI headers with <...> and from certain headers only David Howells
2012-07-20 21:57 ` [PATCH 02/13] UAPI: (Scripted) Remove redundant DRM UAPI header #inclusions from drivers/gpu/ David Howells
2012-07-20 21:57 ` [PATCH 03/13] UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/ David Howells
2012-07-20 21:57 ` [PATCH 04/13] UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers David Howells
2012-07-20 21:57 ` David Howells [this message]
2012-07-20 21:57 ` [PATCH 06/13] UAPI: (Scripted) Set up UAPI Kbuild files David Howells
2012-07-20 21:58 ` [PATCH 07/13] UAPI: x86: Fix the test_get_len tool David Howells
2012-07-20 21:58 ` [PATCH 08/13] UAPI: x86: Fix insn_sanity build failure after UAPI split David Howells
2012-07-20 21:58 ` [PATCH 09/13] UAPI: Set up uapi/asm/Kbuild.asm David Howells
2012-07-20 21:58 ` [PATCH 10/13] UAPI: Move linux/version.h David Howells
2012-07-20 21:58 ` [PATCH 11/13] UAPI: Remove the objhdr-y export list David Howells
2012-07-20 21:58 ` [PATCH 12/13] UAPI: x86: Differentiate the generated UAPI and internal headers David Howells
2012-07-20 21:59 ` [PATCH 13/13] UAPI: Plumb the UAPI Kbuilds into the user header installation and checking David Howells
2012-07-21  9:41 ` [PATCH 05/13] UAPI: Partition the header include path sets and add uapi/ header directories David Howells
2012-07-21 10:13 ` David Howells
2012-07-23 15:50 ` [PATCH 00/13] UAPI header file split Arnd Bergmann
2012-07-24 12:48 ` Michael Kerrisk
2012-07-24 13:19 ` David Howells
2012-07-25  7:48   ` Michael Kerrisk
2012-07-25 10:23   ` David Howells
2012-07-25 11:01     ` Michael Kerrisk
2012-07-25 11:20     ` David Howells
2012-07-26 13:18       ` Michael Kerrisk
2012-07-26 14:32       ` David Howells
2012-07-26 14:35         ` Michael Kerrisk
2012-07-26 15:22         ` David Howells
2012-07-25 17:32     ` David Howells
2012-07-25 19:21     ` David Howells
2012-07-26 10:17       ` Michael Kerrisk
2012-07-26 10:46       ` David Howells
2012-07-27  7:07         ` Michael Kerrisk
2012-07-26 10:46       ` David Howells
2012-07-26 13:29         ` Michael Kerrisk
2012-07-25 20:06     ` David Howells
2012-07-25 20:09     ` David Howells
2012-08-03  0:15 ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120720215738.14854.55273.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=arnd@arndb.de \
    --cc=davej@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).