2009-08-12 17:00:51 +02:00
|
|
|
##
|
|
|
|
## This file is part of the coreboot project.
|
|
|
|
##
|
|
|
|
## Copyright (C) 2008 Advanced Micro Devices, Inc.
|
|
|
|
## Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de>
|
2010-01-19 22:13:44 +01:00
|
|
|
## Copyright (C) 2009-2010 coresystems GmbH
|
2011-02-22 15:35:05 +01:00
|
|
|
## Copyright (C) 2011 secunet Security Networks AG
|
2009-08-12 17:00:51 +02:00
|
|
|
##
|
2011-06-30 15:48:57 +02:00
|
|
|
## Redistribution and use in source and binary forms, with or without
|
|
|
|
## modification, are permitted provided that the following conditions
|
|
|
|
## are met:
|
|
|
|
## 1. Redistributions of source code must retain the above copyright
|
|
|
|
## notice, this list of conditions and the following disclaimer.
|
|
|
|
## 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
## notice, this list of conditions and the following disclaimer in the
|
|
|
|
## documentation and/or other materials provided with the distribution.
|
|
|
|
## 3. The name of the author may not be used to endorse or promote products
|
|
|
|
## derived from this software without specific prior written permission.
|
2009-08-12 17:00:51 +02:00
|
|
|
##
|
2011-06-30 15:48:57 +02:00
|
|
|
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
## ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
## SUCH DAMAGE.
|
2009-08-12 17:00:51 +02:00
|
|
|
##
|
|
|
|
|
2010-03-14 22:25:03 +01:00
|
|
|
ifeq ($(INNER_SCANBUILD),y)
|
|
|
|
CC_real:=$(CC)
|
|
|
|
endif
|
2010-03-16 02:17:19 +01:00
|
|
|
|
2011-10-08 01:20:30 +02:00
|
|
|
$(if $(wildcard .xcompile),,$(eval $(shell bash util/xcompile/xcompile $(XGCCPATH) > .xcompile)))
|
2009-08-12 17:00:51 +02:00
|
|
|
include .xcompile
|
2010-03-16 02:17:19 +01:00
|
|
|
|
2010-03-14 22:25:03 +01:00
|
|
|
ifeq ($(INNER_SCANBUILD),y)
|
|
|
|
CC:=$(CC_real)
|
|
|
|
HOSTCC:=$(CC_real) --hostcc
|
|
|
|
HOSTCXX:=$(CC_real) --hostcxx
|
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2010-09-28 23:11:48 +02:00
|
|
|
export top := $(CURDIR)
|
2010-03-27 18:18:39 +01:00
|
|
|
export src := src
|
2009-08-12 17:00:51 +02:00
|
|
|
export srck := $(top)/util/kconfig
|
2010-03-27 18:18:39 +01:00
|
|
|
export obj ?= build
|
2010-04-17 00:48:57 +02:00
|
|
|
export objutil ?= $(obj)/util
|
|
|
|
export objk := $(objutil)/kconfig
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
export KCONFIG_AUTOHEADER := $(obj)/config.h
|
|
|
|
export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
|
|
|
|
|
2011-03-01 09:09:22 +01:00
|
|
|
# directory containing the toplevel Makefile.inc
|
|
|
|
TOPLEVEL := .
|
|
|
|
|
2009-08-12 17:00:51 +02:00
|
|
|
CONFIG_SHELL := sh
|
|
|
|
KBUILD_DEFCONFIG := configs/defconfig
|
|
|
|
UNAME_RELEASE := $(shell uname -r)
|
2010-12-08 20:58:30 +01:00
|
|
|
DOTCONFIG ?= .config
|
|
|
|
KCONFIG_CONFIG = $(DOTCONFIG)
|
|
|
|
export KCONFIG_CONFIG
|
|
|
|
HAVE_DOTCONFIG := $(wildcard $(DOTCONFIG))
|
2009-08-12 17:00:51 +02:00
|
|
|
MAKEFLAGS += -rR --no-print-directory
|
|
|
|
|
|
|
|
# Make is silent per default, but 'make V=1' will show all compiler calls.
|
2009-08-25 21:38:46 +02:00
|
|
|
Q:=@
|
2009-08-12 17:00:51 +02:00
|
|
|
ifneq ($(V),1)
|
2009-08-25 21:38:46 +02:00
|
|
|
ifneq ($(Q),)
|
|
|
|
.SILENT:
|
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
HOSTCC = gcc
|
|
|
|
HOSTCXX = g++
|
2012-09-13 22:13:33 +02:00
|
|
|
HOSTCFLAGS := -g
|
|
|
|
HOSTCXXFLAGS := -g
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
DOXYGEN := doxygen
|
|
|
|
DOXYGEN_OUTPUT_DIR := doxygen
|
|
|
|
|
2011-02-22 15:35:05 +01:00
|
|
|
all: real-all
|
|
|
|
|
2011-03-01 09:09:22 +01:00
|
|
|
# This include must come _before_ the pattern rules below!
|
2011-02-22 15:35:05 +01:00
|
|
|
# Order _does_ matter for pattern rules.
|
|
|
|
include util/kconfig/Makefile
|
|
|
|
|
2010-04-21 08:36:20 +02:00
|
|
|
# Three cases where we don't need fully populated $(obj) lists:
|
|
|
|
# 1. when no .config exists
|
|
|
|
# 2. when make config (in any flavour) is run
|
|
|
|
# 3. when make distclean is run
|
|
|
|
# Don't waste time on reading all Makefile.incs in these cases
|
2009-08-12 17:00:51 +02:00
|
|
|
ifeq ($(strip $(HAVE_DOTCONFIG)),)
|
2010-04-21 08:36:20 +02:00
|
|
|
NOCOMPILE:=1
|
|
|
|
endif
|
|
|
|
ifneq ($(MAKECMDGOALS),)
|
2014-04-26 15:29:10 +02:00
|
|
|
ifneq ($(filter %config %clean cross%,$(MAKECMDGOALS)),)
|
2010-04-21 08:36:20 +02:00
|
|
|
NOCOMPILE:=1
|
|
|
|
endif
|
2013-02-09 15:45:02 +01:00
|
|
|
ifeq ($(MAKECMDGOALS), %clean)
|
2012-10-22 10:36:03 +02:00
|
|
|
NOMKDIR:=1
|
|
|
|
endif
|
2010-04-21 08:36:20 +02:00
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2010-04-21 08:36:20 +02:00
|
|
|
ifeq ($(NOCOMPILE),1)
|
2011-03-01 09:09:22 +01:00
|
|
|
include $(TOPLEVEL)/Makefile.inc
|
2011-02-22 15:35:05 +01:00
|
|
|
real-all: config
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2010-09-25 00:15:54 +02:00
|
|
|
include $(HAVE_DOTCONFIG)
|
2009-08-12 17:00:51 +02:00
|
|
|
|
Introduce stage-specific architecture for coreboot
Make all three coreboot stages (bootblock, romstage and ramstage) aware of the
architecture specific to that stage i.e. we will have CONFIG_ARCH variables for
each of the three stages. This allows us to have an SOC with any combination of
architectures and thus every stage can be made to run on a completely different
architecture independent of others. Thus, bootblock can have an x86 arch whereas
romstage and ramstage can have arm32 and arm64 arch respectively. These stage
specific CONFIG_ARCH_ variables enable us to select the proper set of toolchain
and compiler flags for every stage.
These options can be considered as either arch or modes eg: x86 running in
different modes or ARM having different arch types (v4, v7, v8). We have got rid
of the original CONFIG_ARCH option completely as every stage can have any
architecture of its own. Thus, almost all the components of coreboot are
identified as being part of one of the three stages (bootblock, romstage or
ramstage). The components which cannot be classified as such e.g. smm, rmodules
can have their own compiler toolset which is for now set to *_i386. Hence, all
special classes are treated in a similar way and the compiler toolset is defined
using create_class_compiler defined in Makefile.
In order to meet these requirements, changes have been made to CC, LD, OBJCOPY
and family to add CC_bootblock, CC_romstage, CC_ramstage and similarly others.
Additionally, CC_x86_32 and CC_armv7 handle all the special classes. All the
toolsets are defined using create_class_compiler.
Few additional macros have been introduced to identify the class to be used at
various points, e.g.: CC_$(class) derives the $(class) part from the name of
the stage being compiled.
We have also got rid of COREBOOT_COMPILER, COREBOOT_ASSEMBLER and COREBOOT_LINKER
as they do not make any sense for coreboot as a whole. All these attributes are
associated with each of the stages.
Change-Id: I923f3d4fb097d21071030b104c372cc138c68c7b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: http://review.coreboot.org/5577
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
2014-04-23 19:18:48 +02:00
|
|
|
include toolchain.inc
|
2012-11-26 23:33:09 +01:00
|
|
|
|
2010-03-16 02:17:19 +01:00
|
|
|
ifneq ($(INNER_SCANBUILD),y)
|
|
|
|
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
2012-03-11 20:44:22 +01:00
|
|
|
CC:=clang -m32 -mno-mmx -mno-sse
|
2010-03-16 02:17:19 +01:00
|
|
|
HOSTCC:=clang
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-03-25 22:45:25 +01:00
|
|
|
ifeq ($(CONFIG_CCACHE),y)
|
2011-05-21 00:14:07 +02:00
|
|
|
CCACHE:=$(word 1,$(wildcard $(addsuffix /ccache,$(subst :, ,$(PATH)))))
|
2010-03-25 22:45:25 +01:00
|
|
|
ifeq ($(CCACHE),)
|
|
|
|
$(error ccache selected, but not found in PATH)
|
|
|
|
endif
|
2010-09-25 00:15:54 +02:00
|
|
|
CCACHE:=CCACHE_COMPILERCHECK=content CCACHE_BASEDIR=$(top) $(CCACHE)
|
2010-03-25 22:45:25 +01:00
|
|
|
CC := $(CCACHE) $(CC)
|
|
|
|
HOSTCC := $(CCACHE) $(HOSTCC)
|
|
|
|
HOSTCXX := $(CCACHE) $(HOSTCXX)
|
|
|
|
ROMCC := $(CCACHE) $(ROMCC)
|
|
|
|
endif
|
|
|
|
|
2010-03-16 20:01:32 +01:00
|
|
|
strip_quotes = $(subst ",,$(subst \",,$(1)))
|
|
|
|
|
2009-08-12 17:00:51 +02:00
|
|
|
# The primary target needs to be here before we include the
|
|
|
|
# other files
|
|
|
|
|
2010-03-14 22:25:03 +01:00
|
|
|
ifeq ($(INNER_SCANBUILD),y)
|
|
|
|
CONFIG_SCANBUILD_ENABLE:=
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_SCANBUILD_ENABLE),y)
|
|
|
|
ifneq ($(CONFIG_SCANBUILD_REPORT_LOCATION),)
|
|
|
|
CONFIG_SCANBUILD_REPORT_LOCATION:=-o $(CONFIG_SCANBUILD_REPORT_LOCATION)
|
|
|
|
endif
|
2011-02-22 15:35:05 +01:00
|
|
|
real-all:
|
2010-03-14 22:25:03 +01:00
|
|
|
echo '#!/bin/sh' > .ccwrap
|
|
|
|
echo 'CC="$(CC)"' >> .ccwrap
|
|
|
|
echo 'if [ "$$1" = "--hostcc" ]; then shift; CC="$(HOSTCC)"; fi' >> .ccwrap
|
|
|
|
echo 'if [ "$$1" = "--hostcxx" ]; then shift; CC="$(HOSTCXX)"; fi' >> .ccwrap
|
|
|
|
echo 'eval $$CC $$*' >> .ccwrap
|
|
|
|
chmod +x .ccwrap
|
|
|
|
scan-build $(CONFIG_SCANBUILD_REPORT_LOCATION) -analyze-headers --use-cc=$(top)/.ccwrap --use-c++=$(top)/.ccwrap $(MAKE) INNER_SCANBUILD=y
|
|
|
|
else
|
2011-02-22 15:35:05 +01:00
|
|
|
real-all: real-target
|
2010-03-14 22:25:03 +01:00
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2010-03-27 18:18:39 +01:00
|
|
|
# must come rather early
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
2010-03-21 23:35:58 +01:00
|
|
|
$(obj)/config.h:
|
|
|
|
$(MAKE) oldconfig
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2011-02-17 21:47:49 +01:00
|
|
|
# Add a new class of source/object files to the build system
|
|
|
|
add-class= \
|
|
|
|
$(eval $(1)-srcs:=) \
|
|
|
|
$(eval $(1)-objs:=) \
|
|
|
|
$(eval classes+=$(1))
|
|
|
|
|
|
|
|
# Special classes are managed types with special behaviour
|
|
|
|
# On parse time, for each entry in variable $(1)-y
|
|
|
|
# a handler $(1)-handler is executed with the arguments:
|
|
|
|
# * $(1): directory the parser is in
|
|
|
|
# * $(2): current entry
|
|
|
|
add-special-class= \
|
|
|
|
$(eval $(1):=) \
|
|
|
|
$(eval special-classes+=$(1))
|
|
|
|
|
2010-03-06 22:18:43 +01:00
|
|
|
# Clean -y variables, include Makefile.inc
|
2010-09-30 18:55:02 +02:00
|
|
|
# Add paths to files in X-y to X-srcs
|
2010-03-06 22:18:43 +01:00
|
|
|
# Add subdirs-y to subdirs
|
|
|
|
includemakefiles= \
|
2011-02-17 21:47:49 +01:00
|
|
|
$(foreach class,classes subdirs $(classes) $(special-classes), $(eval $(class)-y:=)) \
|
2010-03-06 22:18:43 +01:00
|
|
|
$(eval -include $(1)) \
|
2011-02-17 21:47:49 +01:00
|
|
|
$(foreach class,$(classes-y), $(call add-class,$(class))) \
|
|
|
|
$(foreach class,$(classes), \
|
|
|
|
$(eval $(class)-srcs+= \
|
2010-03-27 18:18:39 +01:00
|
|
|
$$(subst $(top)/,, \
|
2011-05-21 01:31:41 +02:00
|
|
|
$$(abspath $$(subst $(dir $(1))/,/,$$(addprefix $(dir $(1)),$$($(class)-y))))))) \
|
2011-02-17 21:47:49 +01:00
|
|
|
$(foreach special,$(special-classes), \
|
|
|
|
$(foreach item,$($(special)-y), $(call $(special)-handler,$(dir $(1)),$(item)))) \
|
2010-09-28 23:11:48 +02:00
|
|
|
$(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
|
2010-03-06 22:18:43 +01:00
|
|
|
|
2010-09-30 18:55:02 +02:00
|
|
|
# For each path in $(subdirs) call includemakefiles
|
2010-03-06 22:18:43 +01:00
|
|
|
# Repeat until subdirs is empty
|
|
|
|
evaluate_subdirs= \
|
|
|
|
$(eval cursubdirs:=$(subdirs)) \
|
|
|
|
$(eval subdirs:=) \
|
|
|
|
$(foreach dir,$(cursubdirs), \
|
2011-02-17 21:47:49 +01:00
|
|
|
$(eval $(call includemakefiles,$(dir)/Makefile.inc))) \
|
2010-03-27 18:18:39 +01:00
|
|
|
$(if $(subdirs),$(eval $(call evaluate_subdirs)))
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
# collect all object files eligible for building
|
2011-03-01 09:09:22 +01:00
|
|
|
subdirs:=$(TOPLEVEL)
|
2010-03-27 18:18:39 +01:00
|
|
|
$(eval $(call evaluate_subdirs))
|
2013-02-16 01:06:57 +01:00
|
|
|
ifeq ($(FAILBUILD),1)
|
|
|
|
$(error cannot continue build)
|
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2011-10-25 23:32:21 +02:00
|
|
|
# Eliminate duplicate mentions of source files in a class
|
|
|
|
$(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
|
|
|
|
|
2010-09-30 18:55:02 +02:00
|
|
|
src-to-obj=$(addsuffix .$(1).o, $(basename $(patsubst src/%, $(obj)/%, $($(1)-srcs))))
|
2011-02-17 21:47:49 +01:00
|
|
|
$(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class))))
|
2010-09-30 18:55:02 +02:00
|
|
|
|
2013-05-15 11:47:51 +02:00
|
|
|
# Save all objs before processing them (for dependency inclusion)
|
|
|
|
originalobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
|
|
|
|
|
2012-11-25 14:31:08 +01:00
|
|
|
# Call post-processors if they're defined
|
|
|
|
$(foreach class,$(classes),\
|
|
|
|
$(if $(value $(class)-postprocess),$(eval $(call $(class)-postprocess,$($(class)-objs)))))
|
|
|
|
|
2011-02-17 21:47:49 +01:00
|
|
|
allsrcs:=$(foreach var, $(addsuffix -srcs,$(classes)), $($(var)))
|
|
|
|
allobjs:=$(foreach var, $(addsuffix -objs,$(classes)), $($(var)))
|
2009-08-12 17:00:51 +02:00
|
|
|
alldirs:=$(sort $(abspath $(dir $(allobjs))))
|
|
|
|
|
2010-03-16 13:01:13 +01:00
|
|
|
# macro to define template macros that are used by use_template macro
|
|
|
|
define create_cc_template
|
2011-02-22 15:35:05 +01:00
|
|
|
# $1 obj class
|
2010-03-16 13:01:13 +01:00
|
|
|
# $2 source suffix (c, S)
|
2010-09-30 18:55:02 +02:00
|
|
|
# $3 additional compiler flags
|
2011-03-08 21:49:18 +01:00
|
|
|
# $4 additional dependencies
|
2011-02-17 21:48:45 +01:00
|
|
|
ifn$(EMPTY)def $(1)-objs_$(2)_template
|
2010-09-30 18:55:02 +02:00
|
|
|
de$(EMPTY)fine $(1)-objs_$(2)_template
|
2011-03-08 21:49:18 +01:00
|
|
|
$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4)
|
2010-04-19 22:39:22 +02:00
|
|
|
@printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
|
Introduce stage-specific architecture for coreboot
Make all three coreboot stages (bootblock, romstage and ramstage) aware of the
architecture specific to that stage i.e. we will have CONFIG_ARCH variables for
each of the three stages. This allows us to have an SOC with any combination of
architectures and thus every stage can be made to run on a completely different
architecture independent of others. Thus, bootblock can have an x86 arch whereas
romstage and ramstage can have arm32 and arm64 arch respectively. These stage
specific CONFIG_ARCH_ variables enable us to select the proper set of toolchain
and compiler flags for every stage.
These options can be considered as either arch or modes eg: x86 running in
different modes or ARM having different arch types (v4, v7, v8). We have got rid
of the original CONFIG_ARCH option completely as every stage can have any
architecture of its own. Thus, almost all the components of coreboot are
identified as being part of one of the three stages (bootblock, romstage or
ramstage). The components which cannot be classified as such e.g. smm, rmodules
can have their own compiler toolset which is for now set to *_i386. Hence, all
special classes are treated in a similar way and the compiler toolset is defined
using create_class_compiler defined in Makefile.
In order to meet these requirements, changes have been made to CC, LD, OBJCOPY
and family to add CC_bootblock, CC_romstage, CC_ramstage and similarly others.
Additionally, CC_x86_32 and CC_armv7 handle all the special classes. All the
toolsets are defined using create_class_compiler.
Few additional macros have been introduced to identify the class to be used at
various points, e.g.: CC_$(class) derives the $(class) part from the name of
the stage being compiled.
We have also got rid of COREBOOT_COMPILER, COREBOOT_ASSEMBLER and COREBOOT_LINKER
as they do not make any sense for coreboot as a whole. All these attributes are
associated with each of the stages.
Change-Id: I923f3d4fb097d21071030b104c372cc138c68c7b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: http://review.coreboot.org/5577
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
2014-04-23 19:18:48 +02:00
|
|
|
$(CC_$(1)) $(3) -MMD $$$$(CFLAGS_$(1)) -c -o $$$$@ $$$$<
|
2010-03-16 13:01:13 +01:00
|
|
|
en$(EMPTY)def
|
2011-02-17 21:48:45 +01:00
|
|
|
end$(EMPTY)if
|
2009-08-12 17:00:51 +02:00
|
|
|
endef
|
|
|
|
|
2011-02-17 21:48:45 +01:00
|
|
|
filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs))))
|
|
|
|
$(foreach class,$(classes), \
|
|
|
|
$(foreach type,$(call filetypes-of-class,$(class)), \
|
2011-03-08 21:49:18 +01:00
|
|
|
$(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps)))))
|
2010-09-30 18:55:02 +02:00
|
|
|
|
|
|
|
foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file))))))
|
2011-02-17 21:47:49 +01:00
|
|
|
$(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
|
2010-09-30 18:55:02 +02:00
|
|
|
|
2013-05-15 11:47:51 +02:00
|
|
|
DEPENDENCIES = $(originalobjs:.o=.d)
|
2010-03-24 16:51:48 +01:00
|
|
|
-include $(DEPENDENCIES)
|
|
|
|
|
2009-08-12 17:00:51 +02:00
|
|
|
printall:
|
2011-02-22 15:35:05 +01:00
|
|
|
@$(foreach class,$(classes),echo $(class)-objs:=$($(class)-objs); )
|
2009-08-12 17:00:51 +02:00
|
|
|
@echo alldirs:=$(alldirs)
|
2010-09-30 18:55:02 +02:00
|
|
|
@echo allsrcs=$(allsrcs)
|
2010-03-24 16:51:48 +01:00
|
|
|
@echo DEPENDENCIES=$(DEPENDENCIES)
|
Introduce stage-specific architecture for coreboot
Make all three coreboot stages (bootblock, romstage and ramstage) aware of the
architecture specific to that stage i.e. we will have CONFIG_ARCH variables for
each of the three stages. This allows us to have an SOC with any combination of
architectures and thus every stage can be made to run on a completely different
architecture independent of others. Thus, bootblock can have an x86 arch whereas
romstage and ramstage can have arm32 and arm64 arch respectively. These stage
specific CONFIG_ARCH_ variables enable us to select the proper set of toolchain
and compiler flags for every stage.
These options can be considered as either arch or modes eg: x86 running in
different modes or ARM having different arch types (v4, v7, v8). We have got rid
of the original CONFIG_ARCH option completely as every stage can have any
architecture of its own. Thus, almost all the components of coreboot are
identified as being part of one of the three stages (bootblock, romstage or
ramstage). The components which cannot be classified as such e.g. smm, rmodules
can have their own compiler toolset which is for now set to *_i386. Hence, all
special classes are treated in a similar way and the compiler toolset is defined
using create_class_compiler defined in Makefile.
In order to meet these requirements, changes have been made to CC, LD, OBJCOPY
and family to add CC_bootblock, CC_romstage, CC_ramstage and similarly others.
Additionally, CC_x86_32 and CC_armv7 handle all the special classes. All the
toolsets are defined using create_class_compiler.
Few additional macros have been introduced to identify the class to be used at
various points, e.g.: CC_$(class) derives the $(class) part from the name of
the stage being compiled.
We have also got rid of COREBOOT_COMPILER, COREBOOT_ASSEMBLER and COREBOOT_LINKER
as they do not make any sense for coreboot as a whole. All these attributes are
associated with each of the stages.
Change-Id: I923f3d4fb097d21071030b104c372cc138c68c7b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: http://review.coreboot.org/5577
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
2014-04-23 19:18:48 +02:00
|
|
|
@echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME_$(class))
|
2011-02-22 15:35:05 +01:00
|
|
|
@$(foreach class,$(special-classes),echo $(class):='$($(class))'; )
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2011-05-22 00:18:59 +02:00
|
|
|
ifndef NOMKDIR
|
2011-02-22 15:35:05 +01:00
|
|
|
$(shell mkdir -p $(obj) $(objutil)/kconfig/lxdialog $(additional-dirs) $(alldirs))
|
2011-05-22 00:18:59 +02:00
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2010-09-03 10:57:32 +02:00
|
|
|
cscope:
|
|
|
|
cscope -bR
|
|
|
|
|
2009-08-12 17:00:51 +02:00
|
|
|
doxy: doxygen
|
|
|
|
doxygen:
|
2010-02-10 16:36:53 +01:00
|
|
|
$(DOXYGEN) documentation/Doxyfile.coreboot
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
doxyclean: doxygen-clean
|
|
|
|
doxygen-clean:
|
2009-08-25 21:38:46 +02:00
|
|
|
rm -rf $(DOXYGEN_OUTPUT_DIR)
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2011-02-22 15:35:05 +01:00
|
|
|
clean-for-update: doxygen-clean clean-for-update-target
|
2013-02-09 15:45:02 +01:00
|
|
|
rm -rf $(obj) .xcompile
|
2010-02-09 20:41:11 +01:00
|
|
|
|
2011-02-22 15:35:05 +01:00
|
|
|
clean: clean-for-update clean-target
|
|
|
|
rm -f .ccwrap
|
2010-09-27 23:14:19 +02:00
|
|
|
|
2010-09-03 10:57:32 +02:00
|
|
|
clean-cscope:
|
|
|
|
rm -f cscope.out
|
|
|
|
|
2013-02-09 15:45:02 +01:00
|
|
|
distclean: clean
|
2010-04-21 08:36:20 +02:00
|
|
|
rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* .ccwrap .xcompile
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2013-02-11 20:56:46 +01:00
|
|
|
.PHONY: $(PHONY) clean clean-for-update clean-cscope cscope distclean doxygen doxy .xcompile
|