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 16# Default target for running the build test outside the Travis CI environment. 17all: 18 $(MAKE) install 19 $(MAKE) script 20 21 22## Targets for installing build dependencies of the NuttX JerryScript target. 23 24# Install cross-compiler and tools via apt. 25install-apt-get-deps: 26 sudo apt-get install -q -y gcc-arm-none-eabi gperf 27 28# Fetch and build kconfig-frontends (kconfig-conf) from nuttx/tools. 29LOCAL_INSTALL:=$(CURDIR)/../local/ 30 31install-kconfig: 32 git clone https://bitbucket.org/nuttx/tools.git ../tools 33 mkdir -p $(LOCAL_INSTALL) 34 # FIXME: 'autoreconf --force --install' is a workaround after 35 # https://bitbucket.org/nuttx/tools/commits/164450f982b404fdc2b3233db51dc3eaa1f08b7f 36 cd ../tools/kconfig-frontends && autoreconf --force --install && ./configure --disable-mconf --disable-nconf --disable-gconf --disable-qconf --disable-utils --disable-shared --enable-static --prefix=$(LOCAL_INSTALL) 37 $(MAKE) -C ../tools/kconfig-frontends 38 $(MAKE) -C ../tools/kconfig-frontends install 39 40# Fetch nuttx/{apps,nuttx} repositories. 41install-clone-nuttx: 42 git clone https://bitbucket.org/nuttx/apps.git ../apps -b nuttx-7.28 43 git clone https://bitbucket.org/nuttx/nuttx.git ../nuttx -b nuttx-7.28 44 45# Perform all the necessary (JerryScript-independent) installation steps. 46install-noapt: install-kconfig install-clone-nuttx 47install: install-apt-get-deps install-noapt 48 49 50## Targets for building NuttX with JerryScript. 51 52# Build JerryScript. 53script-build-jerryscript: 54 tools/build.py --clean --toolchain cmake/toolchain_mcu_stm32f4.cmake --profile=es2015-subset --jerry-cmdline OFF --lto OFF --jerry-libm ON --all-in-one ON --jerry-port-default OFF --mem-heap 70 --compile-flag='--sysroot=../nuttx' 55 56# Link in the NuttX JerryScript target directory under the NuttX apps tree. 57script-add-jerryscript-app: 58 ln -s ../../jerryscript/targets/nuttx-stm32f4 ../apps/interpreters/jerryscript 59 60# Configure USB shell. 61script-configure-usbnsh: 62 cd ../nuttx/tools && PATH=$(LOCAL_INSTALL)/bin:$$PATH ./configure.sh stm32f4discovery/usbnsh 63 64# Configure and build the firmware (NuttX with JerryScript). 65script: script-build-jerryscript script-add-jerryscript-app script-configure-usbnsh 66 echo 'CONFIG_HOST_LINUX=y' >> ../nuttx/.config 67 echo 'CONFIG_ARCH_FPU=y' >> ../nuttx/.config 68 echo 'CONFIG_JERRYSCRIPT=y'>> ../nuttx/.config 69 PATH=$(LOCAL_INSTALL)/bin:$$PATH $(MAKE) -C ../nuttx olddefconfig 70 PATH=$(LOCAL_INSTALL)/bin:$$PATH $(MAKE) -C ../nuttx 71