91 lines
3.3 KiB
Plaintext
91 lines
3.3 KiB
Plaintext
|
############################################################################
|
||
|
# tools/Swift.defs
|
||
|
#
|
||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||
|
# contributor license agreements. See the NOTICE file distributed with
|
||
|
# this work for additional information regarding copyright ownership. The
|
||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||
|
# "License"); you may not use this file except in compliance with the
|
||
|
# License. You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||
|
# License for the specific language governing permissions and limitations
|
||
|
# under the License.
|
||
|
#
|
||
|
############################################################################
|
||
|
|
||
|
# required: Swift 6
|
||
|
|
||
|
SWIFTC := swiftc
|
||
|
|
||
|
SWIFTFLAGS := -enable-experimental-feature Embedded -wmo
|
||
|
|
||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||
|
SWIFTFLAGS += -g
|
||
|
endif
|
||
|
|
||
|
ifeq ($(CONFIG_DEBUG_NOOPT),y)
|
||
|
SWIFTFLAGS += -Osize
|
||
|
endif
|
||
|
|
||
|
# Special handling for the SIM
|
||
|
|
||
|
ifeq ($(CONFIG_ARCH_SIM),y)
|
||
|
ifeq ($(CONFIG_HOST_LINUX),y)
|
||
|
ifeq ($(LLVM_ARCHTYPE),x86)
|
||
|
# Only for x86 based host or x64 but m32 build
|
||
|
SWIFTFLAGS += -target i686-unknown-linux-$(LLVM_ABITYPE)
|
||
|
else
|
||
|
# For other archs, such as aarch64, arm etc
|
||
|
SWIFTFLAGS += -target $(LLVM_ARCHTYPE)-unknown-linux-$(LLVM_ABITYPE)
|
||
|
SWIFTFLAGS += -target-cpu $(LLVM_CPUTYPE)
|
||
|
endif
|
||
|
else ifeq ($(CONFIG_HOST_MACOS),y)
|
||
|
# Triple target [x86/arm64]-apple-macosx[min_version]
|
||
|
ifeq ($(LLVM_ARCHTYPE),aarch64)
|
||
|
SWIFTFLAGS += -target arm64-apple-macosx11.7.1
|
||
|
else
|
||
|
SWIFTFLAGS += -target $(LLVM_ARCHTYPE)-apple-macosx10.9.0
|
||
|
endif
|
||
|
endif
|
||
|
else ifeq ($(CONFIG_ARCH_RISCV),y)
|
||
|
# Target triple is riscv[32|64]-unknown-none-eabi
|
||
|
SWIFTFLAGS += -target $(LLVM_ARCHTYPE)-none-none-eabi
|
||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||
|
SWIFTFLAGS += -Xcc -march=rv32imafc_zicsr_zifencei
|
||
|
else ifeq ($(CONFIG_ARCH_DPFPU),y)
|
||
|
SWIFTFLAGS := -Xcc -march=rv32imafdc_zicsr_zifencei
|
||
|
else
|
||
|
SWIFTFLAGS += -Xcc -march=rv32imac_zicsr_zifencei
|
||
|
endif
|
||
|
|
||
|
# Handle ABI and CPU
|
||
|
ifeq ($(CONFIG_ARCH_RV32),y)
|
||
|
SWIFTFLAGS += -target-cpu generic-rv32
|
||
|
SWIFTFLAGS += -Xcc -mabi=ilp32d
|
||
|
else ifeq ($(CONFIG_ARCH_RV64),y)
|
||
|
SWIFTFLAGS += -target-cpu generic-rv64
|
||
|
SWIFTFLAGS += -Xcc -mabi=lp64d
|
||
|
endif
|
||
|
else
|
||
|
# For arm, but there are some other archs not support yet,
|
||
|
# such as xtensa, x86 bare metal, etc.
|
||
|
SWIFTFLAGS += -target $(LLVM_ARCHTYPE)-none-none-$(LLVM_ABITYPE)
|
||
|
SWIFTFLAGS += -target-cpu $(LLVM_CPUTYPE)
|
||
|
endif
|
||
|
|
||
|
|
||
|
# Note for reference - all embedded targets available
|
||
|
# see: ls ${SWIFT_PREFIX_PATH}/lib/swift/embedded/Swift.swiftmodule/
|
||
|
#
|
||
|
# aarch64-none-none-elf, arm64-apple-none-macho,
|
||
|
# armv4t-none-none-eabi, armv6-apple-none-macho, armv6-none-none-eabi,
|
||
|
# armv6m-apple-none-macho, armv6m-none-none-eabi, armv7-apple-none-macho,
|
||
|
# armv7-none-none-eabi, armv7em-apple-none-macho, armv7em-none-none-eabi,
|
||
|
# avr-none-none-elf, i686-unknown-none-elf, riscv32-none-none-eabi,
|
||
|
# riscv64-none-none-eabi, wasm32-unknown-none-wasm, wasm64-unknown-none-wasm,
|
||
|
# x86_64-unknown-linux-gnu, x86_64-unknown-none-elf,
|