blob: 7344ddd5f335af49da0dc00112b4095327ddf99d [file] [log] [blame]
Patrick Georgi0588d192009-08-12 15:00:51 +00001##
2## This file is part of the coreboot project.
3##
4## Copyright (C) 2008 Advanced Micro Devices, Inc.
5## Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de>
Stefan Reinauer8ed1b6d2010-01-19 21:13:44 +00006## Copyright (C) 2009-2010 coresystems GmbH
Patrick Georgi0588d192009-08-12 15:00:51 +00007##
Stefan Reinauer16f515a2010-01-20 18:44:30 +00008## This program is free software; you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation; version 2 of the License.
Patrick Georgi0588d192009-08-12 15:00:51 +000011##
Stefan Reinauer16f515a2010-01-20 18:44:30 +000012## This program is distributed in the hope that it will be useful,
13## but WITHOUT ANY WARRANTY; without even the implied warranty of
14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15## GNU General Public License for more details.
16##
17## You should have received a copy of the GNU General Public License
18## along with this program; if not, write to the Free Software
19## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Patrick Georgi0588d192009-08-12 15:00:51 +000020##
21
Patrick Georgi020f51f2010-03-14 21:25:03 +000022ifeq ($(INNER_SCANBUILD),y)
23CC_real:=$(CC)
24endif
Patrick Georgi23d89cc2010-03-16 01:17:19 +000025
Patrick Georgi0588d192009-08-12 15:00:51 +000026$(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile > .xcompile)))
27include .xcompile
Patrick Georgi23d89cc2010-03-16 01:17:19 +000028
Patrick Georgi020f51f2010-03-14 21:25:03 +000029ifeq ($(INNER_SCANBUILD),y)
30CC:=$(CC_real)
31HOSTCC:=$(CC_real) --hostcc
32HOSTCXX:=$(CC_real) --hostcxx
33endif
Patrick Georgi0588d192009-08-12 15:00:51 +000034
Patrick Georgi1a47b5e2010-02-10 18:53:40 +000035export top := $(PWD)
Patrick Georgi0588d192009-08-12 15:00:51 +000036export src := $(top)/src
37export srck := $(top)/util/kconfig
Stefan Reinauere3778572010-01-30 09:47:18 +000038export obj ?= $(top)/build
Myles Watsond4e5c0a2009-10-28 15:30:11 +000039export objk := $(obj)/util/kconfig
Patrick Georgi0588d192009-08-12 15:00:51 +000040export sconfig := $(top)/util/sconfig
41export yapps2_py := $(sconfig)/yapps2.py
42export config_g := $(sconfig)/config.g
43
44
Stefan Reinauer37d8c212010-02-08 18:30:41 +000045export KERNELVERSION := 4.0
Patrick Georgi0588d192009-08-12 15:00:51 +000046export KCONFIG_AUTOHEADER := $(obj)/config.h
47export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
Patrick Georgi0588d192009-08-12 15:00:51 +000048
49CONFIG_SHELL := sh
50KBUILD_DEFCONFIG := configs/defconfig
51UNAME_RELEASE := $(shell uname -r)
52HAVE_DOTCONFIG := $(wildcard .config)
53MAKEFLAGS += -rR --no-print-directory
54
55# Make is silent per default, but 'make V=1' will show all compiler calls.
Patrick Georgi2b7418e2009-08-25 19:38:46 +000056Q:=@
Patrick Georgi0588d192009-08-12 15:00:51 +000057ifneq ($(V),1)
Patrick Georgi2b7418e2009-08-25 19:38:46 +000058ifneq ($(Q),)
59.SILENT:
60endif
Patrick Georgi0588d192009-08-12 15:00:51 +000061endif
62
63CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E
64HOSTCC = gcc
65HOSTCXX = g++
66HOSTCFLAGS := -I$(srck) -I$(objk) -g
67HOSTCXXFLAGS := -I$(srck) -I$(objk)
Stefan Reinauer68a564f2010-03-16 01:02:18 +000068LIBGCC_FILE_NAME := $(shell test -r `$(CC) -print-libgcc-file-name` && $(CC) -print-libgcc-file-name)
Patrick Georgi0588d192009-08-12 15:00:51 +000069
70DOXYGEN := doxygen
71DOXYGEN_OUTPUT_DIR := doxygen
72
73ifeq ($(strip $(HAVE_DOTCONFIG)),)
74
75all: config
76
77else
78
79include $(top)/.config
80
Patrick Georgi23d89cc2010-03-16 01:17:19 +000081ifneq ($(INNER_SCANBUILD),y)
82ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
83CC:=clang -m32
84HOSTCC:=clang
85endif
86endif
87
Patrick Georgia84e98b2010-03-16 19:01:32 +000088strip_quotes = $(subst ",,$(subst \",,$(1)))
89
Patrick Georgi0588d192009-08-12 15:00:51 +000090ARCHDIR-$(CONFIG_ARCH_X86) := i386
91ARCHDIR-$(CONFIG_ARCH_POWERPC) := ppc
92
Patrick Georgia84e98b2010-03-16 19:01:32 +000093MAINBOARDDIR=$(call strip_quotes,$(CONFIG_MAINBOARD_DIR))
Patrick Georgi0588d192009-08-12 15:00:51 +000094export MAINBOARDDIR
95
96PLATFORM-y += src/arch/$(ARCHDIR-y) src/cpu src/mainboard/$(MAINBOARDDIR)
97TARGETS-y :=
98
Stefan Reinauer859e94a2010-03-16 23:07:29 +000099BUILD-y := src/lib src/boot src/console src/devices src/southbridge src/northbridge src/superio src/drivers
Patrick Georgi0588d192009-08-12 15:00:51 +0000100BUILD-y += util/cbfstool
101BUILD-$(CONFIG_ARCH_X86) += src/pc80
102
Uwe Hermannc04be932009-10-05 13:55:28 +0000103ifneq ($(CONFIG_LOCALVERSION),"")
Patrick Georgia84e98b2010-03-16 19:01:32 +0000104COREBOOT_EXTRA_VERSION := -$(call strip_quotes,$(CONFIG_LOCALVERSION))
Uwe Hermannc04be932009-10-05 13:55:28 +0000105endif
106
Patrick Georgi0588d192009-08-12 15:00:51 +0000107# The primary target needs to be here before we include the
108# other files
109
Patrick Georgi020f51f2010-03-14 21:25:03 +0000110ifeq ($(INNER_SCANBUILD),y)
111CONFIG_SCANBUILD_ENABLE:=
112endif
113
114ifeq ($(CONFIG_SCANBUILD_ENABLE),y)
115ifneq ($(CONFIG_SCANBUILD_REPORT_LOCATION),)
116CONFIG_SCANBUILD_REPORT_LOCATION:=-o $(CONFIG_SCANBUILD_REPORT_LOCATION)
117endif
118all:
119 echo '#!/bin/sh' > .ccwrap
120 echo 'CC="$(CC)"' >> .ccwrap
121 echo 'if [ "$$1" = "--hostcc" ]; then shift; CC="$(HOSTCC)"; fi' >> .ccwrap
122 echo 'if [ "$$1" = "--hostcxx" ]; then shift; CC="$(HOSTCXX)"; fi' >> .ccwrap
123 echo 'eval $$CC $$*' >> .ccwrap
124 chmod +x .ccwrap
125 scan-build $(CONFIG_SCANBUILD_REPORT_LOCATION) -analyze-headers --use-cc=$(top)/.ccwrap --use-c++=$(top)/.ccwrap $(MAKE) INNER_SCANBUILD=y
126else
Stefan Reinauer1425add2010-03-21 22:35:58 +0000127all: $(obj)/config.h coreboot
Patrick Georgi020f51f2010-03-14 21:25:03 +0000128endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000129
Stefan Reinauer1425add2010-03-21 22:35:58 +0000130$(obj)/config.h:
131 $(MAKE) oldconfig
Patrick Georgi0588d192009-08-12 15:00:51 +0000132
133#######################################################################
134# Build the tools
135
136CBFSTOOL:=$(obj)/util/cbfstool/cbfstool
137
138$(obj)/mainboard/$(MAINBOARDDIR)/config.py: $(yapps2_py) $(config_g)
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000139 mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
140 python $(yapps2_py) $(config_g) $(obj)/mainboard/$(MAINBOARDDIR)/config.py
Patrick Georgi0588d192009-08-12 15:00:51 +0000141
142
143# needed objects that every mainboard uses
144# Creation of these is architecture and mainboard independent
Myles Watsoned035562009-09-22 21:29:32 +0000145$(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(obj)/mainboard/$(MAINBOARDDIR)/config.py
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000146 mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
Patrick Georgi0588d192009-08-12 15:00:51 +0000147 (cd $(obj)/mainboard/$(MAINBOARDDIR) ; PYTHONPATH=$(top)/util/sconfig export PYTHONPATH; python config.py $(MAINBOARDDIR) $(top) $(obj)/mainboard/$(MAINBOARDDIR))
148
Patrick Georgi0588d192009-08-12 15:00:51 +0000149objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o
150initobjs:=
151drivers:=
152smmobjs:=
153crt0s:=
154ldscripts:=
155types:=obj initobj driver smmobj
Patrick Georgi47d68d82010-03-06 21:18:43 +0000156
157# Clean -y variables, include Makefile.inc
158# If $(3) is non-empty, add paths to files in X-y, and add them to Xs
159# Add subdirs-y to subdirs
160includemakefiles= \
161 $(foreach type,$(2), $(eval $(type)-y:=)) \
162 $(eval subdirs-y:=) \
163 $(eval -include $(1)) \
164 $(if $(strip $(3)), \
165 $(foreach type,$(2), \
166 $(eval $(type)s+= \
Stefan Reinauer859e94a2010-03-16 23:07:29 +0000167 $$(abspath $$(patsubst src/%, \
Patrick Georgi47d68d82010-03-06 21:18:43 +0000168 $(obj)/%, \
Stefan Reinauer859e94a2010-03-16 23:07:29 +0000169 $$(addprefix $(dir $(1)),$$($(type)-y))))))) \
Patrick Georgi47d68d82010-03-06 21:18:43 +0000170 $(eval subdirs+=$$(subst $(PWD)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
171
172# For each path in $(subdirs) call includemakefiles, passing $(1) as $(3)
173# Repeat until subdirs is empty
174evaluate_subdirs= \
175 $(eval cursubdirs:=$(subdirs)) \
176 $(eval subdirs:=) \
177 $(foreach dir,$(cursubdirs), \
178 $(eval $(call includemakefiles,$(dir)/Makefile.inc,$(types),$(1)))) \
179 $(if $(subdirs),$(eval $(call evaluate_subdirs, $(1))))
Patrick Georgi0588d192009-08-12 15:00:51 +0000180
181# collect all object files eligible for building
182subdirs:=$(PLATFORM-y) $(BUILD-y)
183$(eval $(call evaluate_subdirs, modify))
184
Patrick Georgid3428b02010-02-24 13:18:01 +0000185initobjs:=$(addsuffix .initobj.o, $(basename $(initobjs)))
186drivers:=$(addsuffix .driver.o, $(basename $(drivers)))
187smmobjs:=$(addsuffix .smmobj.o, $(basename $(smmobjs)))
188
Patrick Georgi0588d192009-08-12 15:00:51 +0000189allobjs:=$(foreach var, $(addsuffix s,$(types)), $($(var)))
190alldirs:=$(sort $(abspath $(dir $(allobjs))))
191source_with_ext=$(patsubst $(obj)/%.o,src/%.$(1),$(allobjs))
192allsrc=$(wildcard $(call source_with_ext,c) $(call source_with_ext,S))
193
194POST_EVALUATION:=y
195
196# fetch rules (protected in POST_EVALUATION) that rely on the variables filled above
197subdirs:=$(PLATFORM-y) $(BUILD-y)
198$(eval $(call evaluate_subdirs))
199
200
Patrick Georgi9ea7bff2010-02-28 18:23:00 +0000201define objs_asl_template
Patrick Georgiaf97d332010-02-08 15:46:37 +0000202$(obj)/$(1)%.o: src/$(1)%.asl
Patrick Georgi1a47b5e2010-02-10 18:53:40 +0000203 @printf " IASL $$(subst $(top)/,,$$(@))\n"
Stefan Reinauer9db39d32010-03-24 09:53:50 +0000204 $(CPP) -D__ACPI__ -P -include $(obj)/config.h -I$(src) -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$(basename $$@).asl
Patrick Georgiaf97d332010-02-08 15:46:37 +0000205 iasl -p $$(basename $$@) -tc $$(basename $$@).asl
206 mv $$(basename $$@).hex $$(basename $$@).c
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000207 $(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $$@))), -DAmlCode=AmlCode_$$(basename $$(notdir $$@))) -c -o $$@ $$(basename $$@).c
Patrick Georgi88f55b22009-09-25 18:43:02 +0000208endef
209
Patrick Georgi patrick.georgic5f773d2010-03-16 12:01:13 +0000210# macro to define template macros that are used by use_template macro
211define create_cc_template
212# $1 obj class (objs, initobjs, ...)
213# $2 source suffix (c, S)
214# $3 .o infix ("" ".initobj", ...)
215# $4 additional compiler flags
216de$(EMPTY)fine $(1)_$(2)_template
Patrick Georgi patrick.georgic5f773d2010-03-16 12:01:13 +0000217$(obj)/$$(1)%$(3).o: src/$$(1)%.$(2) $(obj)/config.h
218 printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
219 $(CC) $(4) $$$$(CFLAGS) -c -o $$$$@ $$$$<
220
221$(obj)/$$(1)%$(3).o: obj/$$(1)%.$(2) $(obj)/config.h
222 printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
223 $(CC) $(4) $$$$(CFLAGS) -c -o $$$$@ $$$$<
224en$(EMPTY)def
Patrick Georgi0588d192009-08-12 15:00:51 +0000225endef
226
Patrick Georgi patrick.georgic5f773d2010-03-16 12:01:13 +0000227$(eval $(call create_cc_template,objs,c))
228$(eval $(call create_cc_template,objs,S,,-DASSEMBLY))
229$(eval $(call create_cc_template,initobjs,c,.initobj))
230$(eval $(call create_cc_template,initobjs,S,.initobj,-DASSEMBLY))
231$(eval $(call create_cc_template,drivers,c,.driver))
232$(eval $(call create_cc_template,drivers,S,.driver,-DASSEMBLY))
233$(eval $(call create_cc_template,smmobjs,c,.smmobj))
234$(eval $(call create_cc_template,smmobjs,S,.smmobj))
Patrick Georgi0588d192009-08-12 15:00:51 +0000235
236usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
237usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
Patrick Georgi9ea7bff2010-02-28 18:23:00 +0000238$(eval $(call usetemplate,objs,asl))
Patrick Georgi0588d192009-08-12 15:00:51 +0000239$(eval $(call usetemplate,objs,c))
240$(eval $(call usetemplate,objs,S))
241$(eval $(call usetemplate,initobjs,c))
242$(eval $(call usetemplate,initobjs,S))
243$(eval $(call usetemplate,drivers,c))
244$(eval $(call usetemplate,drivers,S))
245$(eval $(call usetemplate,smmobjs,c))
246$(eval $(call usetemplate,smmobjs,S))
247
248printall:
249 @echo objs:=$(objs)
250 @echo initobjs:=$(initobjs)
251 @echo drivers:=$(drivers)
252 @echo smmobjs:=$(smmobjs)
253 @echo alldirs:=$(alldirs)
254 @echo allsrc=$(allsrc)
Stefan Reinauer68a564f2010-03-16 01:02:18 +0000255 @echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME)
Patrick Georgi0588d192009-08-12 15:00:51 +0000256
Patrick Georgieb49f9d2010-02-25 17:03:17 +0000257printcrt0s:
258 @echo $(patsubst $(top)/%,%,$(crt0s))
259
Patrick Georgi0588d192009-08-12 15:00:51 +0000260OBJS := $(patsubst %,$(obj)/%,$(TARGETS-y))
261INCLUDES := -I$(top)/src -I$(top)/src/include -I$(obj) -I$(top)/src/arch/$(ARCHDIR-y)/include
Stefan Reinauer859e94a2010-03-16 23:07:29 +0000262INCLUDES += -I$(top)/src/devices/oprom/include
Stefan Reinauerb4d3af82010-02-11 03:21:29 +0000263INCLUDES += -include $(obj)/config.h
Patrick Georgi0588d192009-08-12 15:00:51 +0000264
Patrick Georgi patrick.georgic5f773d2010-03-16 12:01:13 +0000265CFLAGS = $(INCLUDES) -Os -nostdinc -pipe
Patrick Georgi0588d192009-08-12 15:00:51 +0000266CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
Uwe Hermannc04be932009-10-05 13:55:28 +0000267CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
Stefan Reinauer68a564f2010-03-16 01:02:18 +0000268CFLAGS += -Wstrict-aliasing -Wshadow
Myles Watson2e672732009-11-12 16:38:03 +0000269ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
270CFLAGS += -Werror
271endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000272CFLAGS += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
273
Patrick Georgi0588d192009-08-12 15:00:51 +0000274CBFS_COMPRESS_FLAG:=l
Myles Watson422d0cb2009-09-23 17:48:28 +0000275CBFS_PAYLOAD_COMPRESS_FLAG:=
276ifeq ($(CONFIG_COMPRESSED_PAYLOAD_LZMA),y)
277CBFS_PAYLOAD_COMPRESS_FLAG:=l
Patrick Georgi0588d192009-08-12 15:00:51 +0000278endif
279
Stefan Reinauerc0fbbd02010-03-15 13:35:19 +0000280coreboot: prepare $(obj)/coreboot.rom
Patrick Georgi0588d192009-08-12 15:00:51 +0000281
282endif
283
284prepare:
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000285 mkdir -p $(obj)
Patrick Georgi7faf22f2010-02-10 18:50:36 +0000286 mkdir -p $(obj)/util/kconfig/lxdialog $(obj)/util/cbfstool
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000287 test -n "$(alldirs)" && mkdir -p $(alldirs) || true
Patrick Georgi0588d192009-08-12 15:00:51 +0000288
Stefan Reinauerc0fbbd02010-03-15 13:35:19 +0000289$(obj)/build.h: .xcompile
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000290 @printf " GEN build.h\n"
Patrick Georgicccbb892010-01-29 17:38:57 +0000291 rm -f $(obj)/build.h
Stefan Reinauerb4d3af82010-02-11 03:21:29 +0000292 printf "/* build system definitions (autogenerated) */\n" > $(obj)/build.ht
293 printf "#ifndef __BUILD_H\n" >> $(obj)/build.ht
294 printf "#define __BUILD_H\n\n" >> $(obj)/build.ht
Zheng Baob7bc3f32010-02-23 10:33:25 +0000295 printf "#define COREBOOT_VERSION \"$(KERNELVERSION)-r$(shell if [ -d $(top)/.svn -a -f `which svnversion` ]; then svnversion $(top); else if [ -d $(top)/.git -a -f `which git` ]; then git --git-dir=/$(top)/.git log|grep git-svn-id|cut -f 2 -d@|cut -f 1 -d' '|sort -g|tail -1; fi; fi)\"\n" >> $(obj)/build.ht
Patrick Georgicccbb892010-01-29 17:38:57 +0000296 printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.ht
297 printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
298 printf "\n" >> $(obj)/build.ht
299 printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.ht
300 printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | head -n1)\"\n" >> $(obj)/build.ht
301 printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.ht
302 printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
303 printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
Patrick Georgi patrick.georgic5f773d2010-03-16 12:01:13 +0000304 printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s 2>/dev/null)\"\n" >> $(obj)/build.ht
305 printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname 2>/dev/null)\"\n" >> $(obj)/build.ht
Stefan Reinauerb4d3af82010-02-11 03:21:29 +0000306 printf "#endif\n" >> $(obj)/build.ht
Patrick Georgicccbb892010-01-29 17:38:57 +0000307 mv $(obj)/build.ht $(obj)/build.h
Patrick Georgi0588d192009-08-12 15:00:51 +0000308
309doxy: doxygen
310doxygen:
Stefan Reinauer1bbad5c2010-02-10 15:36:53 +0000311 $(DOXYGEN) documentation/Doxyfile.coreboot
Patrick Georgi0588d192009-08-12 15:00:51 +0000312
313doxyclean: doxygen-clean
314doxygen-clean:
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000315 rm -rf $(DOXYGEN_OUTPUT_DIR)
Patrick Georgi0588d192009-08-12 15:00:51 +0000316
Patrick Georgi967952a2010-02-09 19:41:11 +0000317clean-for-update: doxygen-clean
318 rm -f $(objs) $(initobjs) $(drivers) $(smmobjs) .xcompile
319 rm -f $(obj)/coreboot_ram* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a
Patrick Georgi9341acd2009-12-23 12:52:56 +0000320 rm -rf $(obj)/bootblock* $(obj)/romstage* $(obj)/location.*
Patrick Georgi97fc40b2010-02-11 12:12:19 +0000321 rm -f $(obj)/option_table.* $(obj)/crt0_includes.h $(obj)/ldscript
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000322 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot
Stefan Reinauerf9035dd2010-03-17 01:18:14 +0000323 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm
324 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/failover.inc $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc
Stefan Reinauer37e78172010-03-17 01:50:15 +0000325 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/mainboard/$(MAINBOARDDIR)/dsdt.*
326 rm -f $(obj)/cpu/x86/smm/smm_bin.c $(obj)/cpu/x86/smm/smm.* $(obj)/cpu/x86/smm/smm
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000327 rmdir -p $(alldirs) 2>/dev/null >/dev/null || true
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000328 $(MAKE) -C util/sconfig clean
Patrick Georgi0588d192009-08-12 15:00:51 +0000329
Patrick Georgi967952a2010-02-09 19:41:11 +0000330clean: clean-for-update
Patrick Georgi020f51f2010-03-14 21:25:03 +0000331 rm -f $(obj)/coreboot* .ccwrap
Patrick Georgi967952a2010-02-09 19:41:11 +0000332
Patrick Georgi0588d192009-08-12 15:00:51 +0000333distclean: clean
Myles Watson1af297c2010-01-06 16:59:18 +0000334 rm -rf $(obj)
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000335 rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig*
Patrick Georgi0588d192009-08-12 15:00:51 +0000336
337update:
Myles Watsond4e5c0a2009-10-28 15:30:11 +0000338 dongle.py -c /dev/term/1 $(obj)/coreboot.rom EOF
Patrick Georgi0588d192009-08-12 15:00:51 +0000339
340# This include must come _before_ the pattern rules below!
341# Order _does_ matter for pattern rules.
342include util/kconfig/Makefile
343
344$(obj)/ldoptions: $(obj)/config.h
Patrick Georgi26774f22009-11-21 19:54:02 +0000345 awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@
Patrick Georgi0588d192009-08-12 15:00:51 +0000346
Patrick Georgi26774f22009-11-21 19:54:02 +0000347_OS=$(shell uname -s |cut -c-7)
348STACK=
349ifeq ($(_OS),MINGW32)
350 STACK=-Wl,--stack,16384000
351endif
352ifeq ($(_OS),CYGWIN_)
353 STACK=-Wl,--stack,16384000
354endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000355$(obj)/romcc: $(top)/util/romcc/romcc.c
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000356 @printf " HOSTCC $(subst $(obj)/,,$(@)) (this may take a while)\n"
Uwe Hermann0dd63a22010-02-15 23:24:51 +0000357 @# Note: Adding -O2 here might cause problems. For details see:
358 @# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html
Marc Jones516255e2010-02-13 18:06:29 +0000359 $(HOSTCC) -g $(STACK) -Wall -o $@ $<
Patrick Georgi0588d192009-08-12 15:00:51 +0000360
Stefan Reinauerc0fbbd02010-03-15 13:35:19 +0000361.PHONY: $(PHONY) prepare clean distclean doxygen doxy coreboot .xcompile
Patrick Georgi0588d192009-08-12 15:00:51 +0000362