2022-10-05 18:07:05 -03:00
|
|
|
MONGOOSE_ROOT ?= $(realpath $(CURDIR)/../../..)
|
|
|
|
DOCKER_PROJECT_DIR ?= /workdir
|
|
|
|
ZEPHYR_DIR ?= zephyrproject
|
|
|
|
PROJECT_NAME = $(notdir $(CURDIR))
|
|
|
|
PROJECT_PATH = $(realpath $(CURDIR))
|
|
|
|
ZEPHYR_PATH = $(realpath $(CURDIR)/..)/$(ZEPHYR_DIR)
|
|
|
|
DOCKER_PROJECT_PATH = $(DOCKER_PROJECT_DIR)/$(PROJECT_NAME)
|
|
|
|
DOCKER_ZEPHYR_PATH = $(DOCKER_PROJECT_DIR)/$(ZEPHYR_DIR)
|
|
|
|
|
|
|
|
BOARD ?= qemu_x86
|
|
|
|
ifeq "$(BOARD)" "qemu_x86"
|
|
|
|
OVERLAY ?= -DOVERLAY_CONFIG=overlay-e1000.conf
|
|
|
|
else
|
|
|
|
OVERLAY ?=
|
|
|
|
endif
|
|
|
|
|
|
|
|
SHAREUSB ?= --privileged -v /dev/bus/usb/:/dev/bus/usb
|
|
|
|
SHARETUN ?= --cap-add=NET_ADMIN --device /dev/net/tun --net=host
|
|
|
|
DOCKER ?= docker run --rm -v $(PROJECT_PATH):$(DOCKER_PROJECT_PATH) -v $(ZEPHYR_PATH):$(DOCKER_ZEPHYR_PATH)
|
|
|
|
REPO ?= zephyrprojectrtos/ci
|
|
|
|
|
2022-04-07 15:29:42 +03:00
|
|
|
|
|
|
|
example:
|
|
|
|
true
|
|
|
|
|
|
|
|
build:
|
2023-01-31 14:51:48 -03:00
|
|
|
cp $(MONGOOSE_ROOT)/mongoose.[ch] src/
|
2022-10-05 18:07:05 -03:00
|
|
|
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH)/zephyr && \
|
|
|
|
west build -b $(BOARD) -p auto $(DOCKER_PROJECT_PATH) $(OVERLAY) --build-dir $(DOCKER_PROJECT_PATH)/build'
|
2022-04-07 15:29:42 +03:00
|
|
|
|
2022-10-05 18:07:05 -03:00
|
|
|
run:
|
|
|
|
$(DOCKER) -it $(SHARETUN) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
|
|
|
|
west build -t run --build-dir $(DOCKER_PROJECT_PATH)/build'
|
2022-04-07 15:29:42 +03:00
|
|
|
|
|
|
|
clean:
|
2022-10-05 18:07:05 -03:00
|
|
|
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
|
|
|
|
west build -t clean --build-dir $(DOCKER_PROJECT_PATH)/build'
|
|
|
|
|
|
|
|
pristine:
|
|
|
|
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
|
|
|
|
west build -t pristine --build-dir $(DOCKER_PROJECT_PATH)/build'
|
|
|
|
|
|
|
|
|
|
|
|
flash:
|
|
|
|
$(DOCKER) $(SHAREUSB) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
|
|
|
|
west flash --build-dir $(DOCKER_PROJECT_PATH)/build'
|
|
|
|
|
|
|
|
debug:
|
|
|
|
$(DOCKER) -it $(SHAREUSB) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
|
|
|
|
west debug --build-dir $(DOCKER_PROJECT_PATH)/build'
|
|
|
|
|
|
|
|
.PHONY: build flash zephyr clean pristine run
|
|
|
|
|
|
|
|
zephyr:
|
|
|
|
ifeq ($(wildcard $(ZEPHYR_PATH)/.*),)
|
|
|
|
mkdir $(ZEPHYR_PATH)
|
|
|
|
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_PROJECT_DIR) && west init ./$(ZEPHYR_DIR)'
|
|
|
|
endif
|
|
|
|
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && west update'
|