mongoose/examples/zephyr/device-dashboard/Makefile

47 lines
1.3 KiB
Makefile
Raw Normal View History

2023-03-09 03:38:38 +08:00
TOP_DIR ?= $(realpath $(CURDIR)/../../..)
ZEPHYR_DIR ?= $(realpath $(CURDIR)/..)/zephyrproject
DOCKER ?= docker run --rm \
-v $(TOP_DIR):$(TOP_DIR) \
-w $(realpath $(CURDIR)) \
-e ZEPHYR_BASE=$(ZEPHYR_DIR)/zephyr \
$(DOCKER_ARGS) zephyrprojectrtos/ci
BUILD_ARGS ?= -b nucleo_f746zg
.PHONY: build
2022-10-06 05:13:00 +08:00
example:
true
2023-03-09 03:38:38 +08:00
zephyr:
test -d $(ZEPHYR_DIR) || ( mkdir -p $(ZEPHYR_DIR) ; $(DOCKER) west init $(ZEPHYR_DIR))
$(DOCKER) sh -c 'cd $(ZEPHYR_DIR) && west update'
2022-10-06 05:13:00 +08:00
build:
2023-03-09 03:38:38 +08:00
cp $(TOP_DIR)/mongoose.[ch] src/
2023-05-27 01:43:36 +08:00
cp $(TOP_DIR)/examples/device-dashboard/net.[ch] src/
2023-03-09 03:38:38 +08:00
cp $(TOP_DIR)/examples/device-dashboard/packed_fs.c src/
$(DOCKER) west build $(BUILD_ARGS) -p auto $(realpath $(CURDIR)) $(OVERLAY)
2022-10-06 05:13:00 +08:00
2023-03-09 03:38:38 +08:00
run: DOCKER_ARGS ?= --cap-add=NET_ADMIN --device /dev/net/tun --net=host -it
2022-10-06 05:13:00 +08:00
run:
2023-03-09 03:38:38 +08:00
$(DOCKER) west build -t run
2022-10-06 05:13:00 +08:00
clean:
2023-03-09 03:38:38 +08:00
-$(DOCKER) west build -t clean
2022-10-06 05:13:00 +08:00
pristine:
2023-03-09 03:38:38 +08:00
-$(DOCKER) west build -t pristine
2022-10-06 05:13:00 +08:00
2023-03-09 03:38:38 +08:00
purge: clean pristine
rm -rf $(TOP_DIR)/.west $(ZEPHYR_DIR) build
2022-10-06 05:13:00 +08:00
2023-03-09 03:38:38 +08:00
flash debug: DOCKER_ARGS ?= --privileged -v /dev/bus/usb/:/dev/bus/usb -it
2022-10-06 05:13:00 +08:00
flash:
2023-03-09 03:38:38 +08:00
$(DOCKER) west flash --build-dir $(realpath $(CURDIR))/build
2022-10-06 05:13:00 +08:00
debug:
2023-03-09 03:38:38 +08:00
$(DOCKER) west debug --build-dir $(realpath $(CURDIR))/build
2022-10-06 05:13:00 +08:00
2023-03-09 03:38:38 +08:00
test: BUILD_ARGS = -b qemu_x86
test: OVERLAY = -DOVERLAY_CONFIG=overlay-e1000.conf
test: build run