Commit f356389e authored by Paolo \'Blaisorblade\' Giarrusso's avatar Paolo \'Blaisorblade\' Giarrusso Committed by Linus Torvalds

[PATCH] uml: make -j fix

Makes the UML build system work well even under parallel make (tested, so far,
even with -j50).  Please notice that it must be updated for every makefile
change.  Or better, every makefile change must use correct dependencies (and
they are easy to miss).
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f05b1c0b
......@@ -8,6 +8,8 @@ OS := $(shell uname -s)
#We require it or things break.
SHELL := /bin/bash
filechk_gen_header = $<
core-y += $(ARCH_DIR)/kernel/ \
$(ARCH_DIR)/drivers/ \
$(ARCH_DIR)/sys-$(SUBARCH)/
......@@ -29,11 +31,12 @@ ifneq ($(MAKEFILE-y),)
include $(addprefix $(ARCH_DIR)/,$(MAKEFILE-y))
endif
ARCH_INCLUDE := -I$(ARCH_DIR)/include
SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
include $(ARCH_DIR)/Makefile-$(SUBARCH)
include $(ARCH_DIR)/Makefile-os-$(OS)
ARCH_INCLUDE = -I$(ARCH_DIR)/include
# -Derrno=kernel_errno - This turns all kernel references to errno into
# kernel_errno to separate them from the libc errno. This allows -fno-common
# in CFLAGS. Otherwise, it would cause ld to complain about the two different
......@@ -56,7 +59,7 @@ CONFIG_KERNEL_HALF_GIGS ?= 0
SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
ifeq ($(CONFIG_MODE_SKAS), y)
$(SYS_HEADERS) : $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h
$(SYS_HEADERS) : $(ARCH_DIR)/include/skas_ptregs.h
endif
prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
......@@ -83,12 +86,6 @@ endif
endif
endif
#We need to re-preprocess this when the symlink dest changes.
#So we just touch it.
$(ARCH_DIR)/kernel/vmlinux.lds.S:
ln -sf $(LD_SCRIPT-y) $@
touch $@
CPP_MODE_TT := $(shell [ "$(CONFIG_MODE_TT)" = "y" ] && echo -DMODE_TT)
CONFIG_KERNEL_STACK_ORDER ?= 2
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
......@@ -120,9 +117,10 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
# To get a definition of F_SETSIG
USER_CFLAGS += -D_GNU_SOURCE
CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds \
$(ARCH_DIR)/dyn_link.ld.s $(ARCH_DIR)/include/uml-config.h \
$(GEN_HEADERS)
#When cleaning we don't include .config, so we don't include
#TT or skas makefiles and don't clean skas_ptregs.h.
CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
$(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h
MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
$(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS))
......@@ -131,42 +129,60 @@ archmrproper:
@:
archclean:
$(Q)$(MAKE) $(clean)=$(ARCH_DIR)/util
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
-o -name '*.gcov' \) -type f -print | xargs rm -f
#We need to re-preprocess this when the symlink dest changes.
#So we touch it.
$(ARCH_DIR)/kernel/vmlinux.lds.S: FORCE
@echo ' SYMLINK $@'
$(Q)ln -sf $(LD_SCRIPT-y) $@
$(Q)touch $@
$(SYMLINK_HEADERS):
cd $(TOPDIR)/$(dir $@) ; \
@echo ' SYMLINK $@'
$(Q)cd $(TOPDIR)/$(dir $@) ; \
ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
include/asm-um/arch:
cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
@echo ' SYMLINK $@'
$(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
$(ARCH_DIR)/include/sysdep:
cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep
@echo ' SYMLINK $@'
$(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep
$(ARCH_DIR)/os:
cd $(ARCH_DIR) && ln -sf os-$(OS) os
@echo ' SYMLINK $@'
$(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os
# Generated files
define filechk_umlconfig
sed 's/ CONFIG/ UML_CONFIG/'
endef
$(ARCH_DIR)/include/uml-config.h : $(TOPDIR)/include/linux/autoconf.h
$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
$(call filechk,umlconfig)
filechk_gen_header = $<
$(ARCH_DIR)/include/task.h: $(ARCH_DIR)/util/mk_task
$(call filechk,gen_header)
$(ARCH_DIR)/include/task.h : $(ARCH_DIR)/util/mk_task
$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/util/mk_constants
$(call filechk,gen_header)
$(ARCH_DIR)/include/kern_constants.h : $(ARCH_DIR)/util/mk_constants
$(ARCH_DIR)/include/skas_ptregs.h: $(ARCH_DIR)/kernel/skas/util/mk_ptregs
$(call filechk,gen_header)
$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants : $(ARCH_DIR)/util \
$(ARCH_DIR)/util/mk_task $(ARCH_DIR)/util/mk_constants: $(ARCH_DIR)/util \
FORCE ;
$(ARCH_DIR)/util: $(SYS_DIR)/sc.h FORCE
$(ARCH_DIR)/kernel/skas/util/mk_ptregs: $(ARCH_DIR)/kernel/skas/util FORCE ;
$(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h FORCE
$(Q)$(MAKE) $(build)=$@
$(ARCH_DIR)/kernel/skas/util: scripts_basic FORCE
$(Q)$(MAKE) $(build)=$@
export SUBARCH USER_CFLAGS OS
ifeq ($(CONFIG_HOST_2G_2G), y)
TOP_ADDR = 0x80000000
TOP_ADDR := 0x80000000
else
TOP_ADDR = 0xc0000000
TOP_ADDR := 0xc0000000
endif
ifeq ($(CONFIG_MODE_SKAS),y)
ifneq ($(CONFIG_MODE_TT),y)
START = 0x8048000
START := 0x8048000
endif
endif
......@@ -16,35 +16,30 @@ ifneq ($(CONFIG_GPROF),y)
ARCH_CFLAGS += -DUM_FASTCALL
endif
ELF_ARCH = $(SUBARCH)
ELF_FORMAT = elf32-$(SUBARCH)
ELF_ARCH := $(SUBARCH)
ELF_FORMAT := elf32-$(SUBARCH)
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
SYS_DIR := $(ARCH_DIR)/include/sysdep-i386
SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
prepare: $(SYS_HEADERS)
filechk_$(SYS_DIR)/sc.h := $(SYS_UTIL_DIR)/mk_sc
$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc
$(call filechk,$@)
filechk_$(SYS_DIR)/thread.h := $(SYS_UTIL_DIR)/mk_thread
$(call filechk,gen_header)
$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
$(call filechk,$@)
$(call filechk,gen_header)
$(SYS_UTIL_DIR)/mk_sc: scripts/basic/fixdep include/config/MARKER FORCE
$(SYS_UTIL_DIR)/mk_sc: scripts_basic FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR)/mk_thread: $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE
$(SYS_UTIL_DIR)/mk_thread: scripts_basic $(ARCH_SYMLINKS) $(GEN_HEADERS) FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR) $@
$(SYS_UTIL_DIR): include/asm FORCE
$(SYS_UTIL_DIR): scripts_basic include/asm FORCE
$(Q)$(MAKE) $(build)=$(SYS_UTIL_DIR)
CLEAN_FILES += $(SYS_HEADERS)
......@@ -9,12 +9,9 @@ CFLAGS-$(CONFIG_GCOV) += -fprofile-arcs -ftest-coverage
CFLAGS-$(CONFIG_GPROF) += $(PROFILE)
LINK-$(CONFIG_GPROF) += $(PROFILE)
MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/skas/include
MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/kernel/skas/include
LINK_SKAS = -Wl,-rpath,/lib
LD_SCRIPT_SKAS = dyn.lds.S
GEN_HEADERS += $(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h
$(TOPDIR)/$(ARCH_DIR)/include/skas_ptregs.h :
$(Q)$(MAKE) $(build)=$(ARCH_DIR)/kernel/skas $@
GEN_HEADERS += $(ARCH_DIR)/include/skas_ptregs.h
......@@ -3,5 +3,4 @@
# Licensed under the GPL
#
MODE_INCLUDE += -I$(TOPDIR)/$(ARCH_DIR)/kernel/tt/include
MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/kernel/tt/include
all : sc.h
sc.h : ../util/mk_sc
../util/mk_sc > $@
../util/mk_sc :
$(MAKE) -C ../util mk_sc
......@@ -4,11 +4,7 @@
#
extra-y := vmlinux.lds
# Descend into ../util for make clean. This is here because it doesn't work
# in arch/um/Makefile.
subdir- = ../util
clean-files := vmlinux.lds.S
obj-y = checksum.o config.o exec_kern.o exitcode.o frame_kern.o frame.o \
helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \
......@@ -29,24 +25,16 @@ obj-$(CONFIG_MODE_SKAS) += skas/
user-objs-$(CONFIG_TTY_LOG) += tty_log.o
USER_OBJS := $(filter %_user.o,$(obj-y)) $(user-objs-y) config.o helper.o \
main.o process.o tempfile.o time.o tty_log.o umid.o user_util.o
main.o process.o tempfile.o time.o tty_log.o umid.o user_util.o frame.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS))
# This has to be separate because it needs be compiled with frame pointers
# regardless of how the rest of the kernel is built.
$(obj)/frame.o: $(src)/frame.c
$(CC) $(CFLAGS_$(notdir $@)) -c -o $@ $<
CFLAGS_frame.o := -fno-omit-frame-pointer
$(USER_OBJS) : %.o: %.c
$(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
$(CC) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -c -o $@ $<
QUOTE = 'my $$config=`cat $(TOPDIR)/.config`; $$config =~ s/"/\\"/g ; $$config =~ s/\n/\\n"\n"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }'
$(obj)/config.o : $(obj)/config.c
quiet_cmd_quote = QUOTE $@
cmd_quote = $(PERL) -e $(QUOTE) < $< > $@
......
......@@ -3,26 +3,14 @@
# Licensed under the GPL
#
obj-y = exec_kern.o exec_user.o mem.o mem_user.o mmu.o process.o \
obj-y := exec_kern.o exec_user.o mem.o mem_user.o mmu.o process.o \
process_kern.o syscall_kern.o syscall_user.o time.o tlb.o trap_user.o \
uaccess.o sys-$(SUBARCH)/
hostprogs-y := util/mk_ptregs
clean-files := include/skas_ptregs.h
subdir-y := util
USER_OBJS = $(filter %_user.o,$(obj-y)) process.o time.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
$(TOPDIR)/arch/um/include/skas_ptregs.h : $(src)/util/mk_ptregs
@echo -n ' Generating $@'
@$< > $@.tmp
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
echo ' (unchanged)'; \
rm -f $@.tmp; \
else \
echo ' (updated)'; \
mv -f $@.tmp $@; \
fi
$(USER_OBJS) : %.o: %.c
$(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
all: mk_ptregs
mk_ptregs : mk_ptregs.o
$(HOSTCC) -o mk_ptregs mk_ptregs.o
mk_ptregs.o : mk_ptregs.c
$(HOSTCC) -c $<
clean-files := mk_ptregs *.o *~
host-progs := mk_ptregs
always := $(host-progs)
......@@ -8,10 +8,13 @@ USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
SYMLINKS = bitops.c semaphore.c highmem.c module.c
SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f)
# this needs to be before the foreach, because clean-files does not accept
# complete paths like $(src)/$f.
clean-files := $(SYMLINKS)
SYMLINKS := $(foreach f,$(SYMLINKS),$(src)/$f)
bitops.c-dir = lib
semaphore.c-dir = kernel
highmem.c-dir = mm
......
......@@ -6,8 +6,3 @@ mk_thread-objs := mk_thread_kern.o mk_thread_user.o
HOSTCFLAGS_mk_thread_kern.o := $(CFLAGS) $(CPPFLAGS)
HOSTCFLAGS_mk_thread_user.o := $(USER_CFLAGS)
clean :
$(RM) -f $(build-targets)
archmrproper : clean
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment