aboutsummaryrefslogtreecommitdiff
path: root/targets/riot-stm32f4/Makefile
blob: e8030cab083abf30eab7f19dcac326e4c6f73908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed 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.

# application name
APPLICATION = riot_jerryscript

# default BOARD enviroment
BOARD ?= stm32f4discovery

# path to jerryscript/targets/riot-stm32f4
TARGET_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

# path to the JERRYSCRIPT directory
JERRYDIR ?= $(TARGET_DIR)/../..

# path to the RIOT base directory
RIOTBASE ?= $(JERRYDIR)/../RIOT

# path to the application directory
APPDIR ?= $(JERRYDIR)/targets/riot-stm32f4/source

# path to the binary directory
BUILDDIR ?= $(JERRYDIR)/build/riot-stm32f4

# path to the binary directory
BINDIR ?= $(BUILDDIR)/bin

# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

INCLUDES += -I$(JERRYDIR)/jerry-core/include
INCLUDES += -I$(JERRYDIR)/jerry-ext/include

ARCHIVES += $(JERRYDIR)/build/lib/libjerry-core.a
ARCHIVES += $(JERRYDIR)/build/lib/libjerry-ext.a
ARCHIVES += $(JERRYDIR)/build/lib/libjerry-port-default.a

USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += posix_sleep

.PHONY: libjerry
libjerry:
	$(JERRYDIR)/tools/build.py \
		--clean \
		--lto=OFF \
		--jerry-cmdline=OFF \
		--jerry-math=ON \
		--amalgam=ON \
		--mem-heap=70 \
		--profile=es.next \
		--compile-flag=-fshort-enums \
		--toolchain=$(abspath $(JERRYDIR)/cmake/toolchain_mcu_stm32f4.cmake)

.PHONY: clear-cflags
clear-cflags:
	$(eval BACKUP := $(CFLAGS))
	$(eval CFLAGS := )

.PHONY: restore-cflags
restore-cflags:
	$(eval CFLAGS := $(BACKUP))

# CFLAGS is filled by Makefile.include that is only for RIOT.
# Clear CFLAGS temporarily while compiling JerryScript.
all: clear-cflags libjerry restore-cflags

include $(RIOTBASE)/Makefile.include