aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 17:55:52 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 17:55:52 -0400
commit398477d4bd57cc33792fd93035c2763ad78629c4 (patch)
tree8a9cc1cd2f371843f6242b877cbdce9e109a06ed
parent6e936d3e9a45a4307e7f4a29ee9829e7a0464af1 (diff)
parent6d71627581e96efb3717960b79fc2167a4617977 (diff)
Merge git://git.infradead.org/~dwmw2/khdrs-2.6
* git://git.infradead.org/~dwmw2/khdrs-2.6: New 'make headers_install_all' target. Use dependencies for 'make headers_install'. [S390] Unexport <asm/z90crypt.h>, export <asm/zcrypt.h> in its place. Remove dead netfilter_logging.h from include/linux/Kbuild Remove offsetof() from user-visible <linux/stddef.h> Clean up exported headers on CRIS Fix v850 exported headers Don't advertise (or allow) headers_{install,check} where inappropriate. Remove UML header export Remove ARM26 header export. Fix H8300 exported headers. Fix m68knommu exported headers Fix exported headers for SPARC, SPARC64 Fix 'make headers_check' on m32r Fix 'make headers_check' on sh64 Fix 'make headers_check' on sh [HEADERS] Fix ARM 'make headers_check' Initial pass of manual conflict resolution in top-level Makefile over conflicting build rule and headers_install changes.
-rw-r--r--Makefile20
-rw-r--r--arch/sh/kernel/process.c1
-rw-r--r--include/asm-arm/elf.h18
-rw-r--r--include/asm-arm/page.h4
-rw-r--r--include/asm-arm26/Kbuild1
-rw-r--r--include/asm-cris/Kbuild4
-rw-r--r--include/asm-cris/arch-v10/Kbuild2
-rw-r--r--include/asm-cris/arch-v32/Kbuild2
-rw-r--r--include/asm-cris/byteorder.h3
-rw-r--r--include/asm-cris/elf.h8
-rw-r--r--include/asm-cris/page.h8
-rw-r--r--include/asm-cris/posix_types.h9
-rw-r--r--include/asm-cris/unistd.h4
-rw-r--r--include/asm-h8300/page.h7
-rw-r--r--include/asm-m32r/page.h3
-rw-r--r--include/asm-m32r/ptrace.h4
-rw-r--r--include/asm-m32r/signal.h1
-rw-r--r--include/asm-m32r/unistd.h4
-rw-r--r--include/asm-m32r/user.h1
-rw-r--r--include/asm-m68knommu/page.h7
-rw-r--r--include/asm-s390/Kbuild2
-rw-r--r--include/asm-sh/page.h3
-rw-r--r--include/asm-sh/ptrace.h2
-rw-r--r--include/asm-sh64/page.h3
-rw-r--r--include/asm-sh64/shmparam.h16
-rw-r--r--include/asm-sh64/signal.h1
-rw-r--r--include/asm-sh64/user.h1
-rw-r--r--include/asm-sparc/Kbuild7
-rw-r--r--include/asm-sparc/page.h8
-rw-r--r--include/asm-sparc64/Kbuild5
-rw-r--r--include/asm-sparc64/page.h9
-rw-r--r--include/asm-sparc64/shmparam.h2
-rw-r--r--include/asm-um/Kbuild1
-rw-r--r--include/asm-v850/page.h7
-rw-r--r--include/asm-v850/param.h4
-rw-r--r--include/linux/Kbuild3
-rw-r--r--include/linux/stddef.h2
-rw-r--r--scripts/Makefile.headersinst124
-rwxr-xr-xscripts/hdrcheck.sh2
39 files changed, 171 insertions, 142 deletions
diff --git a/Makefile b/Makefile
index fce530a66e33..7a06c16602fd 100644
--- a/Makefile
+++ b/Makefile
@@ -921,8 +921,20 @@ depend dep:
921INSTALL_HDR_PATH=$(objtree)/usr 921INSTALL_HDR_PATH=$(objtree)/usr
922export INSTALL_HDR_PATH 922export INSTALL_HDR_PATH
923 923
924HDRARCHES=$(filter-out generic,$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild)))
925
926PHONY += headers_install_all
927headers_install_all: include/linux/version.h scripts_basic FORCE
928 $(Q)$(MAKE) $(build)=scripts scripts/unifdef
929 $(Q)for arch in $(HDRARCHES); do \
930 $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\
931 done
932
924PHONY += headers_install 933PHONY += headers_install
925headers_install: include/linux/version.h scripts_basic FORCE 934headers_install: include/linux/version.h scripts_basic FORCE
935 @if [ ! -r include/asm-$(ARCH)/Kbuild ]; then \
936 echo '*** Error: Headers not exportable for this architecture ($(ARCH))'; \
937 exit 1 ; fi
926 $(Q)$(MAKE) $(build)=scripts scripts/unifdef 938 $(Q)$(MAKE) $(build)=scripts scripts/unifdef
927 $(Q)rm -rf $(INSTALL_HDR_PATH)/include 939 $(Q)rm -rf $(INSTALL_HDR_PATH)/include
928 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include 940 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include
@@ -1107,13 +1119,17 @@ help:
1107 @echo ' cscope - Generate cscope index' 1119 @echo ' cscope - Generate cscope index'
1108 @echo ' kernelrelease - Output the release version string' 1120 @echo ' kernelrelease - Output the release version string'
1109 @echo ' kernelversion - Output the version stored in Makefile' 1121 @echo ' kernelversion - Output the version stored in Makefile'
1110 @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH' 1122 @if [ -r include/asm-$(ARCH)/Kbuild ]; then \
1123 echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1124 fi
1111 @echo ' (default: $(INSTALL_HDR_PATH))' 1125 @echo ' (default: $(INSTALL_HDR_PATH))'
1112 @echo '' 1126 @echo ''
1113 @echo 'Static analysers' 1127 @echo 'Static analysers'
1114 @echo ' checkstack - Generate a list of stack hogs' 1128 @echo ' checkstack - Generate a list of stack hogs'
1115 @echo ' namespacecheck - Name space analysis on compiled kernel' 1129 @echo ' namespacecheck - Name space analysis on compiled kernel'
1116 @echo ' headers_check - Sanity check on exported headers' 1130 @if [ -r include/asm-$(ARCH)/Kbuild ]; then \
1131 echo ' headers_check - Sanity check on exported headers'; \
1132 fi
1117 @echo '' 1133 @echo ''
1118 @echo 'Kernel packaging:' 1134 @echo 'Kernel packaging:'
1119 @$(MAKE) $(build)=$(package-dir) help 1135 @$(MAKE) $(build)=$(package-dir) help
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 22dc9c21201d..f2031314cb2b 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -26,6 +26,7 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
28#include <asm/elf.h> 28#include <asm/elf.h>
29#include <asm/ubc.h>
29 30
30static int hlt_counter=0; 31static int hlt_counter=0;
31 32
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index ae7baa6c73f7..17f0c656d272 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -8,9 +8,6 @@
8 8
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10#include <asm/user.h> 10#include <asm/user.h>
11#ifdef __KERNEL
12#include <asm/procinfo.h>
13#endif
14 11
15typedef unsigned long elf_greg_t; 12typedef unsigned long elf_greg_t;
16typedef unsigned long elf_freg_t[3]; 13typedef unsigned long elf_freg_t[3];
@@ -32,11 +29,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
32typedef struct user_fp elf_fpregset_t; 29typedef struct user_fp elf_fpregset_t;
33 30
34/* 31/*
35 * This is used to ensure we don't load something for the wrong architecture.
36 */
37#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) )
38
39/*
40 * These are used to set parameters in the core dumps. 32 * These are used to set parameters in the core dumps.
41 */ 33 */
42#define ELF_CLASS ELFCLASS32 34#define ELF_CLASS ELFCLASS32
@@ -47,6 +39,14 @@ typedef struct user_fp elf_fpregset_t;
47#endif 39#endif
48#define ELF_ARCH EM_ARM 40#define ELF_ARCH EM_ARM
49 41
42#ifdef __KERNEL__
43#include <asm/procinfo.h>
44
45/*
46 * This is used to ensure we don't load something for the wrong architecture.
47 */
48#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) )
49
50#define USE_ELF_CORE_DUMP 50#define USE_ELF_CORE_DUMP
51#define ELF_EXEC_PAGESIZE 4096 51#define ELF_EXEC_PAGESIZE 4096
52 52
@@ -83,8 +83,6 @@ typedef struct user_fp elf_fpregset_t;
83extern char elf_platform[]; 83extern char elf_platform[];
84#define ELF_PLATFORM (elf_platform) 84#define ELF_PLATFORM (elf_platform)
85 85
86#ifdef __KERNEL__
87
88/* 86/*
89 * 32-bit code is always OK. Some cpus can do 26-bit, some can't. 87 * 32-bit code is always OK. Some cpus can do 26-bit, some can't.
90 */ 88 */
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index b721270b9986..02bd3ee935b0 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -11,13 +11,13 @@
11#define _ASMARM_PAGE_H 11#define _ASMARM_PAGE_H
12 12
13 13
14#ifdef __KERNEL__
15
14/* PAGE_SHIFT determines the page size */ 16/* PAGE_SHIFT determines the page size */
15#define PAGE_SHIFT 12 17#define PAGE_SHIFT 12
16#define PAGE_SIZE (1UL << PAGE_SHIFT) 18#define PAGE_SIZE (1UL << PAGE_SHIFT)
17#define PAGE_MASK (~(PAGE_SIZE-1)) 19#define PAGE_MASK (~(PAGE_SIZE-1))
18 20
19#ifdef __KERNEL__
20
21/* to align the pointer to the (next) page boundary */ 21/* to align the pointer to the (next) page boundary */
22#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 22#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
23 23
diff --git a/include/asm-arm26/Kbuild b/include/asm-arm26/Kbuild
deleted file mode 100644
index c68e1680da01..000000000000
--- a/include/asm-arm26/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1include include/asm-generic/Kbuild.asm
diff --git a/include/asm-cris/Kbuild b/include/asm-cris/Kbuild
index c68e1680da01..14498d5a2f65 100644
--- a/include/asm-cris/Kbuild
+++ b/include/asm-cris/Kbuild
@@ -1 +1,5 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3header-y += arch-v10/ arch-v32/
4
5unifdef-y += rs485.h
diff --git a/include/asm-cris/arch-v10/Kbuild b/include/asm-cris/arch-v10/Kbuild
new file mode 100644
index 000000000000..d7f27dc0941a
--- /dev/null
+++ b/include/asm-cris/arch-v10/Kbuild
@@ -0,0 +1,2 @@
1header-y += ptrace.h
2header-y += user.h
diff --git a/include/asm-cris/arch-v32/Kbuild b/include/asm-cris/arch-v32/Kbuild
new file mode 100644
index 000000000000..d7f27dc0941a
--- /dev/null
+++ b/include/asm-cris/arch-v32/Kbuild
@@ -0,0 +1,2 @@
1header-y += ptrace.h
2header-y += user.h
diff --git a/include/asm-cris/byteorder.h b/include/asm-cris/byteorder.h
index a1a222adaa9f..0cd9db1cc888 100644
--- a/include/asm-cris/byteorder.h
+++ b/include/asm-cris/byteorder.h
@@ -3,14 +3,15 @@
3 3
4#ifdef __GNUC__ 4#ifdef __GNUC__
5 5
6#ifdef __KERNEL__
6#include <asm/arch/byteorder.h> 7#include <asm/arch/byteorder.h>
7 8
8/* defines are necessary because the other files detect the presence 9/* defines are necessary because the other files detect the presence
9 * of a defined __arch_swab32, not an inline 10 * of a defined __arch_swab32, not an inline
10 */ 11 */
11
12#define __arch__swab32(x) ___arch__swab32(x) 12#define __arch__swab32(x) ___arch__swab32(x)
13#define __arch__swab16(x) ___arch__swab16(x) 13#define __arch__swab16(x) ___arch__swab16(x)
14#endif /* __KERNEL__ */
14 15
15#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 16#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
16# define __BYTEORDER_HAS_U64__ 17# define __BYTEORDER_HAS_U64__
diff --git a/include/asm-cris/elf.h b/include/asm-cris/elf.h
index 87a60bd8e667..96a40c1de57c 100644
--- a/include/asm-cris/elf.h
+++ b/include/asm-cris/elf.h
@@ -5,7 +5,6 @@
5 * ELF register definitions.. 5 * ELF register definitions..
6 */ 6 */
7 7
8#include <asm/arch/elf.h>
9#include <asm/user.h> 8#include <asm/user.h>
10 9
11#define R_CRIS_NONE 0 10#define R_CRIS_NONE 0
@@ -46,6 +45,9 @@ typedef unsigned long elf_fpregset_t;
46#define ELF_DATA ELFDATA2LSB 45#define ELF_DATA ELFDATA2LSB
47#define ELF_ARCH EM_CRIS 46#define ELF_ARCH EM_CRIS
48 47
48#ifdef __KERNEL__
49#include <asm/arch/elf.h>
50
49/* The master for these definitions is {binutils}/include/elf/cris.h: */ 51/* The master for these definitions is {binutils}/include/elf/cris.h: */
50/* User symbols in this file have a leading underscore. */ 52/* User symbols in this file have a leading underscore. */
51#define EF_CRIS_UNDERSCORE 0x00000001 53#define EF_CRIS_UNDERSCORE 0x00000001
@@ -87,8 +89,8 @@ typedef unsigned long elf_fpregset_t;
87 89
88#define ELF_PLATFORM (NULL) 90#define ELF_PLATFORM (NULL)
89 91
90#ifdef __KERNEL__
91#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 92#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
92#endif 93
94#endif /* __KERNEL__ */
93 95
94#endif 96#endif
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index 81832e9e157f..9f13c32552bf 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -1,6 +1,8 @@
1#ifndef _CRIS_PAGE_H 1#ifndef _CRIS_PAGE_H
2#define _CRIS_PAGE_H 2#define _CRIS_PAGE_H
3 3
4#ifdef __KERNEL__
5
4#include <asm/arch/page.h> 6#include <asm/arch/page.h>
5 7
6/* PAGE_SHIFT determines the page size */ 8/* PAGE_SHIFT determines the page size */
@@ -12,8 +14,6 @@
12#endif 14#endif
13#define PAGE_MASK (~(PAGE_SIZE-1)) 15#define PAGE_MASK (~(PAGE_SIZE-1))
14 16
15#ifdef __KERNEL__
16
17#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 17#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
18#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) 18#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
19 19
@@ -73,10 +73,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
73#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 73#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
74 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 74 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
75 75
76#endif /* __KERNEL__ */
77
78#include <asm-generic/memory_model.h> 76#include <asm-generic/memory_model.h>
79#include <asm-generic/page.h> 77#include <asm-generic/page.h>
80 78
79#endif /* __KERNEL__ */
80
81#endif /* _CRIS_PAGE_H */ 81#endif /* _CRIS_PAGE_H */
82 82
diff --git a/include/asm-cris/posix_types.h b/include/asm-cris/posix_types.h
index 6d26fee4a614..7b9ed22ab5dd 100644
--- a/include/asm-cris/posix_types.h
+++ b/include/asm-cris/posix_types.h
@@ -6,8 +6,6 @@
6#ifndef __ARCH_CRIS_POSIX_TYPES_H 6#ifndef __ARCH_CRIS_POSIX_TYPES_H
7#define __ARCH_CRIS_POSIX_TYPES_H 7#define __ARCH_CRIS_POSIX_TYPES_H
8 8
9#include <asm/bitops.h>
10
11/* 9/*
12 * This file is generally used by user-level software, so you need to 10 * This file is generally used by user-level software, so you need to
13 * be a little careful about namespace pollution etc. Also, we cannot 11 * be a little careful about namespace pollution etc. Also, we cannot
@@ -53,9 +51,8 @@ typedef struct {
53#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ 51#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
54} __kernel_fsid_t; 52} __kernel_fsid_t;
55 53
56/* should this ifdef be here ? */ 54#ifdef __KERNEL__
57 55#include <asm/bitops.h>
58#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
59 56
60#undef __FD_SET 57#undef __FD_SET
61#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp)) 58#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp))
@@ -69,6 +66,6 @@ typedef struct {
69#undef __FD_ZERO 66#undef __FD_ZERO
70#define __FD_ZERO(fdsetp) memset((void *)(fdsetp), 0, __FDSET_LONGS << 2) 67#define __FD_ZERO(fdsetp) memset((void *)(fdsetp), 0, __FDSET_LONGS << 2)
71 68
72#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ 69#endif /* __KERNEL__ */
73 70
74#endif /* __ARCH_CRIS_POSIX_TYPES_H */ 71#endif /* __ARCH_CRIS_POSIX_TYPES_H */
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index c2954e90aa24..7372efae0516 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_CRIS_UNISTD_H_ 1#ifndef _ASM_CRIS_UNISTD_H_
2#define _ASM_CRIS_UNISTD_H_ 2#define _ASM_CRIS_UNISTD_H_
3 3
4#include <asm/arch/unistd.h>
5
6/* 4/*
7 * This file contains the system call numbers, and stub macros for libc. 5 * This file contains the system call numbers, and stub macros for libc.
8 */ 6 */
@@ -299,6 +297,7 @@
299 297
300#define NR_syscalls 289 298#define NR_syscalls 289
301 299
300#include <asm/arch/unistd.h>
302 301
303#define __ARCH_WANT_IPC_PARSE_VERSION 302#define __ARCH_WANT_IPC_PARSE_VERSION
304#define __ARCH_WANT_OLD_READDIR 303#define __ARCH_WANT_OLD_READDIR
@@ -322,7 +321,6 @@
322#define __ARCH_WANT_SYS_SIGPENDING 321#define __ARCH_WANT_SYS_SIGPENDING
323#define __ARCH_WANT_SYS_SIGPROCMASK 322#define __ARCH_WANT_SYS_SIGPROCMASK
324#define __ARCH_WANT_SYS_RT_SIGACTION 323#define __ARCH_WANT_SYS_RT_SIGACTION
325#endif
326 324
327#ifdef __KERNEL_SYSCALLS__ 325#ifdef __KERNEL_SYSCALLS__
328 326
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
index d673077d2fd6..3b4f2903f91d 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -1,6 +1,7 @@
1#ifndef _H8300_PAGE_H 1#ifndef _H8300_PAGE_H
2#define _H8300_PAGE_H 2#define _H8300_PAGE_H
3 3
4#ifdef __KERNEL__
4 5
5/* PAGE_SHIFT determines the page size */ 6/* PAGE_SHIFT determines the page size */
6 7
@@ -8,8 +9,6 @@
8#define PAGE_SIZE (1UL << PAGE_SHIFT) 9#define PAGE_SIZE (1UL << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1)) 10#define PAGE_MASK (~(PAGE_SIZE-1))
10 11
11#ifdef __KERNEL__
12
13#include <asm/setup.h> 12#include <asm/setup.h>
14 13
15#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
@@ -76,9 +75,9 @@ extern unsigned long memory_end;
76 75
77#endif /* __ASSEMBLY__ */ 76#endif /* __ASSEMBLY__ */
78 77
79#endif /* __KERNEL__ */
80
81#include <asm-generic/memory_model.h> 78#include <asm-generic/memory_model.h>
82#include <asm-generic/page.h> 79#include <asm-generic/page.h>
83 80
81#endif /* __KERNEL__ */
82
84#endif /* _H8300_PAGE_H */ 83#endif /* _H8300_PAGE_H */
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 9688be003620..404a4c24007b 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -87,10 +87,9 @@ typedef struct { unsigned long pgprot; } pgprot_t;
87 87
88#define devmem_is_allowed(x) 1 88#define devmem_is_allowed(x) 1
89 89
90#endif /* __KERNEL__ */
91
92#include <asm-generic/memory_model.h> 90#include <asm-generic/memory_model.h>
93#include <asm-generic/page.h> 91#include <asm-generic/page.h>
94 92
93#endif /* __KERNEL__ */
95#endif /* _ASM_M32R_PAGE_H */ 94#endif /* _ASM_M32R_PAGE_H */
96 95
diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h
index a07fa90314d2..2d2a6c97331e 100644
--- a/include/asm-m32r/ptrace.h
+++ b/include/asm-m32r/ptrace.h
@@ -12,8 +12,6 @@
12 * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org> 12 * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org>
13 */ 13 */
14 14
15#include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
16
17/* 0 - 13 are integer registers (general purpose registers). */ 15/* 0 - 13 are integer registers (general purpose registers). */
18#define PT_R4 0 16#define PT_R4 0
19#define PT_R5 1 17#define PT_R5 1
@@ -140,6 +138,8 @@ struct pt_regs {
140 138
141#ifdef __KERNEL__ 139#ifdef __KERNEL__
142 140
141#include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
142
143#define __ARCH_SYS_PTRACE 1 143#define __ARCH_SYS_PTRACE 1
144 144
145#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) 145#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2)
diff --git a/include/asm-m32r/signal.h b/include/asm-m32r/signal.h
index e750045164d4..65423bed32b1 100644
--- a/include/asm-m32r/signal.h
+++ b/include/asm-m32r/signal.h
@@ -6,7 +6,6 @@
6/* orig : i386 2.4.18 */ 6/* orig : i386 2.4.18 */
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/linkage.h>
10#include <linux/time.h> 9#include <linux/time.h>
11#include <linux/compiler.h> 10#include <linux/compiler.h>
12 11
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index cc31790d8077..89f376e6229f 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -3,8 +3,6 @@
3 3
4/* $Id$ */ 4/* $Id$ */
5 5
6#include <asm/syscall.h> /* SYSCALL_* */
7
8/* 6/*
9 * This file contains the system call numbers. 7 * This file contains the system call numbers.
10 */ 8 */
@@ -303,6 +301,8 @@
303 * <asm-m32r/errno.h> 301 * <asm-m32r/errno.h>
304 */ 302 */
305 303
304#include <asm/syscall.h> /* SYSCALL_* */
305
306#define __syscall_return(type, res) \ 306#define __syscall_return(type, res) \
307do { \ 307do { \
308 if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \ 308 if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \
diff --git a/include/asm-m32r/user.h b/include/asm-m32r/user.h
index 2ffd0c65a782..1ad4ded8483b 100644
--- a/include/asm-m32r/user.h
+++ b/include/asm-m32r/user.h
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <asm/processor.h>
12#include <asm/ptrace.h> 11#include <asm/ptrace.h>
13#include <asm/page.h> 12#include <asm/page.h>
14 13
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h
index a22bf5a88160..2a1b8bdcb29c 100644
--- a/include/asm-m68knommu/page.h
+++ b/include/asm-m68knommu/page.h
@@ -1,6 +1,7 @@
1#ifndef _M68KNOMMU_PAGE_H 1#ifndef _M68KNOMMU_PAGE_H
2#define _M68KNOMMU_PAGE_H 2#define _M68KNOMMU_PAGE_H
3 3
4#ifdef __KERNEL__
4 5
5/* PAGE_SHIFT determines the page size */ 6/* PAGE_SHIFT determines the page size */
6 7
@@ -8,8 +9,6 @@
8#define PAGE_SIZE (1UL << PAGE_SHIFT) 9#define PAGE_SIZE (1UL << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1)) 10#define PAGE_MASK (~(PAGE_SIZE-1))
10 11
11#ifdef __KERNEL__
12
13#include <asm/setup.h> 12#include <asm/setup.h>
14 13
15#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
@@ -76,8 +75,8 @@ extern unsigned long memory_end;
76 75
77#endif /* __ASSEMBLY__ */ 76#endif /* __ASSEMBLY__ */
78 77
79#endif /* __KERNEL__ */
80
81#include <asm-generic/page.h> 78#include <asm-generic/page.h>
82 79
80#endif /* __KERNEL__ */
81
83#endif /* _M68KNOMMU_PAGE_H */ 82#endif /* _M68KNOMMU_PAGE_H */
diff --git a/include/asm-s390/Kbuild b/include/asm-s390/Kbuild
index 088969d55e72..e92b429d2be1 100644
--- a/include/asm-s390/Kbuild
+++ b/include/asm-s390/Kbuild
@@ -6,7 +6,7 @@ header-y += qeth.h
6header-y += tape390.h 6header-y += tape390.h
7header-y += ucontext.h 7header-y += ucontext.h
8header-y += vtoc.h 8header-y += vtoc.h
9header-y += z90crypt.h 9header-y += zcrypt.h
10 10
11unifdef-y += cmb.h 11unifdef-y += cmb.h
12unifdef-y += debug.h 12unifdef-y += debug.h
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 5a057b00f19a..6f7eb8a3aba5 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -112,9 +112,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
112#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 112#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
114 114
115#endif /* __KERNEL__ */
116
117#include <asm-generic/memory_model.h> 115#include <asm-generic/memory_model.h>
118#include <asm-generic/page.h> 116#include <asm-generic/page.h>
119 117
118#endif /* __KERNEL__ */
120#endif /* __ASM_SH_PAGE_H */ 119#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h
index 792fc35bd624..ed358a376e6e 100644
--- a/include/asm-sh/ptrace.h
+++ b/include/asm-sh/ptrace.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_SH_PTRACE_H 1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H 2#define __ASM_SH_PTRACE_H
3 3
4#include <asm/ubc.h>
5
6/* 4/*
7 * Copyright (C) 1999, 2000 Niibe Yutaka 5 * Copyright (C) 1999, 2000 Niibe Yutaka
8 * 6 *
diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h
index 34fb34754ae6..472089aefc60 100644
--- a/include/asm-sh64/page.h
+++ b/include/asm-sh64/page.h
@@ -112,9 +112,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
112#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 112#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
114 114
115#endif /* __KERNEL__ */
116
117#include <asm-generic/memory_model.h> 115#include <asm-generic/memory_model.h>
118#include <asm-generic/page.h> 116#include <asm-generic/page.h>
119 117
118#endif /* __KERNEL__ */
120#endif /* __ASM_SH64_PAGE_H */ 119#endif /* __ASM_SH64_PAGE_H */
diff --git a/include/asm-sh64/shmparam.h b/include/asm-sh64/shmparam.h
index d3a99a4dc0e3..1bb820c833ee 100644
--- a/include/asm-sh64/shmparam.h
+++ b/include/asm-sh64/shmparam.h
@@ -2,19 +2,11 @@
2#define __ASM_SH64_SHMPARAM_H 2#define __ASM_SH64_SHMPARAM_H
3 3
4/* 4/*
5 * This file is subject to the terms and conditions of the GNU General Public 5 * Set this to a sensible safe default, we'll work out the specifics for the
6 * License. See the file "COPYING" in the main directory of this archive 6 * align mask from the cache descriptor at run-time.
7 * for more details.
8 *
9 * include/asm-sh64/shmparam.h
10 *
11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 *
13 */ 7 */
8#define SHMLBA 0x4000
14 9
15#include <asm/cache.h> 10#define __ARCH_FORCE_SHMLBA
16
17/* attach addr a multiple of this */
18#define SHMLBA (cpu_data->dcache.sets * L1_CACHE_BYTES)
19 11
20#endif /* __ASM_SH64_SHMPARAM_H */ 12#endif /* __ASM_SH64_SHMPARAM_H */
diff --git a/include/asm-sh64/signal.h b/include/asm-sh64/signal.h
index a5a28203cb3b..244e134730d9 100644
--- a/include/asm-sh64/signal.h
+++ b/include/asm-sh64/signal.h
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/processor.h>
17 16
18/* Avoid too many header ordering problems. */ 17/* Avoid too many header ordering problems. */
19struct siginfo; 18struct siginfo;
diff --git a/include/asm-sh64/user.h b/include/asm-sh64/user.h
index 8f32f39a8ca9..eb3b33edd73e 100644
--- a/include/asm-sh64/user.h
+++ b/include/asm-sh64/user.h
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/processor.h>
17#include <asm/ptrace.h> 16#include <asm/ptrace.h>
18#include <asm/page.h> 17#include <asm/page.h>
19 18
diff --git a/include/asm-sparc/Kbuild b/include/asm-sparc/Kbuild
index b22b67a64ecc..c6a55cf0d337 100644
--- a/include/asm-sparc/Kbuild
+++ b/include/asm-sparc/Kbuild
@@ -2,20 +2,13 @@ include include/asm-generic/Kbuild.asm
2 2
3header-y += apc.h 3header-y += apc.h
4header-y += asi.h 4header-y += asi.h
5header-y += auxio.h
6header-y += bpp.h 5header-y += bpp.h
7header-y += head.h
8header-y += ipc.h
9header-y += jsflash.h 6header-y += jsflash.h
10header-y += openpromio.h 7header-y += openpromio.h
11header-y += pbm.h
12header-y += pconf.h 8header-y += pconf.h
13header-y += pgtsun4.h
14header-y += reg.h 9header-y += reg.h
15header-y += traps.h 10header-y += traps.h
16header-y += turbosparc.h
17header-y += vfc_ioctls.h 11header-y += vfc_ioctls.h
18header-y += winmacro.h
19 12
20unifdef-y += fbio.h 13unifdef-y += fbio.h
21unifdef-y += perfctr.h 14unifdef-y += perfctr.h
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 5bab8a7c25ce..ff57648eb8f8 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -8,6 +8,8 @@
8#ifndef _SPARC_PAGE_H 8#ifndef _SPARC_PAGE_H
9#define _SPARC_PAGE_H 9#define _SPARC_PAGE_H
10 10
11#ifdef __KERNEL__
12
11#ifdef CONFIG_SUN4 13#ifdef CONFIG_SUN4
12#define PAGE_SHIFT 13 14#define PAGE_SHIFT 13
13#else 15#else
@@ -21,8 +23,6 @@
21#endif 23#endif
22#define PAGE_MASK (~(PAGE_SIZE-1)) 24#define PAGE_MASK (~(PAGE_SIZE-1))
23 25
24#ifdef __KERNEL__
25
26#include <asm/btfixup.h> 26#include <asm/btfixup.h>
27 27
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
@@ -160,9 +160,9 @@ extern unsigned long pfn_base;
160#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 160#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
161 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 161 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
162 162
163#endif /* __KERNEL__ */
164
165#include <asm-generic/memory_model.h> 163#include <asm-generic/memory_model.h>
166#include <asm-generic/page.h> 164#include <asm-generic/page.h>
167 165
166#endif /* __KERNEL__ */
167
168#endif /* _SPARC_PAGE_H */ 168#endif /* _SPARC_PAGE_H */
diff --git a/include/asm-sparc64/Kbuild b/include/asm-sparc64/Kbuild
index 4b59ce46cc2d..a7f44408c93b 100644
--- a/include/asm-sparc64/Kbuild
+++ b/include/asm-sparc64/Kbuild
@@ -8,15 +8,12 @@ header-y += apb.h
8header-y += asi.h 8header-y += asi.h
9header-y += bbc.h 9header-y += bbc.h
10header-y += bpp.h 10header-y += bpp.h
11header-y += const.h
11header-y += display7seg.h 12header-y += display7seg.h
12header-y += envctrl.h 13header-y += envctrl.h
13header-y += floppy.h
14header-y += ipc.h 14header-y += ipc.h
15header-y += kdebug.h
16header-y += mostek.h
17header-y += openprom.h 15header-y += openprom.h
18header-y += openpromio.h 16header-y += openpromio.h
19header-y += parport.h
20header-y += pconf.h 17header-y += pconf.h
21header-y += psrcompat.h 18header-y += psrcompat.h
22header-y += pstate.h 19header-y += pstate.h
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index fdf0ceb76028..ff736eafa64d 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -3,6 +3,8 @@
3#ifndef _SPARC64_PAGE_H 3#ifndef _SPARC64_PAGE_H
4#define _SPARC64_PAGE_H 4#define _SPARC64_PAGE_H
5 5
6#ifdef __KERNEL__
7
6#include <asm/const.h> 8#include <asm/const.h>
7 9
8#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB) 10#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
@@ -27,8 +29,6 @@
27#define DCACHE_ALIASING_POSSIBLE 29#define DCACHE_ALIASING_POSSIBLE
28#endif 30#endif
29 31
30#ifdef __KERNEL__
31
32#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB) 32#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
33#define HPAGE_SHIFT 22 33#define HPAGE_SHIFT 22
34#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) 34#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K)
@@ -141,8 +141,7 @@ typedef unsigned long pgprot_t;
141#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 141#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
142 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 142 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
143 143
144#endif /* !(__KERNEL__) */
145
146#include <asm-generic/page.h> 144#include <asm-generic/page.h>
147 145
148#endif /* !(_SPARC64_PAGE_H) */ 146#endif /* __KERNEL__ */
147#endif /* _SPARC64_PAGE_H */
diff --git a/include/asm-sparc64/shmparam.h b/include/asm-sparc64/shmparam.h
index 8c66fded8a32..911d0427de6d 100644
--- a/include/asm-sparc64/shmparam.h
+++ b/include/asm-sparc64/shmparam.h
@@ -1,6 +1,7 @@
1/* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */ 1/* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */
2#ifndef _ASMSPARC64_SHMPARAM_H 2#ifndef _ASMSPARC64_SHMPARAM_H
3#define _ASMSPARC64_SHMPARAM_H 3#define _ASMSPARC64_SHMPARAM_H
4#ifdef __KERNEL__
4 5
5#include <asm/spitfire.h> 6#include <asm/spitfire.h>
6 7
@@ -8,4 +9,5 @@
8/* attach addr a multiple of this */ 9/* attach addr a multiple of this */
9#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE) 10#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE)
10 11
12#endif /* __KERNEL__ */
11#endif /* _ASMSPARC64_SHMPARAM_H */ 13#endif /* _ASMSPARC64_SHMPARAM_H */
diff --git a/include/asm-um/Kbuild b/include/asm-um/Kbuild
deleted file mode 100644
index c68e1680da01..000000000000
--- a/include/asm-um/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1include include/asm-generic/Kbuild.asm
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h
index ad03c46a1f92..d693ffb1364d 100644
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -14,6 +14,8 @@
14#ifndef __V850_PAGE_H__ 14#ifndef __V850_PAGE_H__
15#define __V850_PAGE_H__ 15#define __V850_PAGE_H__
16 16
17#ifdef __KERNEL__
18
17#include <asm/machdep.h> 19#include <asm/machdep.h>
18 20
19 21
@@ -32,7 +34,6 @@
32#endif 34#endif
33 35
34 36
35#ifdef __KERNEL__
36#ifndef __ASSEMBLY__ 37#ifndef __ASSEMBLY__
37 38
38#define STRICT_MM_TYPECHECKS 39#define STRICT_MM_TYPECHECKS
@@ -122,9 +123,9 @@ typedef unsigned long pgprot_t;
122#define __va(x) ((void *)__phys_to_virt ((unsigned long)(x))) 123#define __va(x) ((void *)__phys_to_virt ((unsigned long)(x)))
123 124
124 125
125#endif /* KERNEL */
126
127#include <asm-generic/memory_model.h> 126#include <asm-generic/memory_model.h>
128#include <asm-generic/page.h> 127#include <asm-generic/page.h>
129 128
129#endif /* KERNEL */
130
130#endif /* __V850_PAGE_H__ */ 131#endif /* __V850_PAGE_H__ */
diff --git a/include/asm-v850/param.h b/include/asm-v850/param.h
index 8d796e4bff52..3c65bd573782 100644
--- a/include/asm-v850/param.h
+++ b/include/asm-v850/param.h
@@ -14,8 +14,6 @@
14#ifndef __V850_PARAM_H__ 14#ifndef __V850_PARAM_H__
15#define __V850_PARAM_H__ 15#define __V850_PARAM_H__
16 16
17#include <asm/machdep.h> /* For HZ */
18
19#define EXEC_PAGESIZE 4096 17#define EXEC_PAGESIZE 4096
20 18
21#ifndef NOGROUP 19#ifndef NOGROUP
@@ -25,6 +23,8 @@
25#define MAXHOSTNAMELEN 64 /* max length of hostname */ 23#define MAXHOSTNAMELEN 64 /* max length of hostname */
26 24
27#ifdef __KERNEL__ 25#ifdef __KERNEL__
26#include <asm/machdep.h> /* For HZ */
27
28# define USER_HZ 100 28# define USER_HZ 100
29# define CLOCKS_PER_SEC USER_HZ 29# define CLOCKS_PER_SEC USER_HZ
30#endif 30#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 67383605f2e5..1df2ac30a4d2 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -141,7 +141,6 @@ header-y += snmp.h
141header-y += sockios.h 141header-y += sockios.h
142header-y += som.h 142header-y += som.h
143header-y += sound.h 143header-y += sound.h
144header-y += stddef.h
145header-y += synclink.h 144header-y += synclink.h
146header-y += telephony.h 145header-y += telephony.h
147header-y += termios.h 146header-y += termios.h
@@ -267,7 +266,6 @@ unifdef-y += netfilter_decnet.h
267unifdef-y += netfilter.h 266unifdef-y += netfilter.h
268unifdef-y += netfilter_ipv4.h 267unifdef-y += netfilter_ipv4.h
269unifdef-y += netfilter_ipv6.h 268unifdef-y += netfilter_ipv6.h
270unifdef-y += netfilter_logging.h
271unifdef-y += net.h 269unifdef-y += net.h
272unifdef-y += netlink.h 270unifdef-y += netlink.h
273unifdef-y += nfs3.h 271unifdef-y += nfs3.h
@@ -316,6 +314,7 @@ unifdef-y += sonet.h
316unifdef-y += sonypi.h 314unifdef-y += sonypi.h
317unifdef-y += soundcard.h 315unifdef-y += soundcard.h
318unifdef-y += stat.h 316unifdef-y += stat.h
317unifdef-y += stddef.h
319unifdef-y += sysctl.h 318unifdef-y += sysctl.h
320unifdef-y += tcp.h 319unifdef-y += tcp.h
321unifdef-y += time.h 320unifdef-y += time.h
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index b3a2cadf90f2..ea65dfb60cd8 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -10,11 +10,13 @@
10#define NULL ((void *)0) 10#define NULL ((void *)0)
11#endif 11#endif
12 12
13#ifdef __KERNEL__
13#undef offsetof 14#undef offsetof
14#ifdef __compiler_offsetof 15#ifdef __compiler_offsetof
15#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) 16#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
16#else 17#else
17#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 18#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
18#endif 19#endif
20#endif /* __KERNEL__ */
19 21
20#endif 22#endif
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 8c02d2df4278..cac8f21a3392 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -23,30 +23,30 @@ HDRSED := sed -e "s/ inline / __inline__ /g" \
23 23
24_dst := $(if $(dst),$(dst),$(obj)) 24_dst := $(if $(dst),$(dst),$(obj))
25 25
26.PHONY: __headersinst
27__headersinst:
28
29
30ifeq (,$(patsubst include/asm/%,,$(obj)/)) 26ifeq (,$(patsubst include/asm/%,,$(obj)/))
31# For producing the generated stuff in include/asm for biarch builds, include 27# For producing the generated stuff in include/asm for biarch builds, include
32# both sets of Kbuild files; we'll generate anything which is mentioned in 28# both sets of Kbuild files; we'll generate anything which is mentioned in
33# _either_ arch, and recurse into subdirectories which are mentioned in either 29# _either_ arch, and recurse into subdirectories which are mentioned in either
34# arch. Since some directories may exist in one but not the other, we must 30# arch. Since some directories may exist in one but not the other, we must
35# use '-include'. 31# use $(wildcard...).
36GENASM := 1 32GENASM := 1
37archasm := $(subst include/asm,asm-$(ARCH),$(obj)) 33archasm := $(subst include/asm,asm-$(ARCH),$(obj))
38altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj)) 34altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj))
39-include $(srctree)/include/$(archasm)/Kbuild 35KBUILDFILES := $(wildcard $(srctree)/include/$(archasm)/Kbuild $(srctree)/include/$(altarchasm)/Kbuild)
40-include $(srctree)/include/$(altarchasm)/Kbuild
41else 36else
42include $(srctree)/$(obj)/Kbuild 37KBUILDFILES := $(srctree)/$(obj)/Kbuild
43endif 38endif
44 39
45include scripts/Kbuild.include 40include $(KBUILDFILES)
41
42include scripts/Kbuild.include
46 43
47# If this is include/asm-$(ARCH) and there's no $(ALTARCH), then 44# If this is include/asm-$(ARCH) and there's no $(ALTARCH), then
48# override $(_dst) so that we install to include/asm directly. 45# override $(_dst) so that we install to include/asm directly.
49ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)) 46# Unless $(BIASMDIR) is set, in which case we're probably doing
47# a 'headers_install_all' build and we should keep the -$(ARCH)
48# in the directory name.
49ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR))
50 _dst := include/asm 50 _dst := include/asm
51endif 51endif
52 52
@@ -56,6 +56,23 @@ subdir-y := $(patsubst %/,%,$(filter %/, $(header-y)))
56header-y := $(filter-out %/, $(header-y)) 56header-y := $(filter-out %/, $(header-y))
57header-y := $(filter-out $(unifdef-y),$(header-y)) 57header-y := $(filter-out $(unifdef-y),$(header-y))
58 58
59# stamp files for header checks
60check-y := $(patsubst %,.check.%,$(header-y) $(unifdef-y) $(objhdr-y))
61
62# Work out what needs to be removed
63oldheaders := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/*.h))
64unwanted := $(filter-out $(header-y) $(unifdef-y) $(objhdr-y),$(oldheaders))
65
66oldcheckstamps := $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$(wildcard $(INSTALL_HDR_PATH)/$(_dst)/.check.*.h))
67unwanted += $(filter-out $(check-y),$(oldcheckstamps))
68
69# Prefix them all with full paths to $(INSTALL_HDR_PATH)
70header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
71unifdef-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(unifdef-y))
72objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
73check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
74
75
59ifdef ALTARCH 76ifdef ALTARCH
60ifeq ($(obj),include/asm-$(ARCH)) 77ifeq ($(obj),include/asm-$(ARCH))
61altarch-y := altarch-dir 78altarch-y := altarch-dir
@@ -67,43 +84,47 @@ export ALTARCH
67export ARCHDEF 84export ARCHDEF
68export ALTARCHDEF 85export ALTARCHDEF
69 86
70quiet_cmd_o_hdr_install = INSTALL $(_dst)/$@ 87quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
71 cmd_o_hdr_install = cp $(objtree)/$(obj)/$@ $(INSTALL_HDR_PATH)/$(_dst) 88 cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
89 $(INSTALL_HDR_PATH)/$(_dst)
72 90
73quiet_cmd_headers_install = INSTALL $(_dst)/$@ 91quiet_cmd_headers_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
74 cmd_headers_install = $(HDRSED) $(srctree)/$(obj)/$@ \ 92 cmd_headers_install = $(HDRSED) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
75 > $(INSTALL_HDR_PATH)/$(_dst)/$@ 93 > $@
76 94
77quiet_cmd_unifdef = UNIFDEF $(_dst)/$@ 95quiet_cmd_unifdef = UNIFDEF $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
78 cmd_unifdef = $(UNIFDEF) $(srctree)/$(obj)/$@ | $(HDRSED) \ 96 cmd_unifdef = $(UNIFDEF) $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(srctree)/$(obj)/%,$@) \
79 > $(INSTALL_HDR_PATH)/$(_dst)/$@ || : 97 | $(HDRSED) > $@ || :
80 98
81quiet_cmd_check = CHECK $(_dst)/$@ 99quiet_cmd_check = CHECK $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/.check.%,$(_dst)/%,$@)
82 cmd_check = $(srctree)/scripts/hdrcheck.sh \ 100 cmd_check = $(srctree)/scripts/hdrcheck.sh \
83 $(INSTALL_HDR_PATH)/include \ 101 $(INSTALL_HDR_PATH)/include $(subst /.check.,/,$@) $@
84 $(INSTALL_HDR_PATH)/$(_dst)/$@ 102
103quiet_cmd_remove = REMOVE $(_dst)/$@
104 cmd_remove = rm -f $(INSTALL_HDR_PATH)/$(_dst)/$@
85 105
86quiet_cmd_mkdir = MKDIR $@ 106quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
87 cmd_mkdir = mkdir -p $(INSTALL_HDR_PATH)/$@ 107 cmd_mkdir = mkdir -p $@
88 108
89quiet_cmd_gen = GEN $(_dst)/$@ 109quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
90 cmd_gen = \ 110 cmd_gen = \
91STUBDEF=__ASM_STUB_`echo $@ | tr a-z. A-Z_`; \ 111FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@) \
112STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z. A-Z_`; \
92(echo "/* File autogenerated by 'make headers_install' */" ; \ 113(echo "/* File autogenerated by 'make headers_install' */" ; \
93echo "\#ifndef $$STUBDEF" ; \ 114echo "\#ifndef $$STUBDEF" ; \
94echo "\#define $$STUBDEF" ; \ 115echo "\#define $$STUBDEF" ; \
95echo "\# if $(ARCHDEF)" ; \ 116echo "\# if $(ARCHDEF)" ; \
96if [ -r $(INSTALL_HDR_PATH)/include/$(archasm)/$@ ]; then \ 117if [ -r $(subst /$(_dst)/,/include/$(archasm)/,$@) ]; then \
97 echo "\# include <$(archasm)/$@>" ; \ 118 echo "\# include <$(archasm)/$$FNAME>" ; \
98else \ 119else \
99 echo "\# error $(archasm)/$@ does not exist in" \ 120 echo "\# error $(archasm)/$$FNAME does not exist in" \
100 "the $(ARCH) architecture" ; \ 121 "the $(ARCH) architecture" ; \
101fi ; \ 122fi ; \
102echo "\# elif $(ALTARCHDEF)" ; \ 123echo "\# elif $(ALTARCHDEF)" ; \
103if [ -r $(INSTALL_HDR_PATH)/include/$(altarchasm)/$@ ]; then \ 124if [ -r $(subst /$(_dst)/,/include/$(altarchasm)/,$@) ]; then \
104 echo "\# include <$(altarchasm)/$@>" ; \ 125 echo "\# include <$(altarchasm)/$$FNAME>" ; \
105else \ 126else \
106 echo "\# error $(altarchasm)/$@ does not exist in" \ 127 echo "\# error $(altarchasm)/$$FNAME does not exist in" \
107 "the $(ALTARCH) architecture" ; \ 128 "the $(ALTARCH) architecture" ; \
108fi ; \ 129fi ; \
109echo "\# else" ; \ 130echo "\# else" ; \
@@ -111,37 +132,49 @@ echo "\# warning This machine appears to be" \
111 "neither $(ARCH) nor $(ALTARCH)." ; \ 132 "neither $(ARCH) nor $(ALTARCH)." ; \
112echo "\# endif" ; \ 133echo "\# endif" ; \
113echo "\#endif /* $$STUBDEF */" ; \ 134echo "\#endif /* $$STUBDEF */" ; \
114) > $(INSTALL_HDR_PATH)/$(_dst)/$@ 135) > $@
115 136
116__headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y) 137.PHONY: __headersinst __headerscheck
117
118.PHONY: $(header-y) $(unifdef-y) $(subdir-y)
119 138
120ifdef HDRCHECK 139ifdef HDRCHECK
121# Rules for checking headers 140__headerscheck: $(subdir-y) $(check-y)
122$(objhdr-y) $(header-y) $(unifdef-y): 141 @true
142
143$(check-y) : $(INSTALL_HDR_PATH)/$(_dst)/.check.%.h : $(INSTALL_HDR_PATH)/$(_dst)/%.h
123 $(call cmd,check) 144 $(call cmd,check)
145
146# Other dependencies for $(check-y)
147-include /dev/null $(check-y)
148
149# ... but leave $(check-y) as .PHONY for now until those deps are actually correct.
150.PHONY: $(check-y)
151
124else 152else
125# Rules for installing headers 153# Rules for installing headers
154__headersinst: $(subdir-y) $(header-y) $(unifdef-y) $(altarch-y) $(objhdr-y)
155 @true
126 156
127$(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): $(_dst) 157$(objhdr-y) $(subdir-y) $(header-y) $(unifdef-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
128 158
129.PHONY: $(_dst) 159$(INSTALL_HDR_PATH)/$(_dst):
130$(_dst):
131 $(call cmd,mkdir) 160 $(call cmd,mkdir)
132 161
162.PHONY: $(unwanted)
163$(unwanted):
164 $(call cmd,remove)
165
133ifdef GENASM 166ifdef GENASM
134$(objhdr-y) $(header-y) $(unifdef-y): 167$(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES)
135 $(call cmd,gen) 168 $(call cmd,gen)
136 169
137else 170else
138$(objhdr-y): 171$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
139 $(call cmd,o_hdr_install) 172 $(call cmd,o_hdr_install)
140 173
141$(header-y): 174$(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
142 $(call cmd,headers_install) 175 $(call cmd,headers_install)
143 176
144$(unifdef-y): 177$(unifdef-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES)
145 $(call cmd,unifdef) 178 $(call cmd,unifdef)
146endif 179endif
147endif 180endif
@@ -153,8 +186,9 @@ hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
153# for their existence. 186# for their existence.
154altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y) 187altarch-dir: $(subdir-y) $(header-y) $(unifdef-y) $(objhdr-y)
155 $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH) 188 $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
156 $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm 189 $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR)
157 190
158# Recursion 191# Recursion
192.PHONY: $(subdir-y)
159$(subdir-y): 193$(subdir-y):
160 $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel) 194 $(Q)$(MAKE) $(hdrinst)=$(obj)/$@ dst=$(_dst)/$@ rel=../$(rel)
diff --git a/scripts/hdrcheck.sh b/scripts/hdrcheck.sh
index b5ca35aa1741..31598584f871 100755
--- a/scripts/hdrcheck.sh
+++ b/scripts/hdrcheck.sh
@@ -6,3 +6,5 @@ for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\
6 exit 1 6 exit 1
7 fi 7 fi
8done 8done
9# FIXME: List dependencies into $3
10touch $3