From 133096b6dc31163f59f658e15f2eb342a0de2ac6 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 31 Jul 2014 09:28:55 -0700 Subject: coreboot classes: Add dynamic classes to coreboot Provide functionality to create dynamic classes based on program name and architecture for which the program needs to be compiled/linked. define_class takes program_name and arch as its arguments and adds the program_name to classes-y to create dynamic class. Also, compiler toolset is created for the specified arch. All the files for this program can then be added to program_name-y += .. Ensure that define_class is called before any files are added to the class. Check subdirs-y for order of directory inclusion. One such example of dynamic class is rmodules. Multiple rmodules can be used which need to be compiled for different architectures. With dynamic classes, this is possible. Change-Id: Ie143ed6f79ced5f58c200394cff89b006bc9b342 Signed-off-by: Furquan Shaikh Reviewed-on: http://review.coreboot.org/6426 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- toolchain.inc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'toolchain.inc') diff --git a/toolchain.inc b/toolchain.inc index 842473b648..3b9c5d297b 100644 --- a/toolchain.inc +++ b/toolchain.inc @@ -98,6 +98,18 @@ CPPFLAGS_$(1) += $$(CPPFLAGS_common) $$(CPPFLAGS_$(2)) LIBGCC_FILE_NAME_$(1) = $(wildcard $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-libgcc-file-name)) endef +# define_class: Allows defining any program as dynamic class and compiler tool +# set for the same based on the architecture for which the program is to be +# compiled +# @1: program (class name) +# @2: architecture for which the program needs to be compiled +# IMP: Ensure that define_class is called before any .c or .S files are added to +# the class of the program. Check subdirs-y for order of subdirectory inclusions +define define_class +classes-y += $(1) +$(eval $(call create_class_compiler,$(1),$(2))) +endef + # initialize standard toolchain (CC,AS and others) for give stage # @1 : stage for which the toolchain is to be initialized init_standard_toolchain = \ -- cgit v1.2.3