Patchwork separate build.h and config.h

login
register
about
Submitter Stefan Reinauer
Date 2010-02-10 15:35:49
Message ID <4B72D255.3050401@coresystems.de>
Download mbox | patch
Permalink /patch/900/
State Accepted
Headers show

Comments

Stefan Reinauer - 2010-02-10 15:35:49
On 2/10/10 4:29 PM, Stefan Reinauer wrote:
> See patch
>
>   
Some part was missing. New version.
Patrick Georgi - 2010-02-10 18:15:44
Am 10.02.2010 16:35, schrieb Stefan Reinauer:
> On 2/10/10 4:29 PM, Stefan Reinauer wrote:
>> See patch
> Some part was missing. New version.
Can't we also get rid of the various explicit dependencies on build.h
with that?

Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
Peter Stuge - 2010-02-11 00:55:05
Patrick Georgi wrote:
> Can't we also get rid of the various explicit dependencies on
> build.h with that?

I'd love to get rid of it completely.. Will look into that.


//Peter
Stefan Reinauer - 2010-02-11 03:29:35
On 2/11/10 1:55 AM, Peter Stuge wrote:
> Patrick Georgi wrote:
>   
>> Can't we also get rid of the various explicit dependencies on
>> build.h with that?
>>     
> I'd love to get rid of it completely.. Will look into that.
>   
I checked in a partly improvement now... I would generally be nice to
have "real" dependencies
(i.e. something generated by gcc -MD) Not sure how feasible this would
be, but it would solve our trouble once and for good.

Stefan

Patch

Index: src/lib/version.c
===================================================================
--- src/lib/version.c	(revision 5105)
+++ src/lib/version.c	(working copy)
@@ -1,4 +1,5 @@ 
 #include <version.h>
+#include <build.h>
 
 #ifndef CONFIG_MAINBOARD_VENDOR
 #error CONFIG_MAINBOARD_VENDOR not defined
Index: src/arch/i386/Makefile.inc
===================================================================
--- src/arch/i386/Makefile.inc	(revision 5105)
+++ src/arch/i386/Makefile.inc	(working copy)
@@ -79,11 +79,11 @@ 
 	$(obj)/romcc $(ROMCCFLAGS) --label-prefix=failover $(INCLUDES) $(src)/arch/i386/lib/failover.c -o $@
 
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h
-	$(obj)/romcc $(ROMCCFLAGS) $(INCLUDES) $< -o $@
+	$(obj)/romcc -include $(obj)/build.h $(ROMCCFLAGS) $(INCLUDES) $< -o $@
 
 else
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
-	$(CC) $(DISTRO_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -I$(src) -I. -c -S $< -o $@
+	$(CC) $(DISTRO_CFLAGS) -include $(obj)/build.h $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -I$(src) -I. -c -S $< -o $@
 	perl -e 's/\.rodata/.rom.data/g' -pi $@
 	perl -e 's/\.text/.section .rom.text/g' -pi $@
 endif
Index: Makefile
===================================================================
--- Makefile	(revision 5105)
+++ Makefile	(working copy)
@@ -219,7 +219,7 @@ 
 INCLUDES := -I$(top)/src -I$(top)/src/include -I$(obj) -I$(top)/src/arch/$(ARCHDIR-y)/include 
 INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
 INCLUDES += -I$(top)/util/x86emu/include
-INCLUDES += -include $(obj)/build.h
+INCLUDES += -include $(obj)/config.h
 
 try-run= $(shell set -e; \
 TMP=".$$$$.tmp"; \
@@ -262,7 +262,10 @@ 
 $(obj)/build.h:
 	@printf "    GEN        build.h\n"
 	rm -f $(obj)/build.h
-	printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > $(obj)/build.ht
+	printf "/* build system definitions (autogenerated) */\n" > $(obj)/build.ht
+	printf "#ifndef __BUILD_H\n" >> $(obj)/build.ht
+	printf "#define __BUILD_H\n\n" >> $(obj)/build.ht
+	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
@@ -273,7 +276,7 @@ 
 	printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
 	printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s)\"\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
+	printf "#endif\n" >> $(obj)/build.ht
 	mv $(obj)/build.ht $(obj)/build.h
 
 doxy: doxygen