/ util / crossgcc / Makefile
Makefile
 1  ## SPDX-License-Identifier: GPL-2.0-only
 2  # if no architecture is specified, set a default
 3  BUILD_PLATFORM ?= i386-elf
 4  DEST ?= $(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  
11  all:
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  
19  build_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  
23  build_iasl:
24  	bash ./buildgcc -P iasl $(if $(CPUS),-j $(CPUS))  $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
25  
26  build_clang:
27  ifeq ($(SKIP_CLANG),)
28  	bash ./buildgcc -P clang $(if $(CPUS),-j $(CPUS))  $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
29  endif
30  
31  build_nasm:
32  	bash ./buildgcc -P nasm $(if $(CPUS),-j $(CPUS))  $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
33  
34  ###########################################################
35  build-i386:
36  	@$(MAKE) build_gcc build_nasm BUILD_PLATFORM=i386-elf
37  
38  build-x64:
39  	@$(MAKE) build_gcc build_nasm BUILD_PLATFORM=x86_64-elf
40  
41  build-arm:
42  	@$(MAKE) build_gcc BUILD_PLATFORM=arm-eabi
43  
44  build-aarch64:
45  	@$(MAKE) build_gcc BUILD_PLATFORM=aarch64-elf
46  
47  build-riscv:
48  	@$(MAKE) build_gcc BUILD_PLATFORM=riscv-elf
49  
50  build-ppc64:
51  	@$(MAKE) build_gcc BUILD_PLATFORM=powerpc64-linux-gnu
52  
53  build-nds32le:
54  	@$(MAKE) build_gcc BUILD_PLATFORM=nds32le-elf
55  
56  clean_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  
63  clean: clean_tempfiles
64  	rm -rf xgcc
65  
66  distclean: 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: