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 $(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) $(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 linuxbios.strip
32 action "$(OBJCOPY) -O binary linuxbios linuxbios.strip"
37 action "rm -f linuxbios.a"
38 action "ar cr linuxbios.a $(OBJECTS)"
41 makerule linuxbios_ram.o
42 depends "$(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
43 action "$(CC) -nostdlib -r -o $@ c_start.o $(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
46 makerule linuxbios_ram
47 depends "linuxbios_ram.o $(TOP)/src/config/linuxbios_ram.ld ldoptions"
48 action "$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_ram.ld linuxbios_ram.o"
49 action "$(CROSS_COMPILE)nm -n linuxbios_ram | sort > linuxbios_ram.map"
53 ## By default compress the part of linuxbios that runs from RAM
55 makedefine LINUXBIOS_RAM-$(CONFIG_COMPRESS):=linuxbios_ram.nrv2b
56 makedefine LINUXBIOS_RAM-$(CONFIG_UNCOMPRESSED):=linuxbios_ram.bin
58 makerule linuxbios_ram.bin
59 depends "linuxbios_ram"
60 action "$(OBJCOPY) -O binary $< $@"
63 makerule linuxbios_ram.nrv2b
64 depends "linuxbios_ram.bin nrv2b"
65 action "./nrv2b e $< $@"
68 makerule linuxbios_ram.rom
69 depends "$(LINUXBIOS_RAM-1)"
70 action "cp $(LINUXBIOS_RAM-1) linuxbios_ram.rom"
73 makedefine LINUXBIOS_APC:=
75 if CONFIG_AP_CODE_IN_CAR
78 makerule linuxbios_apc.a
80 action "rm -f linuxbios_apc.a"
81 action "ar cr linuxbios_apc.a apc_auto.o"
84 makerule linuxbios_apc.o
85 depends "linuxbios_apc.a c_start.o $(LIBGCC_FILE_NAME)"
86 action "$(CC) -nostdlib -r -o $@ c_start.o linuxbios_apc.a $(LIBGCC_FILE_NAME)"
89 makerule linuxbios_apc
90 depends "linuxbios_apc.o $(TOP)/src/config/linuxbios_apc.ld ldoptions"
91 action "$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_apc.ld linuxbios_apc.o"
92 action "$(CROSS_COMPILE)nm -n linuxbios_apc | sort > linuxbios_apc.map"
96 ## By default compress the part of linuxbios that runs from cache as ram
98 makedefine LINUXBIOS_APC-$(CONFIG_COMPRESS):=linuxbios_apc.nrv2b
99 makedefine LINUXBIOS_APC-$(CONFIG_UNCOMPRESSED):=linuxbios_apc.bin
101 makerule linuxbios_apc.bin
102 depends "linuxbios_apc"
103 action "$(OBJCOPY) -O binary $< $@"
106 makerule linuxbios_apc.nrv2b
107 depends "linuxbios_apc.bin nrv2b"
108 action "./nrv2b e $< $@"
111 makerule linuxbios_apc.rom
112 depends "$(LINUXBIOS_APC-1)"
113 action "cp $(LINUXBIOS_APC-1) linuxbios_apc.rom"
116 makedefine LINUXBIOS_APC:=linuxbios_apc.rom
120 makedefine LINUXBIOS_RAM_ROM:=linuxbios_ram.rom
123 depends "crt0.o $(INIT-OBJECTS) $(LINUXBIOS_APC) $(LINUXBIOS_RAM_ROM) ldscript.ld"
124 action "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o $(INIT-OBJECTS)"
125 action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
135 depends "$(TOP)/util/buildrom/buildrom.c"
136 action "$(HOSTCC) -o $@ $<"
139 # Force crt0.s (which has build time version code in it to rebuild every time)
140 makedefine .PHONY : crt0.s
142 depends "crt0.S $(CRT0_INCLUDES)"
143 action "@echo \"$(CPP) ... $< > $@ \""
144 action "$(CPP) $(CPPFLAGS) -I. -I$(TOP)/src $< > $@.new && mv $@.new $@"
149 action "@echo $(CC) ... -o $@ $<"
150 action "@$(CC) -c $(CPU_OPT) -o $@ $<"
155 action "etags $(SOURCES)"
159 action "ctags $(SOURCES)"
161 makerule LinuxBIOSDoc.config
162 depends "$(TOP)/src/config/LinuxBIOSDoc.config"
163 action "cat $(TOP)/src/config/LinuxBIOSDoc.config > LinuxBIOSDoc.config"
164 action "echo 'INPUT=$(SOURCES)' >> LinuxBIOSDoc.config"
166 makerule documentation
167 depends "LinuxBIOSDoc.config"
168 action "doxygen LinuxBIOSDoc.config"
172 depends "$(TOP)/util/romcc/romcc.c"
173 action "$(HOSTCC) -g $(HOSTCFLAGS) $< -o $@"
176 makerule build_opt_tbl
177 depends "$(TOP)/util/options/build_opt_tbl.c $(TOP)/src/include/pc80/mc146818rtc.h $(TOP)/src/include/boot/linuxbios_tables.h Makefile.settings Makefile"
178 action "$(HOSTCC) $(HOSTCFLAGS) $(CPUFLAGS) $< -o $@"
181 #makerule /$(TARGET_DIR)/option_table.c
182 # depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
183 # action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout"
186 makerule option_table.c
187 depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
188 action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
191 makerule option_table.h
192 depends "build_opt_tbl $(MAINBOARD)/cmos.layout"
193 action "./build_opt_tbl -b --config $(MAINBOARD)/cmos.layout --header option_table.h"
197 object ./option_table.o
199 #makerule option_table.o
200 # depends "option_table.c"
201 # action "$(CC) -c $(CFLAGS) -o $@ $<"
203 # object option_table.o
207 action "rm -f linuxbios.* *~"
208 action "rm -f linuxbios"
209 action "rm -f ldscript.ld"
210 action "rm -f a.out *.s *.l *.o *.E *.inc"
211 action "rm -f TAGS tags romcc*"
212 action "rm -f docipl buildrom* chips.c *chip.c linuxbios_apc* linuxbios_ram* linuxbios_pay*"
213 action "rm -f build_opt_tbl* nrv2b* option_table.c crt0.S"
216 # do standard config files that the user need not specify
217 # for now, this is just 'lib', but it may be more later.