1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: [PATCH] kbuild: Properly handle arch/$arch/include/asm
5 Some architectures have moved include/asm-$arch to arch/$arch/include/asm,
6 but were still placing new files in include/asm-$arch. This causes build
7 problems with out-of-tree modules.
9 This patch properly handles the new locations.
11 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
13 Makefile | 24 ++++++++++++++++--------
14 arch/ia64/Makefile | 2 +-
15 arch/ia64/include/asm/irq.h | 2 +-
16 arch/ia64/kernel/Makefile | 6 +++---
17 4 files changed, 21 insertions(+), 13 deletions(-)
21 @@ -969,8 +969,10 @@ define check-symlink
23 if [ -L include/asm ]; then \
24 asmlink=`readlink include/asm | cut -d '-' -f 2`; \
25 - if [ "$$asmlink" != "$(SRCARCH)" ]; then \
26 - echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
27 + archlink=`readlink include/asm | cut -d '/' -f 3`; \
28 + if [ "$$asmlink" != "$(SRCARCH)" -a \
29 + "$$archlink" != "$(SRCARCH)" ]; then \
30 + echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) or ../arch/$(SRCARCH)/include/asm was expected"; \
31 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
34 @@ -981,12 +983,18 @@ endef
35 # not exist so the test in chack-symlink works and we have a
36 # directory for generated filesas used by some architectures.
38 - if [ ! -L include/asm ]; then \
39 - echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
40 - if [ ! -d include/asm-$(SRCARCH) ]; then \
41 - mkdir -p include/asm-$(SRCARCH); \
43 - ln -fsn asm-$(SRCARCH) $@; \
44 + if [ ! -L include/asm ]; then \
45 + if [ -d $(srctree)/arch/$(SRCARCH)/include/asm ]; then \
46 + echo ' SYMLINK $@ -> arch/$(SRCARCH)/include/asm'; \
47 + mkdir -p arch/$(SRCARCH)/include/asm; \
48 + ln -fsn ../arch/$(SRCARCH)/include/asm $@; \
50 + echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
51 + if [ ! -d include/asm-$(SRCARCH) ]; then \
52 + mkdir -p include/asm-$(SRCARCH); \
54 + ln -fsn asm-$(SRCARCH) $@; \
59 --- a/arch/ia64/Makefile
60 +++ b/arch/ia64/Makefile
61 @@ -105,4 +105,4 @@ archprepare: make_nr_irqs_h FORCE
62 PHONY += make_nr_irqs_h FORCE
65 - $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h
66 + $(Q)$(MAKE) $(build)=arch/ia64/kernel arch/ia64/include/asm/nr-irqs.h
67 --- a/arch/ia64/include/asm/irq.h
68 +++ b/arch/ia64/include/asm/irq.h
71 #include <linux/types.h>
72 #include <linux/cpumask.h>
73 -#include <asm-ia64/nr-irqs.h>
74 +#include <asm/nr-irqs.h>
77 irq_canonicalize (int irq)
78 --- a/arch/ia64/kernel/Makefile
79 +++ b/arch/ia64/kernel/Makefile
80 @@ -96,15 +96,15 @@ endef
82 # We use internal kbuild rules to avoid the "is up to date" message from make
83 arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c \
84 - $(wildcard $(srctree)/include/asm-ia64/*/irq.h)
85 + $(wildcard $(srctree)/arch/ia64/include/asm/*/irq.h)
86 $(Q)mkdir -p $(dir $@)
87 $(call if_changed_dep,cc_s_c)
89 -include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
90 +arch/ia64/include/asm/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
91 $(Q)mkdir -p $(dir $@)
94 -clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
95 +clean-files += $(objtree)/arch/ia64/include/asm/nr-irqs.h
98 # native ivt.S and entry.S