Author: oxygene
Date: 2010-01-29 18:38:57 +0100 (Fri, 29 Jan 2010)
New Revision: 5062

Modified:
   trunk/Makefile
Log:
Make $(obj)/build.h an explicit dependency for all
object files, as it's dragged into the build by
-include $(obj)/build.h for pretty much everything.

Also, generate build.h atomically.

This fixes parallel build with kconfig on my box.

Signed-off-by: Patrick Georgi <[email protected]>
Acked-by: Ronald G. Minnich <[email protected]>


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile      2010-01-28 22:25:49 UTC (rev 5061)
+++ trunk/Makefile      2010-01-29 17:38:57 UTC (rev 5062)
@@ -140,7 +140,7 @@
 
 
 define c_dsl_template
-$(obj)/$(1)%.c: src/$(1)%.dsl
+$(obj)/$(1)%.c: src/$(1)%.dsl $(obj)/build.h
        @printf "    IASL       $$(subst $$(shell pwd)/,,$$(@))\n"
        iasl -p $$(basename $$@) -tc $$<
        perl -pi -e 's/AmlCode/AmlCode_$$(notdir $$(basename $$@))/g' 
$$(basename $$@).hex
@@ -148,31 +148,31 @@
 endef
 
 define objs_c_template
-$(obj)/$(1)%.o: src/$(1)%.c
+$(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
        $(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define objs_S_template
-$(obj)/$(1)%.o: src/$(1)%.S
+$(obj)/$(1)%.o: src/$(1)%.S $(obj)/build.h
        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
        $(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define initobjs_c_template
-$(obj)/$(1)%.o: src/$(1)%.c
+$(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
        $(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define initobjs_S_template
-$(obj)/$(1)%.o: src/$(1)%.S
+$(obj)/$(1)%.o: src/$(1)%.S $(obj)/build.h
        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
        $(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define drivers_c_template
-$(obj)/$(1)%.o: src/$(1)%.c
+$(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
        $(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
 endef
@@ -257,20 +257,24 @@
        mkdir -p $(obj)/util/kconfig/lxdialog
        test -n "$(alldirs)" && mkdir -p $(alldirs) || true
 
-prepare2:
+prepare2: $(obj)/build.h
+
+$(obj)/build.h:
        @printf "    GEN        build.h\n"
-       printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > 
$(obj)/build.h
-       printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" 
>> $(obj)/build.h
-       printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.h
-       printf "\n" >> $(obj)/build.h
-       printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | 
head -n1)\"\n" >> $(obj)/build.h
-       printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | 
head -n1)\"\n" >> $(obj)/build.h
-       printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head 
-n1)\"\n" >> $(obj)/build.h
-       printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> 
$(obj)/build.h
-       printf "#define COREBOOT_COMPILE_BY \"$(shell PATH=$$PATH:/usr/ucb 
whoami)\"\n" >> $(obj)/build.h
-       printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname)\"\n" >> 
$(obj)/build.h
-       printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = 
"Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.h
-       printf "#include \"config.h\"\n" >> $(obj)/build.h
+       rm -f $(obj)/build.h
+       printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > 
$(obj)/build.ht
+       printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" 
>> $(obj)/build.ht
+       printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
+       printf "\n" >> $(obj)/build.ht
+       printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | 
head -n1)\"\n" >> $(obj)/build.ht
+       printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | 
head -n1)\"\n" >> $(obj)/build.ht
+       printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head 
-n1)\"\n" >> $(obj)/build.ht
+       printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> 
$(obj)/build.ht
+       printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell 
PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
+       printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname)\"\n" >> 
$(obj)/build.ht
+       printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = 
"Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.ht
+       printf "#include \"config.h\"\n" >> $(obj)/build.ht
+       mv $(obj)/build.ht $(obj)/build.h
 
 doxy: doxygen
 doxygen:


-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to