@@ -4,8 +4,21 @@ ROM ?= 256
4
4
5
5
# Dump memory information: on = print allocs, full = print allocs + dump pools
6
6
TRACE ?= off
7
+
7
8
# Generate and run snapshot as byte code instead of running JS directly
9
+ ifneq (,$(filter $(MAKECMDGOALS ) ,ide ashell linux) )
10
+ SNAPSHOT =off
11
+ # if the user passes in SNAPSHOT=on for ide, ashell, or linux give an error
12
+ ifeq ($(SNAPSHOT ) , on)
13
+ $(error ide, ashell, and linux do not support SNAPSHOT=$(SNAPSHOT))
14
+ endif
15
+ else
16
+ # snapshot is enabled by default
8
17
SNAPSHOT ?= on
18
+ ifeq ($(SNAPSHOT ) , on)
19
+ EXT_JERRY_FLAGS += -DFEATURE_JS_PARSER=OFF
20
+ endif
21
+ endif
9
22
10
23
ifndef ZJS_BASE
11
24
$(error ZJS_BASE not defined. You need to source zjs-env.sh)
@@ -51,11 +64,13 @@ EXT_JERRY_FLAGS ?= -DENABLE_ALL_IN_ONE=ON \
51
64
-DFEATURE_PROFILE=$(ZJS_BASE ) /jerry_feature.profile \
52
65
-DFEATURE_ERROR_MESSAGES=OFF \
53
66
-DJERRY_LIBM=OFF
54
- ifneq ($(DEV ) , ashell)
55
- ifeq ($(SNAPSHOT ) , on)
56
- EXT_JERRY_FLAGS += -DFEATURE_JS_PARSER=OFF
57
- endif
67
+
68
+ # Settings for ashell builds
69
+ ifneq (,$(filter $(MAKECMDGOALS ) ,ide ashell) )
70
+ CONFIG ?= fragments/zjs.conf.dev
71
+ DEV =ashell
58
72
endif
73
+
59
74
ifeq ($(BOARD ) , arduino_101)
60
75
EXT_JERRY_FLAGS += -DENABLE_LTO=ON
61
76
$(info makecmd : $(MAKECMDGOALS ) )
@@ -73,12 +88,6 @@ $(info $() $() ROM allocation: $(ROM)KB for X86, $(shell echo $$((296 - $(ROM)))
73
88
endif
74
89
endif # BOARD = arduino_101
75
90
76
- # if no config file passed use the ashell default
77
- ifeq ($(DEV ) , ashell)
78
- CONFIG ?= fragments/zjs.conf.dev
79
- SNAPSHOT = off
80
- endif
81
-
82
91
# Print callback statistics during runtime
83
92
CB_STATS ?= off
84
93
# Print floats (uses -u _printf_float flag). This is a workaround on the A101
@@ -129,7 +138,8 @@ zephyr: analyze generate jerryscript $(ARC)
129
138
CB_STATS=$(CB_STATS ) \
130
139
PRINT_FLOAT=$(PRINT_FLOAT ) \
131
140
SNAPSHOT=$(SNAPSHOT ) \
132
- BLE_ADDR=$(BLE_ADDR )
141
+ BLE_ADDR=$(BLE_ADDR ) \
142
+ DEV=$(DEV )
133
143
ifeq ($(BOARD ) , arduino_101)
134
144
@echo
135
145
@echo -n Creating dfu images...
@@ -139,6 +149,12 @@ ifeq ($(BOARD), arduino_101)
139
149
@echo " done."
140
150
endif
141
151
152
+ .PHONY : ide
153
+ ide : zephyr
154
+
155
+ .PHONY : ashell
156
+ ashell : zephyr
157
+
142
158
# Flash Arduino 101 x86 and arc images
143
159
.PHONY : dfu
144
160
dfu :
@@ -170,10 +186,6 @@ analyze: $(JS)
170
186
@if [ " $( SNAPSHOT) " = " on" ]; then \
171
187
echo " ccflags-y += -DZJS_SNAPSHOT_BUILD" >> src/Makefile; \
172
188
fi
173
- ifeq ($(DEV ) , ashell)
174
- @cat fragments/prj.mdef.ashell >> prj.mdef
175
- endif
176
-
177
189
@echo " ccflags-y += $( shell ./scripts/analyze.sh $( BOARD) $( JS) $( CONFIG) $( DEV) ) " | tee -a src/Makefile arc/src/Makefile
178
190
@sed -i ' /This is a generated file/r./zjs.conf.tmp' src/Makefile
179
191
@# Add the include for the OCF Makefile only if the script is using OCF
@@ -199,8 +211,13 @@ ifeq ($(BOARD), qemu_x86)
199
211
else
200
212
ifeq ($(DEV ) , ashell)
201
213
@cat fragments/prj.conf.ashell >> prj.conf
214
+ @cat fragments/prj.mdef.ashell >> prj.mdef
215
+ ifeq ($(filter ide,$(MAKECMDGOALS ) ) ,ide)
216
+ @echo CONFIG_USB_CDC_ACM=n >> prj.conf
217
+ else
218
+ @echo CONFIG_USB_CDC_ACM=y >> prj.conf
219
+ endif
202
220
endif
203
-
204
221
ifeq ($(BOARD ) , arduino_101)
205
222
@cat fragments/prj.conf.arduino_101 >> prj.conf
206
223
@printf "CONFIG_PHYS_RAM_ADDR=0xA800%x\n" $$(((80 - $(RAM)) * 1024)) >> prj.conf
0 commit comments