mongoose/examples/zephyr/http-server/Makefile

60 lines
1.9 KiB
Makefile
Raw Normal View History

2022-10-06 05:07:05 +08:00
MONGOOSE_ROOT ?= $(realpath $(CURDIR)/../../..)
DOCKER_PROJECT_DIR ?= /workdir
ZEPHYR_DIR ?= zephyrproject
2022-10-06 05:07:05 +08:00
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)
2022-10-06 05:07:05 +08:00
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
2022-10-06 05:07:05 +08:00
DOCKER ?= docker run --rm -v $(PROJECT_PATH):$(DOCKER_PROJECT_PATH) -v $(ZEPHYR_PATH):$(DOCKER_ZEPHYR_PATH)
REPO ?= zephyrprojectrtos/ci
2022-04-07 20:29:42 +08:00
example:
true
build:
2023-02-01 01:51:48 +08:00
cp $(MONGOOSE_ROOT)/mongoose.[ch] src/
2022-10-06 05:07:05 +08: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 20:29:42 +08:00
run:
2022-10-06 05:07:05 +08:00
$(DOCKER) -it $(SHARETUN) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
west build -t run --build-dir $(DOCKER_PROJECT_PATH)/build'
2022-04-07 20:29:42 +08:00
clean:
2022-10-06 05:07:05 +08:00
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
west build -t clean --build-dir $(DOCKER_PROJECT_PATH)/build'
pristine:
2022-10-06 05:07:05 +08:00
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
west build -t pristine --build-dir $(DOCKER_PROJECT_PATH)/build'
flash:
2022-10-06 05:07:05 +08:00
$(DOCKER) $(SHAREUSB) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && \
west flash --build-dir $(DOCKER_PROJECT_PATH)/build'
debug:
2022-10-06 05:07:05 +08:00
$(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
2022-10-06 05:07:05 +08:00
zephyr:
ifeq ($(wildcard $(ZEPHYR_PATH)/.*),)
mkdir $(ZEPHYR_PATH)
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_PROJECT_DIR) && west init ./$(ZEPHYR_DIR)'
endif
2022-10-06 05:07:05 +08:00
$(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && west update'