1425bb815Sopenharmony_ci# Copyright JS Foundation and other contributors, http://js.foundation 2425bb815Sopenharmony_ci# 3425bb815Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 4425bb815Sopenharmony_ci# you may not use this file except in compliance with the License. 5425bb815Sopenharmony_ci# You may obtain a copy of the License at 6425bb815Sopenharmony_ci# 7425bb815Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 8425bb815Sopenharmony_ci# 9425bb815Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 10425bb815Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS 11425bb815Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12425bb815Sopenharmony_ci# See the License for the specific language governing permissions and 13425bb815Sopenharmony_ci# limitations under the License. 14425bb815Sopenharmony_ci 15425bb815Sopenharmony_ci# USAGE: 16425bb815Sopenharmony_ci# specify the board using the command line: 17425bb815Sopenharmony_ci# make BOARD=[mbed board name] 18425bb815Sopenharmony_ci 19425bb815Sopenharmony_ciBOARD=$(subst [mbed] ,,$(shell mbed target)) 20425bb815Sopenharmony_ciHEAPSIZE=16 21425bb815Sopenharmony_ci 22425bb815Sopenharmony_ciDEBUG?=0 23425bb815Sopenharmony_ciNO_JS?=0 24425bb815Sopenharmony_ciMBED_VERBOSE?=0 25425bb815Sopenharmony_ci 26425bb815Sopenharmony_ciMBED_CLI_FLAGS=-j0 --source . --source ../../ 27425bb815Sopenharmony_ci 28425bb815Sopenharmony_ciEXTRA_SRC= 29425bb815Sopenharmony_ci 30425bb815Sopenharmony_ciifneq ($(EXTRA_SRC),) 31425bb815Sopenharmony_ciEXTRA_SRC_MOD=--source $(subst :, --source ,$(EXTRA_SRC)) 32425bb815Sopenharmony_ciMBED_CLI_FLAGS += $(EXTRA_SRC_MOD) 33425bb815Sopenharmony_ciendif 34425bb815Sopenharmony_ci 35425bb815Sopenharmony_ciEXTERN_BUILD_DIR= 36425bb815Sopenharmony_ci 37425bb815Sopenharmony_ciifneq ($(EXTERN_BUILD_DIR),) 38425bb815Sopenharmony_ciMBED_CLI_FLAGS += --build $(EXTERN_BUILD_DIR) 39425bb815Sopenharmony_ciendif 40425bb815Sopenharmony_ci 41425bb815Sopenharmony_ciifeq ($(DEBUG), 1) 42425bb815Sopenharmony_ciMBED_CLI_FLAGS += --profile ./mbed-os/tools/profiles/debug.json 43425bb815Sopenharmony_ciendif 44425bb815Sopenharmony_ci 45425bb815Sopenharmony_ciifeq ($(MBED_VERBOSE), 1) 46425bb815Sopenharmony_ciMBED_CLI_FLAGS += -v 47425bb815Sopenharmony_cielse ifeq ($(MBED_VERBOSE), 2) 48425bb815Sopenharmony_ciMBED_CLI_FLAGS += -vv 49425bb815Sopenharmony_ciendif 50425bb815Sopenharmony_ci 51425bb815Sopenharmony_ciMBED_CLI_FLAGS += -D "JERRY_GLOBAL_HEAP_SIZE=$(HEAPSIZE)" 52425bb815Sopenharmony_ciMBED_CLI_FLAGS += -t GCC_ARM 53425bb815Sopenharmony_ci 54425bb815Sopenharmony_ci.PHONY: all js2c getlibs rebuild library 55425bb815Sopenharmony_ciall: source/jerry-targetjs.h source/pins.cpp .mbed ../../.mbedignore 56425bb815Sopenharmony_ci mbed target $(BOARD) 57425bb815Sopenharmony_ci mbed compile $(MBED_CLI_FLAGS) 58425bb815Sopenharmony_ci 59425bb815Sopenharmony_cilibrary: .mbed ../../.mbedignore 60425bb815Sopenharmony_ci # delete encoded js code if it exists 61425bb815Sopenharmony_ci rm -f source/jerry-targetjs.h 62425bb815Sopenharmony_ci mbed target $(BOARD) 63425bb815Sopenharmony_ci mbed compile $(MBED_CLI_FLAGS) --library 64425bb815Sopenharmony_ci 65425bb815Sopenharmony_ciclean: 66425bb815Sopenharmony_ci rm -rf ./BUILD/$(BOARD) 67425bb815Sopenharmony_ci 68425bb815Sopenharmony_cijs2c: js/main.js js/flash_leds.js 69425bb815Sopenharmony_ci python ../../tools/js2c.py --ignore pins.js 70425bb815Sopenharmony_ci 71425bb815Sopenharmony_cisource/pins.cpp: 72425bb815Sopenharmony_ci python tools/generate_pins.py ${BOARD} 73425bb815Sopenharmony_ci 74425bb815Sopenharmony_ciifeq ($(NO_JS),0) 75425bb815Sopenharmony_cisource/jerry-targetjs.h: js2c 76425bb815Sopenharmony_cielse 77425bb815Sopenharmony_cisource/jerry-targetjs.h: ; 78425bb815Sopenharmony_ciendif 79425bb815Sopenharmony_ci 80425bb815Sopenharmony_cigetlibs: .mbed 81425bb815Sopenharmony_ci 82425bb815Sopenharmony_ci.mbed: 83425bb815Sopenharmony_ci echo 'ROOT=.' > .mbed 84425bb815Sopenharmony_ci mbed config root . 85425bb815Sopenharmony_ci mbed toolchain GCC_ARM 86425bb815Sopenharmony_ci mbed target $(BOARD) 87425bb815Sopenharmony_ci mbed deploy 88425bb815Sopenharmony_ci 89425bb815Sopenharmony_ci../../.mbedignore: 90425bb815Sopenharmony_ciifeq ($(OS),Windows_NT) 91425bb815Sopenharmony_ci copy template-mbedignore.txt ..\..\.mbedignore 92425bb815Sopenharmony_cielse 93425bb815Sopenharmony_ci cp ./template-mbedignore.txt ../../.mbedignore 94425bb815Sopenharmony_ciendif 95