1 ## This is Architecture independant part of the makefile
4 uses CONFIG_AP_CODE_IN_CAR
6 makedefine CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E
7 makedefine LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name)
8 makedefine GCC_INC_DIR := $(shell LC_ALL=C $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
10 makedefine CPPFLAGS := -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS)
11 makedefine CFLAGS := $(CPU_OPT) $(DISTRO_CFLAGS) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin -Wall
13 makedefine HOSTCFLAGS:= -Os -Wall
16 depends "ldoptions $(LDSUBSCRIPTS-1)"
17 action "echo '/*ldoptions*/' > $@; cat ldoptions >> $@ ; for file in $(LDSUBSCRIPTS-1) ; do echo /\* $$file \*/ >> $@; cat $$file >> $@ ; done"
21 # depends "Makefile.settings"
22 # action "perl -e 'print \"CPUFLAGS :=\n\"; foreach $$var (split(\" \", $$ENV{VARIABLES})) { if (exists($$ENV{$$var})) { print \"CPUFLAGS += -D$$var\" . (length($$ENV{$$var})?\"=\x27$$ENV{$$var}\x27\":\"\") .\"\n\"} else { print \"CPUFLAGS += -U$$var\n\"} }' > $@"
26 # depends "Makefile.settings"
27 # action "perl -e 'foreach $$var (split(\" \", $$ENV{VARIABLES})) { if ($$ENV{$$var} =~ m/^(0x[0-9a-fA-F]+|0[0-7]+|[0-9]+)$$/) { print \"$$var = $$ENV{$$var};\n\"; }}' > $@"
30 makerule coreboot.strip
32 action "$(OBJCOPY) -O binary coreboot coreboot.strip"
37 action "rm -f coreboot.a"
38 action "$(CROSS_COMPILE)ar cr coreboot.a $(OBJECTS)"
42 makerule coreboot_ram.o
43 depends "$(DRIVER) coreboot.a $(LIBGCC_FILE_NAME)"
44 action "$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ c_start.o $(DRIVER) coreboot.a $(LIBGCC_FILE_NAME)"
48 depends "coreboot_ram.o $(TOP)/src/config/coreboot_ram.ld ldoptions"
49 action "$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/coreboot_ram.ld coreboot_ram.o"
50 action "$(CROSS_COMPILE)nm -n coreboot_ram | sort > coreboot_ram.map"
54 ## By default compress the part of coreboot that runs from RAM
56 makedefine COREBOOT_RAM-$(CONFIG_COMPRESS):=coreboot_ram.nrv2b
57 makedefine COREBOOT_RAM-$(CONFIG_UNCOMPRESSED):=coreboot_ram.bin
59 makerule coreboot_ram.bin
60 depends "coreboot_ram"
61 action "$(OBJCOPY) -O binary $< $@"
64 makerule coreboot_ram.nrv2b
65 depends "coreboot_ram.bin nrv2b"
66 action "./nrv2b e $< $@"
69 makerule coreboot_ram.rom
70 depends "$(COREBOOT_RAM-1)"
71 action "cp $(COREBOOT_RAM-1) coreboot_ram.rom"
74 makedefine COREBOOT_APC:=
76 if CONFIG_AP_CODE_IN_CAR
79 makerule coreboot_apc.a
81 action "rm -f coreboot_apc.a"
82 action "$(CROSS_COMPILE)ar cr coreboot_apc.a apc_auto.o"
85 makerule coreboot_apc.o
86 depends "coreboot_apc.a c_start.o $(LIBGCC_FILE_NAME)"
87 action "$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ c_start.o coreboot_apc.a $(LIBGCC_FILE_NAME)"
91 depends "coreboot_apc.o $(TOP)/src/config/coreboot_apc.ld ldoptions"
92 action "$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/coreboot_apc.ld coreboot_apc.o"
93 action "$(CROSS_COMPILE)nm -n coreboot_apc | sort > coreboot_apc.map"
97 ## By default compress the part of coreboot that runs from cache as ram
99 makedefine COREBOOT_APC-$(CONFIG_COMPRESS):=coreboot_apc.nrv2b
100 makedefine COREBOOT_APC-$(CONFIG_UNCOMPRESSED):=coreboot_apc.bin
102 makerule coreboot_apc.bin
103 depends "coreboot_apc"
104 action "$(OBJCOPY) -O binary $< $@"
107 makerule coreboot_apc.nrv2b
108 depends "coreboot_apc.bin nrv2b"
109 action "./nrv2b e $< $@"
112 makerule coreboot_apc.rom
113 depends "$(COREBOOT_APC-1)"
114 action "cp $(COREBOOT_APC-1) coreboot_apc.rom"
117 makedefine COREBOOT_APC:=coreboot_apc.rom
121 makedefine COREBOOT_RAM_ROM:=coreboot_ram.rom
124 depends "crt0.o $(INIT-OBJECTS) $(COREBOOT_APC) $(COREBOOT_RAM_ROM) ldscript.ld"
125 action "$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o $(INIT-OBJECTS)"
126 action "$(CROSS_COMPILE)nm -n coreboot | sort > coreboot.map"
136 depends "$(TOP)/util/buildrom/buildrom.c"
137 action "$(HOSTCC) -o $@ $<"
140 # Force crt0.s (which has build time version code in it to rebuild every time)
141 makedefine .PHONY : crt0.s
143 depends "crt0.S $(CRT0_INCLUDES)"
144 action "@echo \"$(CPP) ... $< > $@ \""
145 action "$(CPP) $(CPPFLAGS) -I. -I$(TOP)/src $< > $@.new && mv $@.new $@"
150 action "@echo $(CC) ... -o $@ $<"
151 action "@$(CC) -c $(CPU_OPT) -o $@ $<"
156 action "etags $(SOURCES)"
160 action "ctags $(SOURCES)"
162 makerule corebootDoc.config
163 depends "$(TOP)/src/config/corebootDoc.config"
164 action "cat $(TOP)/src/config/corebootDoc.config > corebootDoc.config"
165 action "echo 'INPUT=$(SOURCES)' >> corebootDoc.config"
167 makerule documentation
168 depends "corebootDoc.config"
169 action "doxygen corebootDoc.config"
173 depends "$(TOP)/util/romcc/romcc.c"
174 action "$(HOSTCC) -g $(HOSTCFLAGS) $< -o $@"
177 makerule build_opt_tbl
178 depends "$(TOP)/util/options/build_opt_tbl.c $(TOP)/src/include/pc80/mc146818rtc.h $(TOP)/src/include/boot/coreboot_tables.h Makefile.settings Makefile"
179 action "$(HOSTCC) $(HOSTCFLAGS) $(CPUFLAGS) $< -o $@"
182 #makerule /$(TARGET_DIR)/option_table.c
183 # depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
184 # action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout"
187 makerule option_table.c
188 depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
189 action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
192 makerule option_table.h
193 depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
194 action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
198 object ./option_table.o
200 #makerule option_table.o
201 # depends "option_table.c"
202 # action "$(CC) -c $(CFLAGS) -o $@ $<"
204 # object option_table.o
208 action "rm -f coreboot.* *~"
209 action "rm -f coreboot"
210 action "rm -f ldscript.ld"
211 action "rm -f a.out *.s *.l *.o *.E *.inc"
212 action "rm -f TAGS tags romcc*"
213 action "rm -f docipl buildrom* chips.c *chip.c coreboot_apc* coreboot_ram* coreboot_pay*"
214 action "rm -f build_opt_tbl* nrv2b* option_table.c crt0.S"
217 # do standard config files that the user need not specify
218 # for now, this is just 'lib', but it may be more later.