aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/Makefile')
-rw-r--r--arch/um/Makefile80
1 files changed, 59 insertions, 21 deletions
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 97bca6b5ca95..f2a0c40a9204 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -17,7 +17,7 @@ core-y += $(ARCH_DIR)/kernel/ \
17 17
18# Have to precede the include because the included Makefiles reference them. 18# Have to precede the include because the included Makefiles reference them.
19SYMLINK_HEADERS := archparam.h system.h sigcontext.h processor.h ptrace.h \ 19SYMLINK_HEADERS := archparam.h system.h sigcontext.h processor.h ptrace.h \
20 arch-signal.h module.h vm-flags.h 20 module.h vm-flags.h elf.h
21SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header)) 21SYMLINK_HEADERS := $(foreach header,$(SYMLINK_HEADERS),include/asm-um/$(header))
22 22
23# XXX: The "os" symlink is only used by arch/um/include/os.h, which includes 23# XXX: The "os" symlink is only used by arch/um/include/os.h, which includes
@@ -44,6 +44,11 @@ ifneq ($(MAKEFILES-INCL),)
44endif 44endif
45 45
46ARCH_INCLUDE := -I$(ARCH_DIR)/include 46ARCH_INCLUDE := -I$(ARCH_DIR)/include
47ifneq ($(KBUILD_SRC),)
48ARCH_INCLUDE += -I$(ARCH_DIR)/include2
49ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include
50MRPROPER_DIRS += $(ARCH_DIR)/include2
51endif
47SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH) 52SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
48 53
49include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) 54include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH)
@@ -94,17 +99,18 @@ define archhelp
94 echo ' find in the kernel root.' 99 echo ' find in the kernel root.'
95endef 100endef
96 101
102ifneq ($(KBUILD_SRC),)
103$(shell mkdir -p $(ARCH_DIR) && ln -fsn $(srctree)/$(ARCH_DIR)/Kconfig_$(SUBARCH) $(ARCH_DIR)/Kconfig_arch)
104CLEAN_FILES += $(ARCH_DIR)/Kconfig_arch
105else
97$(shell cd $(ARCH_DIR) && ln -sf Kconfig_$(SUBARCH) Kconfig_arch) 106$(shell cd $(ARCH_DIR) && ln -sf Kconfig_$(SUBARCH) Kconfig_arch)
107endif
98 108
99prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \ 109prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
100 $(ARCH_DIR)/kernel/vmlinux.lds.S
101 110
102LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static 111LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
103LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib 112LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
104 113
105LD_SCRIPT-$(CONFIG_LD_SCRIPT_STATIC) := uml.lds.S
106LD_SCRIPT-$(CONFIG_LD_SCRIPT_DYN) := dyn.lds.S
107
108CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT 114CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT
109CONFIG_KERNEL_STACK_ORDER ?= 2 115CONFIG_KERNEL_STACK_ORDER ?= 2
110STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) 116STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
@@ -126,7 +132,7 @@ define cmd_vmlinux__
126 $(CC) $(CFLAGS_vmlinux) -o $@ \ 132 $(CC) $(CFLAGS_vmlinux) -o $@ \
127 -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \ 133 -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \
128 -Wl,--start-group $(vmlinux-main) -Wl,--end-group \ 134 -Wl,--start-group $(vmlinux-main) -Wl,--end-group \
129 -L/usr/lib -lutil \ 135 -lutil \
130 $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) \ 136 $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) \
131 FORCE ,$^) ; rm -f linux 137 FORCE ,$^) ; rm -f linux
132endef 138endef
@@ -145,31 +151,42 @@ archclean:
145 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ 151 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
146 -o -name '*.gcov' \) -type f -print | xargs rm -f 152 -o -name '*.gcov' \) -type f -print | xargs rm -f
147 153
148#We need to re-preprocess this when the symlink dest changes.
149#So we touch it when needed.
150$(ARCH_DIR)/kernel/vmlinux.lds.S: FORCE
151 $(Q)if [ "$(shell readlink $@)" != "$(LD_SCRIPT-y)" ]; then \
152 echo ' SYMLINK $@'; \
153 ln -sf $(LD_SCRIPT-y) $@; \
154 touch $@; \
155 fi;
156
157$(SYMLINK_HEADERS): 154$(SYMLINK_HEADERS):
158 @echo ' SYMLINK $@' 155 @echo ' SYMLINK $@'
156ifneq ($(KBUILD_SRC),)
157 ln -fsn $(srctree)/include/asm-um/$(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $@
158else
159 $(Q)cd $(TOPDIR)/$(dir $@) ; \ 159 $(Q)cd $(TOPDIR)/$(dir $@) ; \
160 ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@) 160 ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
161endif
161 162
162include/asm-um/arch: 163include/asm-um/arch:
163 @echo ' SYMLINK $@' 164 @echo ' SYMLINK $@'
165ifneq ($(KBUILD_SRC),)
166 $(Q)mkdir -p include/asm-um
167 $(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch
168else
164 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch 169 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
170endif
165 171
166$(ARCH_DIR)/include/sysdep: 172$(ARCH_DIR)/include/sysdep:
167 @echo ' SYMLINK $@' 173 @echo ' SYMLINK $@'
174ifneq ($(KBUILD_SRC),)
175 $(Q)mkdir -p $(ARCH_DIR)/include
176 $(Q)mkdir -p $(ARCH_DIR)/include2
177 $(Q)ln -fsn sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep
178 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include2/sysdep
179else
168 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep 180 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep
181endif
169 182
170$(ARCH_DIR)/os: 183$(ARCH_DIR)/os:
171 @echo ' SYMLINK $@' 184 @echo ' SYMLINK $@'
185ifneq ($(KBUILD_SRC),)
186 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os
187else
172 $(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os 188 $(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os
189endif
173 190
174# Generated files 191# Generated files
175define filechk_umlconfig 192define filechk_umlconfig
@@ -179,10 +196,31 @@ endef
179$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h 196$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
180 $(call filechk,umlconfig) 197 $(call filechk,umlconfig)
181 198
199$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c
200 $(CC) $(USER_CFLAGS) -S -o $@ $<
201
202$(ARCH_DIR)/user-offsets.h: $(ARCH_DIR)/user-offsets.s
203 $(call filechk,gen-asm-offsets)
204
205CLEAN_FILES += $(ARCH_DIR)/user-offsets.s $(ARCH_DIR)/user-offsets.h
206
207$(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \
208 $(ARCH_SYMLINKS) \
209 $(SYS_DIR)/sc.h \
210 include/asm include/linux/version.h \
211 include/config/MARKER \
212 $(ARCH_DIR)/include/user_constants.h
213 $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $<
214
215$(ARCH_DIR)/kernel-offsets.h: $(ARCH_DIR)/kernel-offsets.s
216 $(call filechk,gen-asm-offsets)
217
218CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s $(ARCH_DIR)/kernel-offsets.h
219
182$(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task 220$(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task
183 $(call filechk,gen_header) 221 $(call filechk,gen_header)
184 222
185$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/os/util/mk_user_constants 223$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/os-$(OS)/util/mk_user_constants
186 $(call filechk,gen_header) 224 $(call filechk,gen_header)
187 225
188$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants 226$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants
@@ -191,20 +229,20 @@ $(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants
191$(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs 229$(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs
192 $(call filechk,gen_header) 230 $(call filechk,gen_header)
193 231
194$(ARCH_DIR)/os/util/mk_user_constants: $(ARCH_DIR)/os/util FORCE ; 232$(ARCH_DIR)/os-$(OS)/util/mk_user_constants: $(ARCH_DIR)/os-$(OS)/util FORCE ;
195 233
196$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/util \ 234$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/include/user_constants.h $(ARCH_DIR)/util \
197 FORCE ; 235 FORCE ;
198 236
199$(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ; 237$(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ;
200 238
201$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h FORCE 239$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h $(ARCH_DIR)/kernel-offsets.h FORCE
202 $(Q)$(MAKE) $(build)=$@ 240 $(Q)$(MAKE) $(build)=$@
203 241
204$(ARCH_DIR)/kernel/skas/util: scripts_basic FORCE 242$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
205 $(Q)$(MAKE) $(build)=$@ 243 $(Q)$(MAKE) $(build)=$@
206 244
207$(ARCH_DIR)/os/util: scripts_basic FORCE 245$(ARCH_DIR)/os-$(OS)/util: scripts_basic FORCE
208 $(Q)$(MAKE) $(build)=$@ 246 $(Q)$(MAKE) $(build)=$@
209 247
210export SUBARCH USER_CFLAGS OS 248export SUBARCH USER_CFLAGS OS