diff options
Diffstat (limited to 'scripts/Makefile.headersinst')
-rw-r--r-- | scripts/Makefile.headersinst | 84 |
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 | ||
26 | ifeq (,$(patsubst include/asm/%,,$(obj)/)) | 26 | kbuild-file := $(srctree)/$(obj)/Kbuild |
27 | # For producing the generated stuff in include/asm for biarch builds, include | 27 | include $(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...). | ||
32 | GENASM := 1 | ||
33 | archasm := $(subst include/asm,asm-$(ARCH),$(obj)) | ||
34 | altarchasm := $(subst include/asm,asm-$(ALTARCH),$(obj)) | ||
35 | KBUILDFILES := $(wildcard $(srctree)/include/$(archasm)/Kbuild $(srctree)/include/$(altarchasm)/Kbuild) | ||
36 | else | ||
37 | KBUILDFILES := $(srctree)/$(obj)/Kbuild | ||
38 | endif | ||
39 | 28 | ||
40 | include $(KBUILDFILES) | 29 | include scripts/Kbuild.include |
41 | 30 | ||
42 | include 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. |
49 | ifeq ($(obj)$(ALTARCH),include/asm-$(ARCH)$(BIASMDIR)) | 36 | ifeq ($(obj),include/asm-$(ARCH)$(BIASMDIR)) |
50 | _dst := include/asm | 37 | _dst := include/asm |
51 | endif | 38 | endif |
52 | 39 | ||
@@ -69,18 +56,6 @@ header-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(header-y)) | |||
69 | objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y)) | 56 | objhdr-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(objhdr-y)) |
70 | check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y)) | 57 | check-y := $(patsubst %,$(INSTALL_HDR_PATH)/$(_dst)/%,$(check-y)) |
71 | 58 | ||
72 | |||
73 | ifdef ALTARCH | ||
74 | ifeq ($(obj),include/asm-$(ARCH)) | ||
75 | altarch-y := altarch-dir | ||
76 | endif | ||
77 | endif | ||
78 | |||
79 | # Make the definitions visible for recursive make invocations | ||
80 | export ALTARCH | ||
81 | export ARCHDEF | ||
82 | export ALTARCHDEF | ||
83 | |||
84 | quiet_cmd_o_hdr_install = INSTALL $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | 59 | quiet_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)/$@ | |||
99 | quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | 74 | quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) |
100 | cmd_mkdir = mkdir -p $@ | 75 | cmd_mkdir = mkdir -p $@ |
101 | 76 | ||
102 | quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) | ||
103 | cmd_gen = \ | ||
104 | FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@); \ | ||
105 | STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z.- A-Z__`; \ | ||
106 | (echo "/* File autogenerated by 'make headers_install' */" ; \ | ||
107 | echo "\#ifndef $$STUBDEF" ; \ | ||
108 | echo "\#define $$STUBDEF" ; \ | ||
109 | echo "\# if $(ARCHDEF)" ; \ | ||
110 | if [ -r $(subst /$(_dst)/,/include/$(archasm)/,$@) ]; then \ | ||
111 | echo "\# include <$(archasm)/$$FNAME>" ; \ | ||
112 | else \ | ||
113 | echo "\# error $(archasm)/$$FNAME does not exist in" \ | ||
114 | "the $(ARCH) architecture" ; \ | ||
115 | fi ; \ | ||
116 | echo "\# elif $(ALTARCHDEF)" ; \ | ||
117 | if [ -r $(subst /$(_dst)/,/include/$(altarchasm)/,$@) ]; then \ | ||
118 | echo "\# include <$(altarchasm)/$$FNAME>" ; \ | ||
119 | else \ | ||
120 | echo "\# error $(altarchasm)/$$FNAME does not exist in" \ | ||
121 | "the $(ALTARCH) architecture" ; \ | ||
122 | fi ; \ | ||
123 | echo "\# else" ; \ | ||
124 | echo "\# warning This machine appears to be" \ | ||
125 | "neither $(ARCH) nor $(ALTARCH)." ; \ | ||
126 | echo "\# endif" ; \ | ||
127 | echo "\#endif /* $$STUBDEF */" ; \ | ||
128 | ) > $@ | ||
129 | |||
130 | .PHONY: __headersinst __headerscheck | 77 | .PHONY: __headersinst __headerscheck |
131 | 78 | ||
132 | ifdef HDRCHECK | 79 | ifdef HDRCHECK |
@@ -144,7 +91,7 @@ include /dev/null $(wildcard $(check-y)) | |||
144 | 91 | ||
145 | else | 92 | else |
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 | ||
159 | ifdef 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 | |||
163 | else | ||
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 | ||
170 | endif | 112 | endif |
171 | endif | ||
172 | 113 | ||
173 | hdrinst := -rR -f $(srctree)/scripts/Makefile.headersinst obj | 114 | hdrinst := -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. | ||
178 | altarch-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): |