blob: ad9736313961f09bbda8cc201623aca790f137f2 [file] [log] [blame]
Patrick Georgi71b84802011-02-22 14:35:05 +00001##
2## This file is part of the coreboot project.
3##
4## Copyright (C) 2011 secunet Security Networks AG
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; version 2 of the License.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with this program; if not, write to the Free Software
17## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18##
19
20#######################################################################
21# misleadingly named, this is the coreboot version
zbaod51f9742012-07-23 12:11:59 +080022export KERNELVERSION := $(shell if [ -d "$(top)/.git" -a -f "`which git`" ]; then git describe --dirty 2>/dev/null || git describe; else echo unknown; fi)
Patrick Georgi71b84802011-02-22 14:35:05 +000023
24#######################################################################
25# Basic component discovery
Patrick Georgi71b84802011-02-22 14:35:05 +000026MAINBOARDDIR=$(call strip_quotes,$(CONFIG_MAINBOARD_DIR))
27export MAINBOARDDIR
28
Kyösti Mälkki0db2ae3a2012-04-19 12:00:06 +030029## Final build results, which CBFSTOOL uses to create the final
30## rom image file, are placed under $(objcbfs).
31## These typically have suffixes .debug .elf .bin and .map
Stefan Reinauera60ca362012-08-09 11:09:44 -070032export objcbfs := $(obj)/cbfs/$(call strip_quotes,$(CONFIG_CBFS_PREFIX))
Kyösti Mälkki0db2ae3a2012-04-19 12:00:06 +030033
34## Based on the active configuration, Makefile conditionally collects
35## the required assembly includes and saves them in a file.
36## Such files that do not have a clear one-to-one relation to a source
37## file under src/ are placed and built under $(objgenerated)
38export objgenerated := $(obj)/generated
39
Patrick Georgi71b84802011-02-22 14:35:05 +000040#######################################################################
41# root rule to resolve if in build mode (ie. configuration exists)
42real-target: $(obj)/config.h coreboot
Kyösti Mälkki0db2ae3a2012-04-19 12:00:06 +030043coreboot: build-dirs $(obj)/coreboot.rom
Patrick Georgi71b84802011-02-22 14:35:05 +000044
45#######################################################################
46# our phony targets
Kyösti Mälkki0db2ae3a2012-04-19 12:00:06 +030047PHONY+= clean-abuild coreboot lint lint-stable build-dirs
Patrick Georgi71b84802011-02-22 14:35:05 +000048
49#######################################################################
50# root source directories of coreboot
Stefan Reinauer8d711552012-11-30 12:34:04 -080051subdirs-y := src/lib src/console src/device src/ec src/southbridge
Kyösti Mälkki2a830d02011-12-01 17:49:43 +020052subdirs-y += src/northbridge src/superio src/drivers src/cpu src/vendorcode
Patrick Georgi499fc922012-03-09 10:53:52 +010053subdirs-y += util/cbfstool util/sconfig util/nvramtool
Patrick Georgi71b84802011-02-22 14:35:05 +000054subdirs-y += src/arch/$(ARCHDIR-y)
55subdirs-y += src/mainboard/$(MAINBOARDDIR)
56
Patrick Georgia25828d2011-09-02 09:57:01 +020057subdirs-y += site-local
58
Patrick Georgi71b84802011-02-22 14:35:05 +000059#######################################################################
60# Add source classes and their build options
Hung-Te Linfe187922013-02-01 01:09:24 +080061classes-y := ramstage romstage bootblock smm cpu_microcode
Patrick Georgi71b84802011-02-22 14:35:05 +000062
Patrick Georgif33e3952012-11-25 17:10:47 +010063#######################################################################
64# Helper functions for ramstage postprocess
65spc :=
66spc +=
67$(spc) :=
68$(spc) +=
69
70# files-in-dir-recursive,dir,files
71files-in-dir-recursive=$(filter $(1)%,$(2))
72
73# parent-dir,dir/
74parent-dir=$(dir $(subst $( ),/,$(strip $(subst /, ,$(1)))))
75
76# filters out exactly the directory specified
77# filter-out-dir,dir_to_keep,dirs
78filter-out-dir=$(filter-out $(1),$(2))
79
80# filters out dir_to_keep and all its parents
81# filter-out-dirs,dir_to_keep,dirs
82filter-out-dirs=$(if $(filter-out ./,$(1)),$(call filter-out-dirs,$(call parent-dir,$(1)),$(call filter-out-dir,$(1),$(2))),$(call filter-out-dir,$(1),$(2)))
83
84# dir-wildcards,dirs
85dir-wildcards=$(addsuffix %,$(1))
86
87# files-in-dir,dir,files
88files-in-dir=$(filter-out $(call dir-wildcards,$(call filter-out-dirs,$(1),$(dir $(2)))),$(call files-in-dir-recursive,$(1),$(2)))
89
90#######################################################################
91# reduce command line length by linking the objects of each
92# directory into an intermediate file
93ramstage-postprocess=$(foreach d,$(sort $(dir $(1))), \
94 $(eval $(d)ramstage.o: $(call files-in-dir,$(d),$(1)); $$(LD) -o $$@ -r $$^ ) \
95 $(eval ramstage-objs:=$(d)ramstage.o $(filter-out $(call files-in-dir,$(d),$(1)),$(ramstage-objs))))
96
Patrick Georgi71b84802011-02-22 14:35:05 +000097romstage-c-ccopts:=-D__PRE_RAM__
Stefan Reinauer61aee5f2011-04-10 04:15:23 +000098romstage-S-ccopts:=-D__PRE_RAM__
Rudolf Marek7f0e9302011-09-02 23:23:41 +020099ifeq ($(CONFIG_TRACE),y)
100ramstage-c-ccopts:= -finstrument-functions
101endif
Stefan Reinauerd37ab452012-12-18 16:23:28 -0800102ifeq ($(CONFIG_COVERAGE),y)
103ramstage-c-ccopts+=-fprofile-arcs -ftest-coverage
104endif
Rudolf Marek7f0e9302011-09-02 23:23:41 +0200105
Patrick Georgi7e9b9d82012-04-30 21:06:10 +0200106ifeq ($(CONFIG_USE_BLOBS),y)
107forgetthis:=$(shell git submodule update --init --checkout 3rdparty)
Patrick Georgi7e9b9d82012-04-30 21:06:10 +0200108endif
109
Hung-Te Lin5f83f6c2013-02-04 14:38:03 +0800110bootblock-c-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
111bootblock-S-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
Hung-Te Linfe187922013-02-01 01:09:24 +0800112
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000113smm-c-ccopts:=-D__SMM__
114smm-S-ccopts:=-D__SMM__
Patrick Georgi71b84802011-02-22 14:35:05 +0000115
Stefan Reinauer3aa067f2012-04-02 13:24:04 -0700116# SMM TSEG base is dynamic
117ifeq ($(CONFIG_SMM_TSEG),y)
118smm-c-ccopts += -fpic
119endif
120
Patrick Georgi57205c72011-03-08 20:49:18 +0000121ramstage-c-deps:=$$(OPTION_TABLE_H)
122romstage-c-deps:=$$(OPTION_TABLE_H)
Hung-Te Linfe187922013-02-01 01:09:24 +0800123bootblock-c-deps:=$$(OPTION_TABLE_H)
Patrick Georgi57205c72011-03-08 20:49:18 +0000124
Patrick Georgi71b84802011-02-22 14:35:05 +0000125#######################################################################
126# Add handler to compile ACPI's ASL
127define ramstage-objs_asl_template
Sven Schnelled69438e2011-03-29 09:01:10 +0000128$(obj)/$(1).ramstage.o: src/$(1).asl $(obj)/config.h
Patrick Georgi71b84802011-02-22 14:35:05 +0000129 @printf " IASL $$(subst $(top)/,,$$(@))\n"
Patrick Georgic0e16e72012-05-05 15:11:22 +0200130 $(CC) -x assembler-with-cpp -E -MMD -MT $$(@) -D__ACPI__ -P -include $(src)/include/kconfig.h -I$(obj) -I$(src) -I$(src)/include -I$(src)/arch/$(ARCHDIR-y)/include -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$(basename $$@).asl
Marc Jones2aac3f62011-08-08 16:07:50 -0600131 cd $$(dir $$@); $(IASL) -p $$(notdir $$@) -tc $$(notdir $$(basename $$@)).asl
Patrick Georgib2a42642011-06-01 19:54:16 +0000132 mv $$(basename $$@).hex $$(basename $$@).c
Patrick Georgi71b84802011-02-22 14:35:05 +0000133 $(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $(1)))), -DAmlCode=AmlCode_$$(basename $$(notdir $(1)))) -c -o $$@ $$(basename $$@).c
134 # keep %.o: %.c rule from catching the temporary .c file after a make clean
135 mv $$(basename $$@).c $$(basename $$@).hex
136endef
137
138#######################################################################
Patrick Georgi3bbd2bf2012-03-09 12:30:07 +0100139# Parse plaintext cmos defaults into binary format
140# arg1: source file
141# arg2: binary file name
142cbfs-files-processor-nvramtool= \
143 $(eval $(2): $(1) $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout | $(objutil)/nvramtool/nvramtool ; \
144 printf " CREATE $(2) (from $(1))\n"; $(objutil)/nvramtool/nvramtool -y $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout -D $(2).tmp -p $(1) && mv $(2).tmp $(2))
145
146#######################################################################
Patrick Georgi843005c2012-04-30 23:15:17 +0200147# Link VSA binary to ELF-ish stage
148# arg1: source file
149# arg2: binary file name
150cbfs-files-processor-vsa= \
151 $(eval $(2): $(1) ; \
152 printf " CREATE $(2) (from $(1))\n"; $(OBJCOPY) --set-start 0x20 --adjust-vma 0x60000 -I binary -O elf32-i386 -B i386 $(1) $(2).tmp && $(LD) -m elf_i386 -e 0x60020 --section-start .data=0x60000 $(2).tmp -o $(2))
153
154#######################################################################
Patrick Georgi71b84802011-02-22 14:35:05 +0000155# Add handler for arbitrary files in CBFS
156$(call add-special-class,cbfs-files)
157cbfs-files-handler= \
Patrick Georgi3bbd2bf2012-03-09 12:30:07 +0100158 $(eval tmp-cbfs-method:=$(word 2, $(subst :, ,$($(2)-file)))) \
Patrick Georgi1fc2bda2012-11-15 14:51:54 +0100159 $(eval $(2)-file:=$(call strip_quotes,$(word 1, $(subst :, ,$($(2)-file))))) \
Patrick Georgi71b84802011-02-22 14:35:05 +0000160 $(if $(wildcard $(1)$($(2)-file)), \
161 $(eval tmp-cbfs-file:= $(wildcard $(1)$($(2)-file))), \
162 $(eval tmp-cbfs-file:= $($(2)-file))) \
Patrick Georgi70c85ea2013-02-16 01:06:57 +0100163 $(if $(strip $($(2)-required)), \
164 $(if $(wildcard $(tmp-cbfs-file)),, \
165 $(info This build configuration requires $($(2)-required)) \
166 $(eval FAILBUILD:=1) \
167 )) \
Patrick Georgi3bbd2bf2012-03-09 12:30:07 +0100168 $(if $(tmp-cbfs-method), \
169 $(eval tmp-old-cbfs-file:=$(tmp-cbfs-file)) \
Patrick Georgi16c7ad72012-09-21 18:11:59 +0200170 $(eval tmp-cbfs-file:=$(shell mkdir -p $(obj)/mainboard/$(MAINBOARDDIR); mktemp $(obj)/mainboard/$(MAINBOARDDIR)/cbfs-file.XXXXXX).out) \
Patrick Georgi3bbd2bf2012-03-09 12:30:07 +0100171 $(call cbfs-files-processor-$(tmp-cbfs-method),$(tmp-old-cbfs-file),$(tmp-cbfs-file))) \
Dave Frodin0013bbf2012-08-14 11:01:53 -0600172 $(eval cbfs-files += $(tmp-cbfs-file)|$(2)|$($(2)-type)|$($(2)-compression)|$($(2)-position)) \
Patrick Georgi71b84802011-02-22 14:35:05 +0000173 $(eval $(2)-name:=) \
174 $(eval $(2)-type:=) \
Dave Frodin0013bbf2012-08-14 11:01:53 -0600175 $(eval $(2)-compression:=) \
Patrick Georgi70c85ea2013-02-16 01:06:57 +0100176 $(eval $(2)-position:=) \
177 $(eval $(2)-required:=)
Patrick Georgi71b84802011-02-22 14:35:05 +0000178
179#######################################################################
180# a variety of flags for our build
Stefan Reinauer63217582012-10-29 16:52:36 -0700181CBFS_COMPRESS_FLAG:=none
Sven Schnelle8eee19d2011-05-02 19:53:04 +0000182ifeq ($(CONFIG_COMPRESS_RAMSTAGE),y)
Stefan Reinauer63217582012-10-29 16:52:36 -0700183CBFS_COMPRESS_FLAG:=LZMA
Sven Schnelle8eee19d2011-05-02 19:53:04 +0000184endif
185
Stefan Reinauer63217582012-10-29 16:52:36 -0700186CBFS_PAYLOAD_COMPRESS_FLAG:=none
Patrick Georgi71b84802011-02-22 14:35:05 +0000187ifeq ($(CONFIG_COMPRESSED_PAYLOAD_LZMA),y)
Stefan Reinauer63217582012-10-29 16:52:36 -0700188CBFS_PAYLOAD_COMPRESS_FLAG:=LZMA
Patrick Georgi71b84802011-02-22 14:35:05 +0000189endif
190
191ifneq ($(CONFIG_LOCALVERSION),"")
192COREBOOT_EXTRA_VERSION := -$(call strip_quotes,$(CONFIG_LOCALVERSION))
193endif
194
195INCLUDES := -Isrc -Isrc/include -I$(obj) -Isrc/arch/$(ARCHDIR-y)/include
Stefan Reinauer8d711552012-11-30 12:34:04 -0800196INCLUDES += -Isrc/device/oprom/include
Patrick Georgi71b84802011-02-22 14:35:05 +0000197# abspath is a workaround for romcc
Patrick Georgic0e16e72012-05-05 15:11:22 +0200198INCLUDES += -include $(src)/include/kconfig.h
Patrick Georgi71b84802011-02-22 14:35:05 +0000199
Frank Vibransec402602011-05-05 16:45:36 +0000200CFLAGS = $(INCLUDES) -Os -pipe -g -nostdinc
Patrick Georgi71b84802011-02-22 14:35:05 +0000201CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
202CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
203CFLAGS += -Wstrict-aliasing -Wshadow
204ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
205CFLAGS += -Werror
206endif
Patrick Georgi71b84802011-02-22 14:35:05 +0000207CFLAGS += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
208
Stefan Reinauer5b635792012-08-16 14:05:42 -0700209additional-dirs := $(objutil)/cbfstool $(objutil)/romcc $(objutil)/ifdtool $(objutil)/options
Patrick Georgi71b84802011-02-22 14:35:05 +0000210
211#######################################################################
212# generate build support files
213$(obj)/build.h: .xcompile
214 @printf " GEN build.h\n"
215 rm -f $(obj)/build.h
216 printf "/* build system definitions (autogenerated) */\n" > $(obj)/build.ht
217 printf "#ifndef __BUILD_H\n" >> $(obj)/build.ht
218 printf "#define __BUILD_H\n\n" >> $(obj)/build.ht
Patrick Georgib8e9ba92011-03-17 07:47:49 +0000219 printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" >> $(obj)/build.ht
Patrick Georgi71b84802011-02-22 14:35:05 +0000220 printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.ht
221 printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
Zheng Bao0e6d0ed2012-11-09 19:55:04 +0800222 printf "#define COREBOOT_BUILD_YEAR_BCD 0x`LANG= date +"%y"`\n" >> $(obj)/build.ht
223 printf "#define COREBOOT_BUILD_MONTH_BCD 0x`LANG= date +"%m"`\n" >> $(obj)/build.ht
224 printf "#define COREBOOT_BUILD_DAY_BCD 0x`LANG= date +"%d"`\n" >> $(obj)/build.ht
225 printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x`LANG= date +"%w"`\n" >> $(obj)/build.ht
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200226 printf "#define COREBOOT_DMI_DATE \"`LANG= date +"%m/%d/%Y"`\"\n" >> $(obj)/build.ht
Patrick Georgi71b84802011-02-22 14:35:05 +0000227 printf "\n" >> $(obj)/build.ht
228 printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.ht
229 printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | head -n1)\"\n" >> $(obj)/build.ht
230 printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.ht
231 printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
232 printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
Zheng Bao86aa7c42012-09-28 16:06:44 +0800233 printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s 2>/dev/null || hostname 2>/dev/null)\"\n" >> $(obj)/build.ht
Patrick Georgi71b84802011-02-22 14:35:05 +0000234 printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname 2>/dev/null)\"\n" >> $(obj)/build.ht
235 printf "#endif\n" >> $(obj)/build.ht
236 mv $(obj)/build.ht $(obj)/build.h
237
238$(obj)/ldoptions: $(obj)/config.h
239 awk '/^#define ([^"])* ([^"])*$$/ {gsub("\\r","",$$3); print $$2 " = " $$3 ";";}' $< > $@
240
Kyösti Mälkki0db2ae3a2012-04-19 12:00:06 +0300241build-dirs:
242 mkdir -p $(objcbfs) $(objgenerated)
243
Patrick Georgi71b84802011-02-22 14:35:05 +0000244#######################################################################
245# Build the tools
246CBFSTOOL:=$(obj)/cbfstool
247
248$(CBFSTOOL): $(objutil)/cbfstool/cbfstool
249 cp $< $@
250
251_WINCHECK=$(shell uname -o 2> /dev/null)
252STACK=
253ifeq ($(_WINCHECK),Msys)
254 STACK=-Wl,--stack,16384000
255endif
256ifeq ($(_WINCHECK),Cygwin)
257 STACK=-Wl,--stack,16384000
258endif
259
260ROMCC:= $(objutil)/romcc/romcc
261$(ROMCC): $(top)/util/romcc/romcc.c
262 @printf " HOSTCC $(subst $(obj)/,,$(@)) (this may take a while)\n"
263 @# Note: Adding -O2 here might cause problems. For details see:
264 @# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html
265 $(HOSTCC) -g $(STACK) -Wall -o $@ $<
266
Stefan Reinauer5b635792012-08-16 14:05:42 -0700267IFDTOOL:=$(objutil)/ifdtool/ifdtool
268$(IFDTOOL): $(top)/util/ifdtool/ifdtool.c
269 @printf " HOSTCC $(subst $(obj)/,,$(@))\n"
270 $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
271
Patrick Georgi71b84802011-02-22 14:35:05 +0000272#######################################################################
273# needed objects that every mainboard uses
274# Creation of these is architecture and mainboard independent
275$(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(objutil)/sconfig/sconfig
276 @printf " SCONFIG $(subst $(src)/,,$(<))\n"
277 mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
278 $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR)
279
280ramstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
Stefan Reinauer57879c92012-07-31 16:47:25 -0700281romstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
Patrick Georgi71b84802011-02-22 14:35:05 +0000282
283$(objutil)/%.o: $(objutil)/%.c
284 @printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
285 $(HOSTCC) -MMD -I$(subst $(objutil)/,util/,$(dir $<)) -I$(dir $<) $(HOSTCFLAGS) -c -o $@ $<
286
Patrick Georgi64ccc3b82011-05-20 23:08:12 +0000287$(obj)/%.ramstage.o $(abspath $(obj))/%.ramstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
Patrick Georgi71b84802011-02-22 14:35:05 +0000288 @printf " CC $(subst $(obj)/,,$(@))\n"
289 $(CC) -MMD $(CFLAGS) -c -o $@ $<
290
Stefan Reinauer57879c92012-07-31 16:47:25 -0700291$(obj)/%.romstage.o $(abspath $(obj))/%.romstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
292 @printf " CC $(subst $(obj)/,,$(@))\n"
293 $(CC) -MMD -D__PRE_RAM__ $(CFLAGS) -c -o $@ $<
294
Hung-Te Linfe187922013-02-01 01:09:24 +0800295$(obj)/%.bootblock.o $(abspath $(obj))/%.bootblock.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
296 @printf " CC $(subst $(obj)/,,$(@))\n"
Hung-Te Lin5f83f6c2013-02-04 14:38:03 +0800297 $(CC) -MMD $(bootblock-c-ccopts) $(CFLAGS) -c -o $@ $<
Hung-Te Linfe187922013-02-01 01:09:24 +0800298
Patrick Georgi71b84802011-02-22 14:35:05 +0000299#######################################################################
300# Clean up rules
301clean-abuild:
302 rm -rf coreboot-builds
303
304clean-for-update-target:
305 rm -f $(obj)/coreboot_ram* $(obj)/coreboot.romstage $(obj)/coreboot.pre* $(obj)/coreboot.bootblock $(obj)/coreboot.a
306 rm -rf $(obj)/bootblock* $(obj)/romstage* $(obj)/location.*
307 rm -f $(obj)/option_table.* $(obj)/crt0.S $(obj)/ldscript
308 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/static.c $(obj)/mainboard/$(MAINBOARDDIR)/config.py $(obj)/mainboard/$(MAINBOARDDIR)/static.dot
309 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s $(obj)/mainboard/$(MAINBOARDDIR)/crt0.disasm
310 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc
311 rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/mainboard/$(MAINBOARDDIR)/dsdt.*
312 rm -f $(obj)/cpu/x86/smm/smm_bin.c $(obj)/cpu/x86/smm/smm.* $(obj)/cpu/x86/smm/smm
Marc Jones1dd0dda2012-03-19 17:32:33 -0600313 $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc clean OUT=$(abspath $(obj)) HOSTCC="$(HOSTCC)" CC="$(CC)" LD="$(LD)"
Patrick Georgi71b84802011-02-22 14:35:05 +0000314
315clean-target:
316 rm -f $(obj)/coreboot*
317
318#######################################################################
319# Development utilities
320printcrt0s:
321 @echo crt0s=$(crt0s)
322 @echo ldscripts=$(ldscripts)
323
324update:
325 dongle.py -c /dev/term/1 $(obj)/coreboot.rom EOF
326
Patrick Georgicb02cb72012-02-25 19:42:59 +0100327lint lint-stable:
Zheng Bao533bca82012-09-28 19:38:37 +0800328 FAILED=0; LINTLOG=`mktemp .tmpconfig.lintXXXXX`; \
Patrick Georgicb02cb72012-02-25 19:42:59 +0100329 for script in util/lint/$@-*; do \
Patrick Georgi71b84802011-02-22 14:35:05 +0000330 echo; echo `basename $$script`; \
331 grep "^# DESCR:" $$script | sed "s,.*DESCR: *,," ; \
332 echo ========; \
333 $$script > $$LINTLOG; \
Patrick Georgic040e4762012-03-09 23:02:09 +0100334 if [ `cat $$LINTLOG | wc -l` -eq 0 ]; then \
Patrick Georgi71b84802011-02-22 14:35:05 +0000335 printf "success\n\n"; \
336 else \
337 echo test failed: ; \
338 cat $$LINTLOG; \
339 rm -f $$LINTLOG; \
340 FAILED=$$(( $$FAILED + 1 )); \
341 fi; \
342 echo ========; \
343 done; \
344 test $$FAILED -eq 0 || { echo "ERROR: $$FAILED test(s) failed." && exit 1; }; \
345 rm -f $$LINTLOG
Patrick Georgi6c445502011-05-16 15:32:28 +0000346
Patrick Georgibb605282011-06-05 15:15:49 +0200347gitconfig:
Zheng Bao50ad0952012-10-22 16:29:37 +0800348 mkdir -p .git/hooks
zbaof2c32542012-08-10 15:44:02 +0800349 for hook in commit-msg pre-commit ; do \
350 if [ util/gitconfig/$$hook -nt .git/hooks/$$hook -o \
351 ! -x .git/hooks/$$hook ]; then \
352 cp util/gitconfig/$$hook .git/hooks/$$hook; \
353 chmod +x .git/hooks/$$hook; \
354 fi; \
355 done
Ronald G. Minnich64b364d2013-01-03 08:26:09 -0800356 git config remote.origin.push HEAD:refs/for/master
Patrick Georgibb605282011-06-05 15:15:49 +0200357 (git config --global user.name >/dev/null && git config --global user.email >/dev/null) || (printf 'Please configure your name and email in git:\n\n git config --global user.name "Your Name Comes Here"\n git config --global user.email your.email@example.com\n'; exit 1)
358
Patrick Georgi6c445502011-05-16 15:32:28 +0000359crossgcc: clean-for-update
Peter Stuge0b6b4d62011-06-09 05:06:25 +0200360 $(MAKE) -C util/crossgcc build-without-gdb
361
362crosstools: clean-for-update
Patrick Georgi6c445502011-05-16 15:32:28 +0000363 $(MAKE) -C util/crossgcc build
364
365crossgcc-clean: clean-for-update
366 $(MAKE) -C util/crossgcc clean
367
Patrick Georgi43105d62011-11-05 14:44:41 +0100368tools: $(objutil)/kconfig/conf $(objutil)/cbfstool/cbfstool $(objutil)/nvramtool/nvramtool $(objutil)/romcc/romcc $(objutil)/sconfig/sconfig
369