1# Copyright JS Foundation and other contributors, http://js.foundation 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# Build and output directories 16BUILD_DIR ?= build/riotstm32f4 17COPYTARGET ?= targets/riot-stm32f4/bin 18 19# JerryScript configuration 20JERRYHEAP ?= 16 21 22# To be defined on the command line of make if Clang is available via a 23# different name (e.g., clang-N.M) 24CC ?= clang 25 26# Cross-compilation settings for Clang 27EXT_CFLAGS := -target arm-none-eabi 28EXT_CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 29EXT_CFLAGS += -isystem /usr/arm-none-eabi/include 30EXT_CFLAGS += $(addprefix -isystem $(lastword $(sort $(wildcard /usr/lib/gcc/arm-none-eabi/*/))), include include-fixed) 31EXT_CFLAGS += -nostdinc 32 33# For ABI compatibility with RIOT-OS 34EXT_CFLAGS += -fshort-enums 35 36 37.PHONY: libjerry riot-jerry flash clean 38 39all: libjerry riot-jerry 40 41libjerry: 42 mkdir -p $(BUILD_DIR) 43 cmake -B$(BUILD_DIR) -H./ \ 44 -DCMAKE_SYSTEM_NAME=RIOT \ 45 -DCMAKE_SYSTEM_PROCESSOR=armv7l \ 46 -DCMAKE_C_COMPILER=$(CC) \ 47 -DCMAKE_C_COMPILER_WORKS=TRUE \ 48 -DENABLE_LTO=OFF \ 49 -DENABLE_ALL_IN_ONE=OFF \ 50 -DJERRY_LIBM=OFF \ 51 -DJERRY_CMDLINE=OFF \ 52 -DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \ 53 -DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP) 54 make -C$(BUILD_DIR) jerry-core jerry-port-default-minimal jerry-ext 55 56 mkdir -p $(COPYTARGET) 57 cp $(BUILD_DIR)/lib/libjerry-core.a $(COPYTARGET) 58 cp $(BUILD_DIR)/lib/libjerry-port-default-minimal.a $(COPYTARGET) 59 cp $(BUILD_DIR)/lib/libjerry-ext.a $(COPYTARGET) 60 61riot-jerry: libjerry 62 make -f ./targets/riot-stm32f4/Makefile 63 64flash: libjerry 65 make -f ./targets/riot-stm32f4/Makefile flash 66 67clean: 68 rm -rf $(COPYTARGET) 69 rm -rf $(BUILD_DIR) 70 make -f ./targets/riot-stm32f4/Makefile clean 71