Skip to content

Commit 3d5ff82

Browse files
brianjjonesgrgustaf
authored andcommitted
[build] Creating new make targets for ide and ashell (zephyrproject-rtos#846)
This will allow faster building for ide and ashell (command line). It also cleans the makefile up a bit Signed-off-by: Brian J Jones <[email protected]>
1 parent a8b1885 commit 3d5ff82

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

Makefile

+33-16
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@ ROM ?= 256
44

55
# Dump memory information: on = print allocs, full = print allocs + dump pools
66
TRACE ?= off
7+
78
# 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
817
SNAPSHOT ?= on
18+
ifeq ($(SNAPSHOT), on)
19+
EXT_JERRY_FLAGS += -DFEATURE_JS_PARSER=OFF
20+
endif
21+
endif
922

1023
ifndef ZJS_BASE
1124
$(error ZJS_BASE not defined. You need to source zjs-env.sh)
@@ -51,11 +64,13 @@ EXT_JERRY_FLAGS ?= -DENABLE_ALL_IN_ONE=ON \
5164
-DFEATURE_PROFILE=$(ZJS_BASE)/jerry_feature.profile \
5265
-DFEATURE_ERROR_MESSAGES=OFF \
5366
-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
5872
endif
73+
5974
ifeq ($(BOARD), arduino_101)
6075
EXT_JERRY_FLAGS += -DENABLE_LTO=ON
6176
$(info makecmd: $(MAKECMDGOALS))
@@ -73,12 +88,6 @@ $(info $() $() ROM allocation: $(ROM)KB for X86, $(shell echo $$((296 - $(ROM)))
7388
endif
7489
endif # BOARD = arduino_101
7590

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-
8291
# Print callback statistics during runtime
8392
CB_STATS ?= off
8493
# Print floats (uses -u _printf_float flag). This is a workaround on the A101
@@ -129,7 +138,8 @@ zephyr: analyze generate jerryscript $(ARC)
129138
CB_STATS=$(CB_STATS) \
130139
PRINT_FLOAT=$(PRINT_FLOAT) \
131140
SNAPSHOT=$(SNAPSHOT) \
132-
BLE_ADDR=$(BLE_ADDR)
141+
BLE_ADDR=$(BLE_ADDR) \
142+
DEV=$(DEV)
133143
ifeq ($(BOARD), arduino_101)
134144
@echo
135145
@echo -n Creating dfu images...
@@ -139,6 +149,12 @@ ifeq ($(BOARD), arduino_101)
139149
@echo " done."
140150
endif
141151

152+
.PHONY: ide
153+
ide: zephyr
154+
155+
.PHONY: ashell
156+
ashell: zephyr
157+
142158
# Flash Arduino 101 x86 and arc images
143159
.PHONY: dfu
144160
dfu:
@@ -170,10 +186,6 @@ analyze: $(JS)
170186
@if [ "$(SNAPSHOT)" = "on" ]; then \
171187
echo "ccflags-y += -DZJS_SNAPSHOT_BUILD" >> src/Makefile; \
172188
fi
173-
ifeq ($(DEV), ashell)
174-
@cat fragments/prj.mdef.ashell >> prj.mdef
175-
endif
176-
177189
@echo "ccflags-y += $(shell ./scripts/analyze.sh $(BOARD) $(JS) $(CONFIG) $(DEV))" | tee -a src/Makefile arc/src/Makefile
178190
@sed -i '/This is a generated file/r./zjs.conf.tmp' src/Makefile
179191
@# Add the include for the OCF Makefile only if the script is using OCF
@@ -199,8 +211,13 @@ ifeq ($(BOARD), qemu_x86)
199211
else
200212
ifeq ($(DEV), ashell)
201213
@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
202220
endif
203-
204221
ifeq ($(BOARD), arduino_101)
205222
@cat fragments/prj.conf.arduino_101 >> prj.conf
206223
@printf "CONFIG_PHYS_RAM_ADDR=0xA800%x\n" $$(((80 - $(RAM)) * 1024)) >> prj.conf

fragments/prj.conf.ashell

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ CONFIG_USB=y
1111
CONFIG_USB_DW=y
1212
CONFIG_USB_DEVICE_STACK=y
1313
CONFIG_USB_DW_DEBUG=n
14-
CONFIG_USB_CDC_ACM=n
1514
CONFIG_USB_DEBUG=n
1615
CONFIG_SERIAL=y
1716
CONFIG_UART_INTERRUPT_DRIVEN=y

0 commit comments

Comments
 (0)