blob: db8b76928715562ccd7748966cfcf928f5e7a2c0 [file] [log] [blame]
Martin Roth403ba772015-06-27 19:09:05 -06001# if no architecture is specified, set a default
2BUILD_PLATFORM ?= i386-elf
Stefan Reinauer9b1936d2016-03-01 12:55:47 -08003DEST ?= $(CURDIR)/xgcc
Cristian Magherusan-Stanciu0b933d42011-05-16 01:35:03 +00004
Martin Roth8fe68182015-10-27 15:03:46 -06005# For the toolchain builds, use CPUS=x to use multiple processors to build
6# use KEEP_SOURCES=1 to keep temporary files after the build
7# use BUILDGCC_OPTIONS= to set any other crossgcc command line options
8# Example: BUILDGCC_OPTIONS=-c to remove temporary files before build
9
10all all_with_gdb:
Julius Wernerf96d9052019-08-16 15:35:39 -070011 $(MAKE) build-i386 build-x64 build-arm \
Jonathan Neuschäferc22ad582018-11-30 00:06:50 +010012 build-riscv build-aarch64 build-ppc64 build-nds32le \
Martin Rothd70f5fa2019-05-26 17:24:19 -060013 build_clang build_iasl build_make build_nasm
Martin Roth403ba772015-06-27 19:09:05 -060014
15all_without_gdb:
Julius Wernerf96d9052019-08-16 15:35:39 -070016 $(MAKE) SKIP_GDB=1 build-i386 build-x64 build-arm \
Jonathan Neuschäferc22ad582018-11-30 00:06:50 +010017 build-riscv build-aarch64 build-ppc64 build-nds32le \
Martin Rothd70f5fa2019-05-26 17:24:19 -060018 build_clang build_iasl build_make build_nasm
Martin Roth403ba772015-06-27 19:09:05 -060019
Stefan Reinauer22009a32016-01-29 17:39:07 -080020build_tools: build_gcc build_gdb
Martin Roth403ba772015-06-27 19:09:05 -060021
Martin Roth403ba772015-06-27 19:09:05 -060022###########################################################
23### targets to do buildgcc builds
24
25build_gcc:
Martin Roth8fe68182015-10-27 15:03:46 -060026 bash ./buildgcc -p $(BUILD_PLATFORM) $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) \
Stefan Reinauer163506a2016-02-27 12:29:58 -080027 $(if $(BUILD_LANGUAGES),-l $(BUILD_LANGUAGES)) -d $(DEST)
Martin Roth403ba772015-06-27 19:09:05 -060028
29build_gdb:
Martin Roth8fe68182015-10-27 15:03:46 -060030ifeq ($(SKIP_GDB),)
Stefan Reinauer163506a2016-02-27 12:29:58 -080031 bash ./buildgcc -p $(BUILD_PLATFORM) -P gdb $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) \
32 $(BUILDGCC_OPTIONS) -d $(DEST)
Martin Roth8fe68182015-10-27 15:03:46 -060033endif
Martin Roth403ba772015-06-27 19:09:05 -060034
35build_iasl:
Stefan Reinauer163506a2016-02-27 12:29:58 -080036 bash ./buildgcc -P iasl $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
Martin Roth403ba772015-06-27 19:09:05 -060037
38build_clang:
Martin Roth8fe68182015-10-27 15:03:46 -060039ifeq ($(SKIP_CLANG),)
Stefan Reinauer163506a2016-02-27 12:29:58 -080040 bash ./buildgcc -P clang $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
Martin Roth8fe68182015-10-27 15:03:46 -060041endif
Martin Roth403ba772015-06-27 19:09:05 -060042
Stefan Reinauerf466ea92016-03-06 02:18:47 -080043build_make:
44 bash ./buildgcc -P make $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
45
Martin Rothd70f5fa2019-05-26 17:24:19 -060046build_nasm:
47 bash ./buildgcc -P nasm $(if $(CPUS),-j $(CPUS)) $(if $(KEEP_SOURCES),-t) $(BUILDGCC_OPTIONS) -d $(DEST)
48
Martin Roth403ba772015-06-27 19:09:05 -060049###########################################################
Edward O'Callaghan3a722782013-11-02 03:40:39 +110050build-i386:
Martin Rothd70f5fa2019-05-26 17:24:19 -060051 @$(MAKE) build_tools build_nasm BUILD_PLATFORM=i386-elf
Edward O'Callaghan3a722782013-11-02 03:40:39 +110052
Stefan Reinauer24f9cb92015-03-13 22:50:22 +010053build-x64:
Martin Rothd70f5fa2019-05-26 17:24:19 -060054 @$(MAKE) build_tools build_nasm BUILD_PLATFORM=x86_64-elf
Stefan Reinauer24f9cb92015-03-13 22:50:22 +010055
Stefan Reinauer2cc2ff62016-01-29 17:39:07 -080056build-arm:
57 @$(MAKE) build_tools BUILD_PLATFORM=arm-eabi
Cristian Magherusan-Stanciu0b933d42011-05-16 01:35:03 +000058
Patrick Georgi3bff5d92014-11-19 18:36:37 +010059build-aarch64:
Martin Roth403ba772015-06-27 19:09:05 -060060 @$(MAKE) build_tools BUILD_PLATFORM=aarch64-elf
Patrick Georgi3bff5d92014-11-19 18:36:37 +010061
Alexander Couzensa49c0cc2015-03-10 20:24:34 +010062build-riscv:
Stefan Reinauerc77e0412016-03-01 22:28:20 -080063 # GDB is currently not supported on RISC-V
64 @$(MAKE) build_gcc BUILD_PLATFORM=riscv-elf
Patrick Georgif0bbc952015-03-07 10:57:25 +010065
Jonathan Neuschäferc22ad582018-11-30 00:06:50 +010066build-ppc64:
Martin Rotha45a0b72016-03-23 09:00:11 -060067 @$(MAKE) build_tools BUILD_PLATFORM=powerpc64-linux-gnu
Timothy Pearsona9f62352015-12-30 18:59:00 -060068
Stefan Reinauer8adbcc22016-01-29 17:39:07 -080069build-nds32le:
70 @$(MAKE) build_tools BUILD_PLATFORM=nds32le-elf
71
Martin Roth403ba772015-06-27 19:09:05 -060072clean_tempfiles:
Martin Roth32c96512015-06-21 13:05:03 -060073 rm -rf build-*
Nico Huberafda56e2017-12-07 17:50:53 +010074 rm -rf binutils-* gcc-* gmp-* mpc-* mpfr-*
Martin Roth32c96512015-06-21 13:05:03 -060075 rm -rf llvm-* clang-tools-* cfe-* compiler-rt-*
76 rm -rf acpica-*
77 rm -rf gdb-*
zbaoff3f15c2015-08-26 22:00:31 -040078 rm -f getopt
Cristian Magherusan-Stanciu0b933d42011-05-16 01:35:03 +000079
Martin Roth403ba772015-06-27 19:09:05 -060080clean: clean_tempfiles
81 rm -rf xgcc
82
Martin Roth32c96512015-06-21 13:05:03 -060083distclean: clean
84 rm -rf tarballs
85
Stefan Reinauer8adbcc22016-01-29 17:39:07 -080086.PHONY: build_gcc build_iasl build_gdb build_clang all all_with_gdb \
87 all_without_gdb build_tools build-i386 build-x64 build-arm \
Julius Wernerf96d9052019-08-16 15:35:39 -070088 build-aarch64 build-riscv build-ppc64 build-nds32le build-nasm \
Martin Roth8fe68182015-10-27 15:03:46 -060089 clean distclean clean_tempfiles
Alexander Couzensf126b4b2017-08-27 21:08:50 +020090.NOTPARALLEL: