Skip to contentSkip to conversation

kbuild: fix make -j4 on UP

PATCH In review Sam Ravnborg 1 participant 2 messages Mar 2, 2003 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: fix make -j4 on UP

When executing make -j4 on my UP machine kbuild failed. The culprint was that compile.h were generated twice:
1) Due to the newly added dependency when building modules
2) When descending down into the directories

The generation of compile.h were placed in init/, presumeably for historical reasons.
The following patch moves the generation of compile.h to the top-level makefile, and list it in the prepare rule. Hereby the generation of compile.h is done before descending down in the the directories.

Sam

===== Makefile 1.389 vs edited =====

Makefile +11 -6
@@ -400,7 +400,7 @@
 #	module versions are listed in "prepare"
 
 .PHONY: prepare
-prepare: include/linux/version.h include/asm include/config/MARKER
+prepare: include/linux/version.h include/linux/compile.h include/asm include/config/MARKER
 ifdef KBUILD_MODULES
 ifeq ($(origin SUBDIRS),file)
 	$(Q)rm -rf $(MODVERDIR)
@@ -484,6 +484,14 @@
 	) > [email protected]
 	@$(update-if-changed)
 
+# compile.h changes depending on hostname, generation number, etc,
+# so we regenerate it always.
+# mkcompile_h will make sure to only update the
+# actual file if its content has changed.
+include/linux/compile.h: FORCE
+	@echo -n '  GEN     $@'
+	@sh $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
+
 # ---------------------------------------------------------------------------
 
 .PHONY: depend dep
@@ -501,11 +509,8 @@
 
 #	Build modules
 
-include/linux/compile.h: FORCE
-	$(Q)$(MAKE) $(build)=init include/linux/compile.h
-
 .PHONY: modules
-modules: $(SUBDIRS) $(if $(KBUILD_BUILTIN),vmlinux) include/linux/compile.h
+modules: $(SUBDIRS) $(if $(KBUILD_BUILTIN),vmlinux)
 	@echo '  Building modules, stage 2.';
 	$(Q)$(MAKE) -rR -f scripts/Makefile.modpost
 
@@ -644,7 +649,7 @@
 # make distclean Remove editor backup files, patch leftover files and the like
 
 # Files removed with 'make clean'
-CLEAN_FILES += vmlinux System.map MC*
+CLEAN_FILES += vmlinux System.map include/linux/compile.h
 
 # Files removed with 'make mrproper'
 MRPROPER_FILES += \

===== init/Makefile 1.23 vs edited =====

init/Makefile +0 -16
@@ -6,19 +6,3 @@
 obj-$(CONFIG_DEVFS_FS)		+= do_mounts_devfs.o
 obj-$(CONFIG_BLK_DEV_RAM)	+= do_mounts_rd.o
 obj-$(CONFIG_BLK_DEV_MD)	+= do_mounts_md.o
-
-# files to be removed upon make clean
-clean-files := ../include/linux/compile.h
-
-# dependencies on generated files need to be listed explicitly
-
-$(obj)/version.o: include/linux/compile.h
-
-# compile.h changes depending on hostname, generation number, etc,
-# so we regenerate it always.
-# mkcompile_h will make sure to only update the
-# actual file if its content has changed.
-
-include/linux/compile.h: FORCE
-	@echo -n '  GEN     $@'
-	@sh $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
#1 lore raw
Quoted 2 lines · Sam Ravnborg

The following patch moves the generation of compile.h to the top-level makefile, and list it in the prepare rule.

Which has the side-effect that compile.h will be generated each time, because the version increases. And the kernel is recompiled. I will do a proper fix tomorrow.

Sam