blob: 0735b7d6245bb22f2beb33223cc1af06ba92279c [file] [log] [blame]
Patrick Georgi7333a112020-05-08 20:48:04 +02001## SPDX-License-Identifier: GPL-2.0-only
Stefan Reinauerd5779c12016-01-29 17:48:47 -08002
Julius Wernerf96d9052019-08-16 15:35:39 -07003TOOLCHAIN_ARCHES := i386 x64 arm aarch64 riscv ppc64 nds32le
Patrick Georgi6c0ccfb2016-01-30 09:14:45 +01004
Stefan Reinauerd5779c12016-01-29 17:48:47 -08005help_toolchain help::
6 @echo '*** Toolchain targets ***'
7 @echo ' crossgcc - Build coreboot cross-compilers for all platforms'
8 @echo ' crosstools - Build coreboot cross-compiler and GDB for all platforms'
9 @echo ' crossgcc-clean - Remove all built coreboot cross-compilers'
10 @echo ' iasl - Build coreboot IASL compiler (built by all cross targets)'
11 @echo ' clang - Build coreboot clang compiler'
Martin Roth109a7db2016-08-11 18:16:59 -060012 @echo ' gnumake - Build coreboot make'
Martin Rothd70f5fa2019-05-26 17:24:19 -060013 @echo ' nasm - Build coreboot nasm'
Stefan Reinauerd5779c12016-01-29 17:48:47 -080014 @echo ' test-toolchain - Reports if toolchain components are out of date'
15 @echo ' crossgcc-ARCH - Build cross-compiler for specific architecture'
16 @echo ' crosstools-ARCH - Build cross-compiler with GDB for specific architecture'
Patrick Georgi6c0ccfb2016-01-30 09:14:45 +010017 @echo ' ARCH can be "$(subst $(spc),"$(comma) ",$(TOOLCHAIN_ARCHES))"'
Stefan Reinauerd5779c12016-01-29 17:48:47 -080018 @echo ' Use "make [target] CPUS=#" to build toolchain using multiple cores'
Patrick Georgid971e762018-11-24 23:14:45 +010019 @echo ' Use "make [target] DEST=some/path" to install toolchain there'
Stefan Reinauerd5779c12016-01-29 17:48:47 -080020 @echo
21
22# For the toolchain builds, use CPUS=x to use multiple processors to build
23# use BUILDGCC_OPTIONS= to set any crossgcc command line options
24# Example: BUILDGCC_OPTIONS='-t' will keep temporary files after build
25crossgcc: clean-for-update
26 $(MAKE) -C util/crossgcc all_without_gdb SKIP_CLANG=1
27
28.PHONY: crossgcc crossgcc-i386 crossgcc-x64 crossgcc-arm crossgcc-aarch64 \
Julius Wernerf96d9052019-08-16 15:35:39 -070029 crossgcc-riscv crossgcc-power8 crossgcc-clean iasl \
Stefan Reinauerd5779c12016-01-29 17:48:47 -080030 clang crosstools-i386 crosstools-x64 crosstools-arm \
Julius Wernerf96d9052019-08-16 15:35:39 -070031 crosstools-aarch64 crosstools-riscv crosstools-power8 \
Martin Rothd70f5fa2019-05-26 17:24:19 -060032 jenkins-build-toolchain gnumake nasm
Stefan Reinauerd5779c12016-01-29 17:48:47 -080033
Patrick Georgi6c0ccfb2016-01-30 09:14:45 +010034$(foreach arch,$(TOOLCHAIN_ARCHES),crossgcc-$(arch)): clean-for-update
Patrick Georgi3df92622016-02-02 19:33:00 +010035 $(MAKE) -C util/crossgcc $(patsubst crossgcc-%,build-%,$@) build_iasl SKIP_GDB=1
Stefan Reinauerd5779c12016-01-29 17:48:47 -080036
37crosstools: clean-for-update
38 $(MAKE) -C util/crossgcc all_with_gdb SKIP_CLANG=1
39
40iasl: clean-for-update
41 $(MAKE) -C util/crossgcc build_iasl
42
43clang: clean-for-update
44 $(MAKE) -C util/crossgcc build_clang
45
Martin Roth109a7db2016-08-11 18:16:59 -060046gnumake: clean-for-update
47 $(MAKE) -C util/crossgcc build_make
48
Martin Rothd70f5fa2019-05-26 17:24:19 -060049nasm: clean-for-update
50 $(MAKE) -C util/crossgcc build_nasm
51
Patrick Georgi6c0ccfb2016-01-30 09:14:45 +010052$(foreach arch,$(TOOLCHAIN_ARCHES),crosstools-$(arch)): clean-for-update
Patrick Georgi3df92622016-02-02 19:33:00 +010053 $(MAKE) -C util/crossgcc $(patsubst crosstools-%,build-%,$@) build_iasl
Stefan Reinauerd5779c12016-01-29 17:48:47 -080054
55crossgcc-clean: clean-for-update
56 $(MAKE) -C util/crossgcc clean
57
58test-toolchain:
59ifeq ($(COMPILER_OUT_OF_DATE),1)
60 echo "The coreboot toolchain is not the current version."
61 $(error )
62else
63 echo "The coreboot toolchain is the current version."
64endif # ifeq ($(COMPILER_OUT_OF_DATE),1)
Martin Roth21148802016-03-08 09:27:45 -070065
66# This target controls what the jenkins builder tests
Martin Rothab8f7d32016-12-07 10:45:55 -070067jenkins-build-toolchain: BUILDGCC_OPTIONS ?= -y --nocolor
Martin Roth21148802016-03-08 09:27:45 -070068jenkins-build-toolchain:
Martin Rothe7a50622020-03-15 09:43:31 -060069 $(MAKE) crossgcc clang KEEP_SOURCES=1 BUILDGCC_OPTIONS='$(BUILDGCC_OPTIONS)'
70 #TODO: Re-enable gdb build after the builders can build it again.
71 #$(MAKE) crosstools clang KEEP_SOURCES=1 BUILDGCC_OPTIONS='$(BUILDGCC_OPTIONS)'
Martin Roth4c3b1562016-03-22 13:05:42 -060072 rm -f .xcompile
Martin Rotha5395802016-04-02 11:10:08 -060073 PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) what-jenkins-does
74 -cat .xcompile
75 PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) test-toolchain