blob: 24fe942d9b4100dfa5eae4e9d8acf2c1a935b744 [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:
Stefan Reinauer22009a32016-01-29 17:39:07 -080011 $(MAKE) build-i386 build-x64 build-arm build-mips \
12 build-riscv build-aarch64 build-power8 build-nds32le \
Stefan Reinauerf466ea92016-03-06 02:18:47 -080013 build_clang build_iasl build_make
Martin Roth403ba772015-06-27 19:09:05 -060014
15all_without_gdb:
Stefan Reinauer22009a32016-01-29 17:39:07 -080016 $(MAKE) SKIP_GDB=1 build-i386 build-x64 build-arm build-mips \
17 build-riscv build-aarch64 build-power8 build-nds32le \
Stefan Reinauerf466ea92016-03-06 02:18:47 -080018 build_clang build_iasl build_make
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 Roth403ba772015-06-27 19:09:05 -060046###########################################################
Edward O'Callaghan3a722782013-11-02 03:40:39 +110047build-i386:
Martin Roth403ba772015-06-27 19:09:05 -060048 @$(MAKE) build_tools BUILD_PLATFORM=i386-elf
Edward O'Callaghan3a722782013-11-02 03:40:39 +110049
Stefan Reinauer24f9cb92015-03-13 22:50:22 +010050build-x64:
Martin Roth403ba772015-06-27 19:09:05 -060051 @$(MAKE) build_tools BUILD_PLATFORM=x86_64-elf
Stefan Reinauer24f9cb92015-03-13 22:50:22 +010052
Stefan Reinauer2cc2ff62016-01-29 17:39:07 -080053build-arm:
54 @$(MAKE) build_tools BUILD_PLATFORM=arm-eabi
Cristian Magherusan-Stanciu0b933d42011-05-16 01:35:03 +000055
Patrick Georgi3bff5d92014-11-19 18:36:37 +010056build-aarch64:
Martin Roth403ba772015-06-27 19:09:05 -060057 @$(MAKE) build_tools BUILD_PLATFORM=aarch64-elf
Patrick Georgi3bff5d92014-11-19 18:36:37 +010058
Paul Burton6529c332014-05-27 15:18:42 +010059build-mips:
Martin Roth403ba772015-06-27 19:09:05 -060060 @$(MAKE) build_tools BUILD_PLATFORM=mipsel-elf
Paul Burton6529c332014-05-27 15:18:42 +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
Timothy Pearsona9f62352015-12-30 18:59:00 -060066build-power8:
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-*
74 rm -rf binutils-* gcc-* gmp-* libelf-* mpc-* mpfr-*
75 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 \
88 build-aarch64 build-mips build-riscv build-power8 build-nds32le \
Martin Roth8fe68182015-10-27 15:03:46 -060089 clean distclean clean_tempfiles