1-include ../tools.mk
2
3TARGETS =
4ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm)
5# construct a fairly exhaustive list of platforms that we
6# support. These ones don't follow a pattern
7TARGETS += arm-linux-androideabi arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabi
8endif
9
10ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86)
11X86_ARCHS = i686 x86_64
12else
13X86_ARCHS =
14endif
15
16# these ones do, each OS lists the architectures it supports
17LINUX=$(filter aarch64 mips,$(LLVM_COMPONENTS)) $(X86_ARCHS)
18ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips)
19LINUX += mipsel
20endif
21
22WINDOWS=$(X86_ARCHS)
23# fails with: failed to get iphonesimulator SDK path: no such file or directory
24#IOS=i386 aarch64 armv7
25DARWIN=$(X86_ARCHS)
26
27$(foreach arch,$(LINUX),$(eval TARGETS += $(arch)-unknown-linux-gnu))
28$(foreach arch,$(WINDOWS),$(eval TARGETS += $(arch)-pc-windows-gnu))
29#$(foreach arch,$(IOS),$(eval TARGETS += $(arch)-apple-ios))
30$(foreach arch,$(DARWIN),$(eval TARGETS += $(arch)-apple-darwin))
31
32all: $(TARGETS)
33
34define MK_TARGETS
35# compile the rust file to the given target, but only to asm and IR
36# form, to avoid having to have an appropriate linker.
37#
38# we need some features because the integer SIMD instructions are not
39# enabled by-default for i686 and ARM; these features will be invalid
40# on some platforms, but LLVM just prints a warning so that's fine for
41# now.
42$(1): simd.rs
43	$$(RUSTC) --target=$(1) --emit=llvm-ir,asm simd.rs \
44                -C target-feature='+neon,+sse2' -C extra-filename=-$(1)
45endef
46
47$(foreach targetxxx,$(TARGETS),$(eval $(call MK_TARGETS,$(targetxxx))))
48