aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.headersinst84
1 files changed, 9 insertions, 75 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 22b17af0902f..1fb8c003920f 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -23,30 +23,17 @@ HDRSED := sed -e "s/ inline / __inline__ /g" \
23 23
24_dst := $(if $(dst),$(dst),$(obj)) 24_dst := $(if $(dst),$(dst),$(obj))
25 25
26ifeq (,$(patsubst include/asm/%,,$(obj)/)) 26kbuild-file := $(srctree)/$(obj)/Kbuild
27# For producing the generated stuff in include/asm for biarch builds, include 27include $(kbuild-file)
28# both sets of Kbuild files; we'll generate anything which is mentioned in
29# _either_ arch, and recurse into subdirectories which are mentioned in either
30# arch. Since some directories may exist in one but not the other, we must
31# use $(wildcard...).
32GENASM := 1
33archasm := $(subst include/asm,asm-$(ARCH),$(obj))
34altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj))
35KBUILDFILES := $(wildcard $(srctree)/include/$(archasm)/Kbuild $(srctree)/include/$(altarchasm)/Kbuild)
36else
37KBUILDFILES := $(srctree)/$(obj)/Kbuild
38endif
39 28
40include $(KBUILDFILES) 29include scripts/Kbuild.include
41 30
42include scripts/Kbuild.include 31# If this is include/asm-$(ARCH) then override $(_dst) so that
43 32# we install to include/asm directly.
44# If this is include/asm-$(ARCH) and there's no $(ALTARCH), then
45# override $(_dst) so that we install to include/asm directly.
46# Unless $(BIASMDIR) is set, in which case we're probably doing 33# Unless $(BIASMDIR) is set, in which case we're probably doing
47# a 'headers_install_all' build and we should keep the -$(ARCH) 34# a 'headers_install_all' build and we should keep the -$(ARCH)
48# in the directory name. 35# in the directory name.
49ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR)) 36ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR))
50 _dst := include/asm 37 _dst := include/asm
51endif 38endif
52 39
@@ -69,18 +56,6 @@ header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y))
69objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y)) 56objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y))
70check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y)) 57check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y))
71 58
72
73ifdef ALTARCH
74ifeq ($(obj),include/asm-$(ARCH))
75altarch-y := altarch-dir
76endif
77endif
78
79# Make the definitions visible for recursive make invocations
80export ALTARCH
81export ARCHDEF
82export ALTARCHDEF
83
84quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 59quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
85 cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \ 60 cmd_o_hdr_install = cp $(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,$(objtree)/$(obj)/%,$@) \
86 $(INSTALL_HDR_PATH)/$(_dst) 61 $(INSTALL_HDR_PATH)/$(_dst)
@@ -99,34 +74,6 @@ quiet_cmd_remove = REMOVE $(_dst)/$@
99quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 74quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
100 cmd_mkdir = mkdir -p $@ 75 cmd_mkdir = mkdir -p $@
101 76
102quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
103 cmd_gen = \
104FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@); \
105STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z.- A-Z__`; \
106(echo "/* File autogenerated by 'make headers_install' */" ; \
107echo "\#ifndef $$STUBDEF" ; \
108echo "\#define $$STUBDEF" ; \
109echo "\# if $(ARCHDEF)" ; \
110if [ -r $(subst /$(_dst)/,/include/$(archasm)/,$@) ]; then \
111 echo "\# include <$(archasm)/$$FNAME>" ; \
112else \
113 echo "\# error $(archasm)/$$FNAME does not exist in" \
114 "the $(ARCH) architecture" ; \
115fi ; \
116echo "\# elif $(ALTARCHDEF)" ; \
117if [ -r $(subst /$(_dst)/,/include/$(altarchasm)/,$@) ]; then \
118 echo "\# include <$(altarchasm)/$$FNAME>" ; \
119else \
120 echo "\# error $(altarchasm)/$$FNAME does not exist in" \
121 "the $(ALTARCH) architecture" ; \
122fi ; \
123echo "\# else" ; \
124echo "\# warning This machine appears to be" \
125 "neither $(ARCH) nor $(ALTARCH)." ; \
126echo "\# endif" ; \
127echo "\#endif /* $$STUBDEF */" ; \
128) > $@
129
130.PHONY: __headersinst __headerscheck 77.PHONY: __headersinst __headerscheck
131 78
132ifdef HDRCHECK 79ifdef HDRCHECK
@@ -144,7 +91,7 @@ include /dev/null $(wildcard $(check-y))
144 91
145else 92else
146# Rules for installing headers 93# Rules for installing headers
147__headersinst: $(subdir-y) $(header-y) $(altarch-y) $(objhdr-y) 94__headersinst: $(subdir-y) $(header-y) $(objhdr-y)
148 @true 95 @true
149 96
150$(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted) 97$(objhdr-y) $(subdir-y) $(header-y): | $(INSTALL_HDR_PATH)/$(_dst) $(unwanted)
@@ -156,29 +103,16 @@ $(INSTALL_HDR_PATH)/$(_dst):
156$(unwanted): 103$(unwanted):
157 $(call cmd,remove) 104 $(call cmd,remove)
158 105
159ifdef GENASM 106$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(kbuild-file)
160$(objhdr-y) $(header-y): $(KBUILDFILES)
161 $(call cmd,gen)
162
163else
164$(objhdr-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES)
165 $(call cmd,o_hdr_install) 107 $(call cmd,o_hdr_install)
166 108
167$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) 109$(header-y): $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(kbuild-file)
168 $(call cmd,unifdef) 110 $(call cmd,unifdef)
169 111
170endif 112endif
171endif
172 113
173hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj 114hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
174 115
175.PHONY: altarch-dir
176# All the files in the normal arch dir must be created first, since we test
177# for their existence.
178altarch-dir: $(subdir-y) $(header-y) $(objhdr-y)
179 $(Q)$(MAKE) $(hdrinst)=include/asm-$(ALTARCH) dst=include/asm-$(ALTARCH)
180 $(Q)$(MAKE) $(hdrinst)=include/asm dst=include/asm$(BIASMDIR)
181
182# Recursion 116# Recursion
183.PHONY: $(subdir-y) 117.PHONY: $(subdir-y)
184$(subdir-y): 118$(subdir-y):