]> git.hungrycats.org Git - linux/commitdiff
[PATCH] uml: make -j fix
authorPaolo \'Blaisorblade\' Giarrusso <blaisorblade_spam@yahoo.it>
Wed, 13 Oct 2004 14:30:22 +0000 (07:30 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 13 Oct 2004 14:30:22 +0000 (07:30 -0700)
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: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/Makefile
arch/um/Makefile-i386
arch/um/Makefile-skas
arch/um/Makefile-tt
arch/um/include/Makefile [deleted file]
arch/um/kernel/Makefile
arch/um/kernel/skas/Makefile
arch/um/kernel/skas/util/Makefile
arch/um/sys-i386/Makefile
arch/um/sys-i386/util/Makefile

index 1a26e5c959a38af711c7c3a839d071e99e46f0f7..2cc4346220ff4940c24e389f62720e1794b034d7 100644 (file)
@@ -8,8 +8,10 @@ OS := $(shell uname -s)
 #We require it or things break.
 SHELL := /bin/bash
 
-core-y                 += $(ARCH_DIR)/kernel/           \
-                          $(ARCH_DIR)/drivers/          \
+filechk_gen_header = $<
+
+core-y                 += $(ARCH_DIR)/kernel/          \
+                          $(ARCH_DIR)/drivers/         \
                           $(ARCH_DIR)/sys-$(SUBARCH)/
 
 # Have to precede the include because the included Makefiles reference them.
@@ -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
index 8bf654dbbb070ffa97927f910da2fea27a6d3bb7..9a6cf6e5b529f9f97f2ee6aa9b5b8af7642d7242 100644 (file)
@@ -1,12 +1,12 @@
 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)
index 32bf54abd002fc7d79be8e9ca993e74acec508b9..fb3050ff91d437094fb87efc99826bc02e53b026 100644 (file)
@@ -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
index 8d58a308319300a9862e0e21cfbda91794e9285f..eed367d9cdc50fcbabb6f24d98eb42b0bf4ecfc0 100644 (file)
@@ -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
diff --git a/arch/um/include/Makefile b/arch/um/include/Makefile
deleted file mode 100644 (file)
index cc5dad0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-all : sc.h
-
-sc.h : ../util/mk_sc
-       ../util/mk_sc > $@
-
-../util/mk_sc :
-       $(MAKE) -C ../util mk_sc
index fe9f301e1a313f3495add86e26102427725795db..9fa9711ec51e09a8309ddefbe801108710549f91 100644 (file)
@@ -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) < $< > $@
 
index bc53682e03333890b91cf9791eca3248935a636c..37d3f7e9790d7dbb5425efb75bc19884ec108c8d 100644 (file)
@@ -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 $@ $<
index 08e95a65ea1908839377da1ee596a70c38a2d5f2..4b8aa7f8b3e3db8e3487523b957e2e6de0c2c099 100644 (file)
@@ -1,9 +1,2 @@
-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)
index d489f4b4ee5a961684877221662e4808027fd02c..0f65a9259b0d70ce95bf262f7c97036f0c84c447 100644 (file)
@@ -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
index 5998287619e57cf255ece4025417a4e819561a56..34860f9ca7b0deafa3a41cd4dcdae247c1770521 100644 (file)
@@ -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