Patchwork build.h handling, take 2

login
register
about
Submitter Stefan Reinauer
Date 2010-03-28 21:47:46
Message ID <4BAFCE82.2050401@coresystems.de>
Download mbox | patch
Permalink /patch/1170/
State Accepted
Headers show

Comments

Stefan Reinauer - 2010-03-28 21:47:46
Does this patch make sense?
Patrick Georgi - 2010-03-29 09:15:28
Am 28.03.2010 23:47, schrieb Stefan Reinauer:
> Does this patch make sense?
Yes, I messed up that bit while trying to make things work with romcc
until we fix the -include issue.

Is it possible to include build.h where it is needed instead of passing
it in with -include? That might be a better workaround than the abspath
hack.

But for now, this is good, so
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>

Patch

Index: src/lib/Makefile.inc
===================================================================
--- src/lib/Makefile.inc	(revision 5306)
+++ src/lib/Makefile.inc	(working copy)
@@ -29,3 +29,5 @@ 
 obj-$(CONFIG_BOOTSPLASH) += jpeg.o
 
 smmobj-y += memcpy.o
+
+$(obj)/lib/version.o :: $(obj)/build.h
Index: src/arch/i386/Makefile.bootblock.inc
===================================================================
--- src/arch/i386/Makefile.bootblock.inc	(revision 5306)
+++ src/arch/i386/Makefile.bootblock.inc	(working copy)
@@ -42,9 +42,9 @@ 
 bootblock_inc += $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc
 bootblock_inc += $(src)/arch/i386/lib/walkcbfs.S
 
-bootblock_romccflags := -mcpu=i386 -O2
+bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__
 ifeq ($(CONFIG_SSE),y)
-bootblock_romccflags := -mcpu=k7 -msse -O2
+bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__
 endif
 
 $(obj)/bootblock/ldscript.ld: $$(bootblock_lds) $(obj)/ldoptions
Index: src/arch/i386/Makefile.inc
===================================================================
--- src/arch/i386/Makefile.inc	(revision 5306)
+++ src/arch/i386/Makefile.inc	(working copy)
@@ -193,8 +193,7 @@ 
 
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h
 	printf "    ROMCC      romstage.inc\n"
-	$(ROMCC) -c -S $(ROMCCFLAGS) -I. $(INCLUDES) $< -o $@
-
+	$(ROMCC) -c -S $(ROMCCFLAGS) -D__PRE_RAM__ -include $(abspath $(obj)/build.h) -I. $(INCLUDES) $< -o $@
 else
 
 $(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o: $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c $(obj)/option_table.h
@@ -203,7 +202,7 @@ 
 
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
 	printf "    CC         romstage.inc\n"
-	$(CC) -MMD $(CFLAGS) -I$(src) -I. -c -S $< -o $@
+	$(CC) -MMD $(CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o $@
 
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc
 	printf "    POST       romstage.inc\n"
Index: src/arch/i386/lib/Makefile.inc
===================================================================
--- src/arch/i386/lib/Makefile.inc	(revision 5306)
+++ src/arch/i386/lib/Makefile.inc	(working copy)
@@ -8,3 +8,5 @@ 
 
 initobj-y += printk_init.o
 initobj-y += cbfs_and_run.o
+
+$(obj)/arch/i386/lib/console.o :: $(obj)/build.h
Index: Makefile
===================================================================
--- Makefile	(revision 5305)
+++ Makefile	(working copy)
@@ -222,7 +222,7 @@ 
 # $3 .o infix ("" ".initobj", ...)
 # $4 additional compiler flags
 de$(EMPTY)fine $(1)_$(2)_template
-$(obj)/$$(1)%$(3).o: src/$$(1)%.$(2) | $(obj)/build.h $(obj)/config.h
+$(obj)/$$(1)%$(3).o: src/$$(1)%.$(2) $(obj)/config.h
 	printf "    CC         $$$$(subst $$$$(obj)/,,$$$$(@))\n"
 	$(CC) $(4) -MMD $$$$(CFLAGS) -c -o $$$$@ $$$$<
 en$(EMPTY)def
@@ -230,8 +230,8 @@ 
 
 $(eval $(call create_cc_template,objs,c))
 $(eval $(call create_cc_template,objs,S,,-DASSEMBLY))
-$(eval $(call create_cc_template,initobjs,c,.initobj))
-$(eval $(call create_cc_template,initobjs,S,.initobj,-DASSEMBLY))
+$(eval $(call create_cc_template,initobjs,c,.initobj,-D__PRE_RAM__))
+$(eval $(call create_cc_template,initobjs,S,.initobj,-DASSEMBLY -D__PRE_RAM__))
 $(eval $(call create_cc_template,drivers,c,.driver))
 $(eval $(call create_cc_template,drivers,S,.driver,-DASSEMBLY))
 $(eval $(call create_cc_template,smmobjs,c,.smmobj))
@@ -269,7 +269,7 @@ 
 INCLUDES := -Isrc -Isrc/include -I$(obj) -Isrc/arch/$(ARCHDIR-y)/include 
 INCLUDES += -Isrc/devices/oprom/include
 # abspath is a workaround for romcc
-INCLUDES += -include $(abspath $(obj)/config.h) -include $(abspath $(obj)/build.h)
+INCLUDES += -include $(abspath $(obj)/config.h)
 
 CFLAGS = $(INCLUDES) -Os -nostdinc -pipe
 CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes