blob: 9de0fe5efec383bdadc6d26d89f0a9082bdce9a5 [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
22$(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile > .xcompile)))
23include .xcompile
24
Patrick Georgi1a47b5e2010-02-10 18:53:40 +000025export top := $(PWD)
Patrick Georgi0588d192009-08-12 15:00:51 +000026export src := $(top)/src
27export srck := $(top)/util/kconfig
Stefan Reinauere3778572010-01-30 09:47:18 +000028export obj ?= $(top)/build
Myles Watsond4e5c0a2009-10-28 15:30:11 +000029export objk := $(obj)/util/kconfig
Patrick Georgi0588d192009-08-12 15:00:51 +000030export sconfig := $(top)/util/sconfig
31export yapps2_py := $(sconfig)/yapps2.py
32export config_g := $(sconfig)/config.g
33
34
Stefan Reinauer37d8c212010-02-08 18:30:41 +000035export KERNELVERSION := 4.0
Patrick Georgi0588d192009-08-12 15:00:51 +000036export KCONFIG_AUTOHEADER := $(obj)/config.h
37export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
Patrick Georgi0588d192009-08-12 15:00:51 +000038
39CONFIG_SHELL := sh
40KBUILD_DEFCONFIG := configs/defconfig
41UNAME_RELEASE := $(shell uname -r)
42HAVE_DOTCONFIG := $(wildcard .config)
43MAKEFLAGS += -rR --no-print-directory
44
45# Make is silent per default, but 'make V=1' will show all compiler calls.
Patrick Georgi2b7418e2009-08-25 19:38:46 +000046Q:=@
Patrick Georgi0588d192009-08-12 15:00:51 +000047ifneq ($(V),1)
Patrick Georgi2b7418e2009-08-25 19:38:46 +000048ifneq ($(Q),)
49.SILENT:
50endif
Patrick Georgi0588d192009-08-12 15:00:51 +000051endif
52
53CPP:= $(CC) -x assembler-with-cpp -DASSEMBLY -E
54HOSTCC = gcc
55HOSTCXX = g++
56HOSTCFLAGS := -I$(srck) -I$(objk) -g
57HOSTCXXFLAGS := -I$(srck) -I$(objk)
Harald Gutmanndc4bb0d2009-08-26 15:35:36 +000058LIBGCC_FILE_NAME := $(shell $(CC) -print-libgcc-file-name)
Patrick Georgi0588d192009-08-12 15:00:51 +000059
60DESTDIR = /opt
61
62DOXYGEN := doxygen
63DOXYGEN_OUTPUT_DIR := doxygen
64
65ifeq ($(strip $(HAVE_DOTCONFIG)),)
66
67all: config
68
69else
70
71include $(top)/.config
72
73ARCHDIR-$(CONFIG_ARCH_X86) := i386
74ARCHDIR-$(CONFIG_ARCH_POWERPC) := ppc
75
Patrick Georgi1a47b5e2010-02-10 18:53:40 +000076MAINBOARDDIR=$(subst ",,$(CONFIG_MAINBOARD_DIR))
Patrick Georgi0588d192009-08-12 15:00:51 +000077export MAINBOARDDIR
78
79PLATFORM-y += src/arch/$(ARCHDIR-y) src/cpu src/mainboard/$(MAINBOARDDIR)
80TARGETS-y :=
81
82BUILD-y := src/lib src/boot src/console src/devices src/southbridge src/northbridge src/superio src/drivers util/x86emu
83BUILD-y += util/cbfstool
84BUILD-$(CONFIG_ARCH_X86) += src/pc80
85
Uwe Hermannc04be932009-10-05 13:55:28 +000086ifneq ($(CONFIG_LOCALVERSION),"")
Patrick Georgi1a47b5e2010-02-10 18:53:40 +000087COREBOOT_EXTRA_VERSION := -$(subst ",,$(CONFIG_LOCALVERSION))
Uwe Hermannc04be932009-10-05 13:55:28 +000088endif
89
Patrick Georgi0588d192009-08-12 15:00:51 +000090# The primary target needs to be here before we include the
91# other files
92
93all: coreboot
94
95
96#######################################################################
97# Build the tools
98
99CBFSTOOL:=$(obj)/util/cbfstool/cbfstool
100
101$(obj)/mainboard/$(MAINBOARDDIR)/config.py: $(yapps2_py) $(config_g)
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000102 mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
103 python $(yapps2_py) $(config_g) $(obj)/mainboard/$(MAINBOARDDIR)/config.py
Patrick Georgi0588d192009-08-12 15:00:51 +0000104
105
106# needed objects that every mainboard uses
107# Creation of these is architecture and mainboard independent
Myles Watsoned035562009-09-22 21:29:32 +0000108$(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(obj)/mainboard/$(MAINBOARDDIR)/config.py
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000109 mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
Patrick Georgi0588d192009-08-12 15:00:51 +0000110 (cd $(obj)/mainboard/$(MAINBOARDDIR) ; PYTHONPATH=$(top)/util/sconfig export PYTHONPATH; python config.py $(MAINBOARDDIR) $(top) $(obj)/mainboard/$(MAINBOARDDIR))
111
112$(obj)/mainboard/$(MAINBOARDDIR)/static.o: $(obj)/mainboard/$(MAINBOARDDIR)/static.c
113#
114
115objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o
116initobjs:=
117drivers:=
118smmobjs:=
119crt0s:=
120ldscripts:=
121types:=obj initobj driver smmobj
Patrick Georgi47d68d82010-03-06 21:18:43 +0000122
123# Clean -y variables, include Makefile.inc
124# If $(3) is non-empty, add paths to files in X-y, and add them to Xs
125# Add subdirs-y to subdirs
126includemakefiles= \
127 $(foreach type,$(2), $(eval $(type)-y:=)) \
128 $(eval subdirs-y:=) \
129 $(eval -include $(1)) \
130 $(if $(strip $(3)), \
131 $(foreach type,$(2), \
132 $(eval $(type)s+= \
133 $$(patsubst util/%, \
134 $(obj)/util/%, \
135 $$(patsubst src/%, \
136 $(obj)/%, \
137 $$(addprefix $(dir $(1)),$$($(type)-y))))))) \
138 $(eval subdirs+=$$(subst $(PWD)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
139
140# For each path in $(subdirs) call includemakefiles, passing $(1) as $(3)
141# Repeat until subdirs is empty
142evaluate_subdirs= \
143 $(eval cursubdirs:=$(subdirs)) \
144 $(eval subdirs:=) \
145 $(foreach dir,$(cursubdirs), \
146 $(eval $(call includemakefiles,$(dir)/Makefile.inc,$(types),$(1)))) \
147 $(if $(subdirs),$(eval $(call evaluate_subdirs, $(1))))
Patrick Georgi0588d192009-08-12 15:00:51 +0000148
149# collect all object files eligible for building
150subdirs:=$(PLATFORM-y) $(BUILD-y)
151$(eval $(call evaluate_subdirs, modify))
152
Patrick Georgid3428b02010-02-24 13:18:01 +0000153initobjs:=$(addsuffix .initobj.o, $(basename $(initobjs)))
154drivers:=$(addsuffix .driver.o, $(basename $(drivers)))
155smmobjs:=$(addsuffix .smmobj.o, $(basename $(smmobjs)))
156
Patrick Georgi0588d192009-08-12 15:00:51 +0000157allobjs:=$(foreach var, $(addsuffix s,$(types)), $($(var)))
158alldirs:=$(sort $(abspath $(dir $(allobjs))))
159source_with_ext=$(patsubst $(obj)/%.o,src/%.$(1),$(allobjs))
160allsrc=$(wildcard $(call source_with_ext,c) $(call source_with_ext,S))
161
162POST_EVALUATION:=y
163
164# fetch rules (protected in POST_EVALUATION) that rely on the variables filled above
165subdirs:=$(PLATFORM-y) $(BUILD-y)
166$(eval $(call evaluate_subdirs))
167
168
Patrick Georgi9ea7bff2010-02-28 18:23:00 +0000169define objs_asl_template
Patrick Georgiaf97d332010-02-08 15:46:37 +0000170$(obj)/$(1)%.o: src/$(1)%.asl
Patrick Georgi1a47b5e2010-02-10 18:53:40 +0000171 @printf " IASL $$(subst $(top)/,,$$(@))\n"
Patrick Georgiaf97d332010-02-08 15:46:37 +0000172 $(CPP) -D__ACPI__ -P $(CPPFLAGS) -include $(obj)/config.h -I$(src) -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$(basename $$@).asl
173 iasl -p $$(basename $$@) -tc $$(basename $$@).asl
174 mv $$(basename $$@).hex $$(basename $$@).c
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000175 $(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $$@))), -DAmlCode=AmlCode_$$(basename $$(notdir $$@))) -c -o $$@ $$(basename $$@).c
Patrick Georgi88f55b22009-09-25 18:43:02 +0000176endef
177
Patrick Georgi0588d192009-08-12 15:00:51 +0000178define objs_c_template
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000179$(obj)/$(1)%.o: $(1)%.c $(obj)/config.h
180 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
181 $(CC) $$(CFLAGS) -c -o $$@ $$<
182
Stefan Reinauerb4d3af82010-02-11 03:21:29 +0000183$(obj)/$(1)%.o: src/$(1)%.c $(obj)/config.h
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000184 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000185 $(CC) $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000186endef
187
188define objs_S_template
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000189$(obj)/$(1)%.o: $(1)%.S $(obj)/config.h
190 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
191 $(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
192
Stefan Reinauerb4d3af82010-02-11 03:21:29 +0000193$(obj)/$(1)%.o: src/$(1)%.S $(obj)/config.h
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000194 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000195 $(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000196endef
197
198define initobjs_c_template
Patrick Georgid3428b02010-02-24 13:18:01 +0000199$(obj)/$(1)%.initobj.o: src/$(1)%.c $(obj)/config.h
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000200 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000201 $(CC) $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000202endef
203
204define initobjs_S_template
Patrick Georgid3428b02010-02-24 13:18:01 +0000205$(obj)/$(1)%.initobj.o: src/$(1)%.S $(obj)/config.h
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000206 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000207 $(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000208endef
209
210define drivers_c_template
Patrick Georgid3428b02010-02-24 13:18:01 +0000211$(obj)/$(1)%.driver.o: src/$(1)%.c $(obj)/config.h
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000212 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000213 $(CC) $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000214endef
215
216define drivers_S_template
Patrick Georgid3428b02010-02-24 13:18:01 +0000217$(obj)/$(1)%.driver.o: src/$(1)%.S
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000218 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000219 $(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000220endef
221
222define smmobjs_c_template
Patrick Georgid3428b02010-02-24 13:18:01 +0000223$(obj)/$(1)%.smmobj.o: src/$(1)%.c
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000224 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000225 $(CC) $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000226endef
227
228define smmobjs_S_template
Patrick Georgid3428b02010-02-24 13:18:01 +0000229$(obj)/$(1)%.smmobj.o: src/$(1)%.S
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000230 @printf " CC $$(subst $$(obj)/,,$$(@))\n"
Stefan Reinauerae22bcd2010-03-05 10:20:28 +0000231 $(CC) $$(CFLAGS) -c -o $$@ $$<
Patrick Georgi0588d192009-08-12 15:00:51 +0000232endef
233
234usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
235usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
Patrick Georgi9ea7bff2010-02-28 18:23:00 +0000236$(eval $(call usetemplate,objs,asl))
Patrick Georgi0588d192009-08-12 15:00:51 +0000237$(eval $(call usetemplate,objs,c))
238$(eval $(call usetemplate,objs,S))
239$(eval $(call usetemplate,initobjs,c))
240$(eval $(call usetemplate,initobjs,S))
241$(eval $(call usetemplate,drivers,c))
242$(eval $(call usetemplate,drivers,S))
243$(eval $(call usetemplate,smmobjs,c))
244$(eval $(call usetemplate,smmobjs,S))
245
246printall:
247 @echo objs:=$(objs)
248 @echo initobjs:=$(initobjs)
249 @echo drivers:=$(drivers)
250 @echo smmobjs:=$(smmobjs)
251 @echo alldirs:=$(alldirs)
252 @echo allsrc=$(allsrc)
253
Patrick Georgieb49f9d2010-02-25 17:03:17 +0000254printcrt0s:
255 @echo $(patsubst $(top)/%,%,$(crt0s))
256
Patrick Georgi0588d192009-08-12 15:00:51 +0000257OBJS := $(patsubst %,$(obj)/%,$(TARGETS-y))
258INCLUDES := -I$(top)/src -I$(top)/src/include -I$(obj) -I$(top)/src/arch/$(ARCHDIR-y)/include
259INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
Myles Watsone6804952009-08-28 14:36:12 +0000260INCLUDES += -I$(top)/util/x86emu/include
Stefan Reinauerb4d3af82010-02-11 03:21:29 +0000261INCLUDES += -include $(obj)/config.h
Patrick Georgi0588d192009-08-12 15:00:51 +0000262
Patrick Georgie82f4752010-02-10 20:31:38 +0000263CFLAGS = $(INCLUDES) -Os -nostdinc
Patrick Georgi0588d192009-08-12 15:00:51 +0000264CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
Uwe Hermannc04be932009-10-05 13:55:28 +0000265CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
Patrick Georgi88f55b22009-09-25 18:43:02 +0000266CFLAGS += -Wstrict-aliasing -Wshadow
Myles Watson2e672732009-11-12 16:38:03 +0000267ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
268CFLAGS += -Werror
269endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000270CFLAGS += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
271
Patrick Georgi0588d192009-08-12 15:00:51 +0000272CBFS_COMPRESS_FLAG:=l
Myles Watson422d0cb2009-09-23 17:48:28 +0000273CBFS_PAYLOAD_COMPRESS_FLAG:=
274ifeq ($(CONFIG_COMPRESSED_PAYLOAD_LZMA),y)
275CBFS_PAYLOAD_COMPRESS_FLAG:=l
Patrick Georgi0588d192009-08-12 15:00:51 +0000276endif
277
278coreboot: prepare prepare2 $(obj)/coreboot.rom
279
280endif
281
282prepare:
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000283 mkdir -p $(obj)
Patrick Georgi7faf22f2010-02-10 18:50:36 +0000284 mkdir -p $(obj)/util/kconfig/lxdialog $(obj)/util/cbfstool
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000285 test -n "$(alldirs)" && mkdir -p $(alldirs) || true
Patrick Georgi0588d192009-08-12 15:00:51 +0000286
Patrick Georgicccbb892010-01-29 17:38:57 +0000287prepare2: $(obj)/build.h
288
289$(obj)/build.h:
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
Stefan Reinauere3778572010-01-30 09:47:18 +0000304 printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s)\"\n" >> $(obj)/build.ht
Patrick Georgicccbb892010-01-29 17:38:57 +0000305 printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname)\"\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
323 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/auto.inc $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm
324 rmdir -p $(alldirs) 2>/dev/null >/dev/null || true
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000325 $(MAKE) -C util/sconfig clean
Patrick Georgi0588d192009-08-12 15:00:51 +0000326
Patrick Georgi967952a2010-02-09 19:41:11 +0000327clean: clean-for-update
328 rm -f $(obj)/coreboot*
329
Patrick Georgi0588d192009-08-12 15:00:51 +0000330distclean: clean
Myles Watson1af297c2010-01-06 16:59:18 +0000331 rm -rf $(obj)
Patrick Georgi2b7418e2009-08-25 19:38:46 +0000332 rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig*
Patrick Georgi0588d192009-08-12 15:00:51 +0000333
334update:
Myles Watsond4e5c0a2009-10-28 15:30:11 +0000335 dongle.py -c /dev/term/1 $(obj)/coreboot.rom EOF
Patrick Georgi0588d192009-08-12 15:00:51 +0000336
337# This include must come _before_ the pattern rules below!
338# Order _does_ matter for pattern rules.
339include util/kconfig/Makefile
340
341$(obj)/ldoptions: $(obj)/config.h
Patrick Georgi26774f22009-11-21 19:54:02 +0000342 awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@
Patrick Georgi0588d192009-08-12 15:00:51 +0000343
Patrick Georgi26774f22009-11-21 19:54:02 +0000344_OS=$(shell uname -s |cut -c-7)
345STACK=
346ifeq ($(_OS),MINGW32)
347 STACK=-Wl,--stack,16384000
348endif
349ifeq ($(_OS),CYGWIN_)
350 STACK=-Wl,--stack,16384000
351endif
Patrick Georgi0588d192009-08-12 15:00:51 +0000352$(obj)/romcc: $(top)/util/romcc/romcc.c
Uwe Hermann6c73b4412009-10-28 17:10:51 +0000353 @printf " HOSTCC $(subst $(obj)/,,$(@)) (this may take a while)\n"
Uwe Hermann0dd63a22010-02-15 23:24:51 +0000354 @# Note: Adding -O2 here might cause problems. For details see:
355 @# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html
Marc Jones516255e2010-02-13 18:06:29 +0000356 $(HOSTCC) -g $(STACK) -Wall -o $@ $<
Patrick Georgi0588d192009-08-12 15:00:51 +0000357
358.PHONY: $(PHONY) prepare prepare2 clean distclean doxygen doxy coreboot
359