1## SPDX-License-Identifier: GPL-2.0-only 2# if no architecture is specified, set a default 3BUILD_PLATFORM ?= i386-elf 4DEST ?= $(CURDIR)/xgcc 5 6# For the toolchain builds, use CPUS=x to use multiple processors to build 7# use KEEP_SOURCES=1 to keep temporary files after the build 8# use BUILDGCC_OPTIONS= to set any other crossgcc command line options 9# Example: BUILDGCC_OPTIONS=-c to remove temporary files before build 10 11all: 12 $(MAKE) build-i386 build-x64 build-arm \ 13 build-riscv build-aarch64 build-ppc64 build-nds32le \ 14 build_clang build_iasl build_nasm 15 16########################################################### 17### targets to do buildgcc builds 18 19build_gcc: 20 bash ./buildgcc -p $(BUILD_PLATFORM) $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) \ 21 $(if $(BUILD_LANGUAGES),-l $(BUILD_LANGUAGES)) -d $(DEST) 22 23build_iasl: 24 bash ./buildgcc -P iasl $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST) 25 26build_clang: 27ifeq ($(SKIP_CLANG),) 28 bash ./buildgcc -P clang $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST) 29endif 30 31build_nasm: 32 bash ./buildgcc -P nasm $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST) 33 34########################################################### 35build-i386: 36 @$(MAKE) build_gcc build_nasm BUILD_PLATFORM=i386-elf 37 38build-x64: 39 @$(MAKE) build_gcc build_nasm BUILD_PLATFORM=x86_64-elf 40 41build-arm: 42 @$(MAKE) build_gcc BUILD_PLATFORM=arm-eabi 43 44build-aarch64: 45 @$(MAKE) build_gcc BUILD_PLATFORM=aarch64-elf 46 47build-riscv: 48 @$(MAKE) build_gcc BUILD_PLATFORM=riscv-elf 49 50build-ppc64: 51 @$(MAKE) build_gcc BUILD_PLATFORM=powerpc64-linux-gnu 52 53build-nds32le: 54 @$(MAKE) build_gcc BUILD_PLATFORM=nds32le-elf 55 56clean_tempfiles: 57 rm -rf build-* 58 rm -rf binutils-* gcc-* gmp-* mpc-* mpfr-* 59 rm -rf llvm-* clang-tools-* cfe-* compiler-rt-* 60 rm -rf acpica-* 61 rm -f getopt 62 63clean: clean_tempfiles 64 rm -rf xgcc 65 66distclean: clean 67 rm -rf tarballs 68 69.PHONY: all build_gcc build_iasl build_clang build_nasm \ 70 clean distclean clean_tempfiles \ 71 build-i386 build-x64 build-arm build-aarch64 \ 72 build-riscv build-ppc64 build-nds32le 73 74.NOTPARALLEL: 75