Martin Roth | adaab4a | 2022-10-28 22:38:44 -0600 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 2 | # if no architecture is specified, set a default |
| 3 | BUILD_PLATFORM ?= i386-elf |
Stefan Reinauer | 9b1936d | 2016-03-01 12:55:47 -0800 | [diff] [blame] | 4 | DEST ?= $(CURDIR)/xgcc |
Cristian Magherusan-Stanciu | 0b933d4 | 2011-05-16 01:35:03 +0000 | [diff] [blame] | 5 | |
Martin Roth | 8fe6818 | 2015-10-27 15:03:46 -0600 | [diff] [blame] | 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 | |
Patrick Georgi | f32eed1 | 2021-10-16 10:50:00 +0200 | [diff] [blame] | 11 | all: |
Julius Werner | f96d905 | 2019-08-16 15:35:39 -0700 | [diff] [blame] | 12 | $(MAKE) build-i386 build-x64 build-arm \ |
Jonathan Neuschäfer | c22ad58 | 2018-11-30 00:06:50 +0100 | [diff] [blame] | 13 | build-riscv build-aarch64 build-ppc64 build-nds32le \ |
Elyes HAOUAS | 91fb139 | 2020-01-20 15:33:11 +0100 | [diff] [blame] | 14 | build_clang build_iasl build_nasm |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 15 | |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 16 | ########################################################### |
| 17 | ### targets to do buildgcc builds |
| 18 | |
| 19 | build_gcc: |
Martin Roth | 8fe6818 | 2015-10-27 15:03:46 -0600 | [diff] [blame] | 20 | bash ./buildgcc -p $(BUILD_PLATFORM) $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) \ |
Stefan Reinauer | 163506a | 2016-02-27 12:29:58 -0800 | [diff] [blame] | 21 | $(if $(BUILD_LANGUAGES),-l $(BUILD_LANGUAGES)) -d $(DEST) |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 22 | |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 23 | build_iasl: |
Stefan Reinauer | 163506a | 2016-02-27 12:29:58 -0800 | [diff] [blame] | 24 | bash ./buildgcc -P iasl $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST) |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 25 | |
| 26 | build_clang: |
Martin Roth | 8fe6818 | 2015-10-27 15:03:46 -0600 | [diff] [blame] | 27 | ifeq ($(SKIP_CLANG),) |
Stefan Reinauer | 163506a | 2016-02-27 12:29:58 -0800 | [diff] [blame] | 28 | bash ./buildgcc -P clang $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST) |
Martin Roth | 8fe6818 | 2015-10-27 15:03:46 -0600 | [diff] [blame] | 29 | endif |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 30 | |
Martin Roth | d70f5fa | 2019-05-26 17:24:19 -0600 | [diff] [blame] | 31 | build_nasm: |
| 32 | bash ./buildgcc -P nasm $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST) |
| 33 | |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 34 | ########################################################### |
Edward O'Callaghan | 3a72278 | 2013-11-02 03:40:39 +1100 | [diff] [blame] | 35 | build-i386: |
Patrick Georgi | f32eed1 | 2021-10-16 10:50:00 +0200 | [diff] [blame] | 36 | @$(MAKE) build_gcc build_nasm BUILD_PLATFORM=i386-elf |
Edward O'Callaghan | 3a72278 | 2013-11-02 03:40:39 +1100 | [diff] [blame] | 37 | |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 38 | build-x64: |
Patrick Georgi | f32eed1 | 2021-10-16 10:50:00 +0200 | [diff] [blame] | 39 | @$(MAKE) build_gcc build_nasm BUILD_PLATFORM=x86_64-elf |
Stefan Reinauer | 24f9cb9 | 2015-03-13 22:50:22 +0100 | [diff] [blame] | 40 | |
Stefan Reinauer | 2cc2ff6 | 2016-01-29 17:39:07 -0800 | [diff] [blame] | 41 | build-arm: |
Patrick Georgi | f32eed1 | 2021-10-16 10:50:00 +0200 | [diff] [blame] | 42 | @$(MAKE) build_gcc BUILD_PLATFORM=arm-eabi |
Cristian Magherusan-Stanciu | 0b933d4 | 2011-05-16 01:35:03 +0000 | [diff] [blame] | 43 | |
Patrick Georgi | 3bff5d9 | 2014-11-19 18:36:37 +0100 | [diff] [blame] | 44 | build-aarch64: |
Patrick Georgi | f32eed1 | 2021-10-16 10:50:00 +0200 | [diff] [blame] | 45 | @$(MAKE) build_gcc BUILD_PLATFORM=aarch64-elf |
Patrick Georgi | 3bff5d9 | 2014-11-19 18:36:37 +0100 | [diff] [blame] | 46 | |
Alexander Couzens | a49c0cc | 2015-03-10 20:24:34 +0100 | [diff] [blame] | 47 | build-riscv: |
Stefan Reinauer | c77e041 | 2016-03-01 22:28:20 -0800 | [diff] [blame] | 48 | @$(MAKE) build_gcc BUILD_PLATFORM=riscv-elf |
Patrick Georgi | f0bbc95 | 2015-03-07 10:57:25 +0100 | [diff] [blame] | 49 | |
Jonathan Neuschäfer | c22ad58 | 2018-11-30 00:06:50 +0100 | [diff] [blame] | 50 | build-ppc64: |
Patrick Georgi | f32eed1 | 2021-10-16 10:50:00 +0200 | [diff] [blame] | 51 | @$(MAKE) build_gcc BUILD_PLATFORM=powerpc64-linux-gnu |
Timothy Pearson | a9f6235 | 2015-12-30 18:59:00 -0600 | [diff] [blame] | 52 | |
Stefan Reinauer | 8adbcc2 | 2016-01-29 17:39:07 -0800 | [diff] [blame] | 53 | build-nds32le: |
Patrick Georgi | f32eed1 | 2021-10-16 10:50:00 +0200 | [diff] [blame] | 54 | @$(MAKE) build_gcc BUILD_PLATFORM=nds32le-elf |
Stefan Reinauer | 8adbcc2 | 2016-01-29 17:39:07 -0800 | [diff] [blame] | 55 | |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 56 | clean_tempfiles: |
Martin Roth | 32c9651 | 2015-06-21 13:05:03 -0600 | [diff] [blame] | 57 | rm -rf build-* |
Nico Huber | afda56e | 2017-12-07 17:50:53 +0100 | [diff] [blame] | 58 | rm -rf binutils-* gcc-* gmp-* mpc-* mpfr-* |
Martin Roth | 32c9651 | 2015-06-21 13:05:03 -0600 | [diff] [blame] | 59 | rm -rf llvm-* clang-tools-* cfe-* compiler-rt-* |
| 60 | rm -rf acpica-* |
zbao | ff3f15c | 2015-08-26 22:00:31 -0400 | [diff] [blame] | 61 | rm -f getopt |
Cristian Magherusan-Stanciu | 0b933d4 | 2011-05-16 01:35:03 +0000 | [diff] [blame] | 62 | |
Martin Roth | 403ba77 | 2015-06-27 19:09:05 -0600 | [diff] [blame] | 63 | clean: clean_tempfiles |
| 64 | rm -rf xgcc |
| 65 | |
Martin Roth | 32c9651 | 2015-06-21 13:05:03 -0600 | [diff] [blame] | 66 | distclean: clean |
| 67 | rm -rf tarballs |
| 68 | |
Elyes HAOUAS | 52607fd | 2021-11-17 18:59:51 +0100 | [diff] [blame] | 69 | .PHONY: all build_gcc build_iasl build_clang build_nasm \ |
Patrick Georgi | 6dad77d | 2021-11-01 16:24:35 +0000 | [diff] [blame] | 70 | clean distclean clean_tempfiles \ |
| 71 | build-i386 build-x64 build-arm build-aarch64 \ |
| 72 | build-riscv build-ppc64 build-nds32le |
| 73 | |
Alexander Couzens | f126b4b | 2017-08-27 21:08:50 +0200 | [diff] [blame] | 74 | .NOTPARALLEL: |