2023-03-02 04:46:37 +01:00
|
|
|
############################################################################
|
|
|
|
# apps/interpreters/wamr/Toolchain.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.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2023-04-02 16:04:41 +02:00
|
|
|
# Wamrc toolchain flags
|
2023-03-02 04:46:37 +01:00
|
|
|
|
|
|
|
WRC ?= wamrc
|
|
|
|
|
2023-03-30 08:52:15 +02:00
|
|
|
ifeq ($(CONFIG_ARCH_XTENSA),y)
|
2023-03-02 04:46:37 +01:00
|
|
|
WTARGET = xtensa
|
|
|
|
else ifeq ($(CONFIG_ARCH_X86_64),y)
|
|
|
|
WTARGET = x86_64
|
|
|
|
else ifeq ($(CONFIG_ARCH_X86),y)
|
|
|
|
WTARGET = i386
|
|
|
|
else ifeq ($(CONFIG_ARCH_MIPS),y)
|
|
|
|
WTARGET = mips
|
|
|
|
else ifeq ($(CONFIG_ARCH_SIM),y)
|
|
|
|
RCFLAGS += --disable-simd
|
|
|
|
ifeq ($(CONFIG_SIM_M32),y)
|
|
|
|
WTARGET = i386
|
|
|
|
else
|
|
|
|
WTARGET = x86_64
|
|
|
|
endif
|
2023-03-30 08:52:15 +02:00
|
|
|
else
|
|
|
|
|
|
|
|
# Flags for other architectures (arm or riscv)
|
|
|
|
|
|
|
|
WTARGET = $(LLVM_ARCHTYPE)
|
|
|
|
WCPU = $(LLVM_CPUTYPE)
|
|
|
|
|
2023-03-02 04:46:37 +01:00
|
|
|
endif
|
|
|
|
|
2023-03-30 08:52:15 +02:00
|
|
|
RCFLAGS += --target=$(WTARGET) --target-abi=$(LLVM_ABITYPE) --cpu=$(WCPU)
|
2023-03-02 04:46:37 +01:00
|
|
|
|
2023-04-02 16:04:41 +02:00
|
|
|
define WAMR_AOT_COMPILE
|
2023-03-02 04:46:37 +01:00
|
|
|
$(if $(wildcard $(APPDIR)$(DELIM)wasm$(DELIM)*.wo), \
|
|
|
|
$(foreach bin,$(wildcard $(APPDIR)$(DELIM)wasm$(DELIM)*.wo), \
|
|
|
|
$(eval PROGNAME=$(shell echo $(notdir $(bin)) | cut -d'#' -f1)) \
|
|
|
|
$(eval WAMRMODE=$(shell echo $(notdir $(bin)) | cut -d'#' -f5)) \
|
|
|
|
$(if $(CONFIG_INTERPRETERS_WAMR_AOT), \
|
|
|
|
$(if $(filter AOT,$(WAMRMODE)), \
|
|
|
|
$(info Wamrc Generate AoT: $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot) \
|
|
|
|
$(shell $(WRC) $(RCFLAGS) -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot \
|
|
|
|
$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null), \
|
|
|
|
$(if $(filter XIP,$(WAMRMODE)), \
|
|
|
|
$(info Wamrc Generate XiP: $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip) \
|
|
|
|
$(shell $(WRC) $(RCFLAGS) --enable-indirect-mode --disable-llvm-intrinsics \
|
|
|
|
-o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip \
|
|
|
|
$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
endef
|