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 --- src/lib/Makefile.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index 5298bbec80..76ab3dd853 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -24,7 +24,9 @@ bootblock-y += memcmp.c romstage-y += memchr.c romstage-y += memcmp.c -rmodules-y += memcmp.c +$(foreach arch,$(ARCH_SUPPORTED),\ + $(eval rmodules_$(arch)-y += memcmp.c)) + romstage-y += cbfs.c romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c #romstage-y += lzmadecode.c @@ -106,12 +108,13 @@ RMODULE_LDFLAGS := -nostartfiles -Wl,--emit-relocs -Wl,-z,defs -Wl,-Bsymbolic - # (1) the object name to link # (2) the dependencies # (3) heap size of the relocatable module +# (4) arch for which the rmodules are to be linked # It will create the necessary Make rules to create a rmodule. The resulting # rmdoule is named $(1).rmod define rmodule_link $(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions $$(RMODTOOL) - $$(CC_rmodules) $$(CFLAGS_rmodules) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME_rmodules) -Wl,--end-group - $$(NM_rmodules) -n $$@ > $$(basename $$@).map + $$(CC_rmodules_$(4)) $$(CFLAGS_rmodules_$(4)) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME_rmodules_$(4)) -Wl,--end-group + $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map $(strip $(1)).rmod: $(strip $(1)) $$(RMODTOOL) -i $$^ -o $$@ -- cgit v1.2.3