45 lines
1.2 KiB
Makefile
45 lines
1.2 KiB
Makefile
override SHELL := /bin/sh
|
|
override MAKEFLAGS += --no-print-directory
|
|
|
|
.DEFAULT_GOAL := help
|
|
.DELETE_ON_ERROR:
|
|
|
|
override CARGO := cargo
|
|
override CARGO_FLAGS := --locked --offline
|
|
|
|
override EMBEDDED_TARGET := thumbv7em-none-eabihf
|
|
override TARGET_DIR := ../target/$(EMBEDDED_TARGET)/release
|
|
override SCRIPTS_DIR := ../scripts
|
|
|
|
override BOARDS := geprc-f722-v2 kakute-f7-mini-v3
|
|
override BOARD_PACKAGES := $(addprefix kaptan-,$(BOARDS))
|
|
override BOARD_PACKAGE_ARGS := $(addprefix -p ,$(BOARD_PACKAGES))
|
|
|
|
override PRIMARY_GOAL := $(firstword $(MAKECMDGOALS))
|
|
|
|
run:
|
|
@exec python3 ../../scripts/make-argv.py exec run $(CARGO) build --release \
|
|
$(CARGO_FLAGS) $(BOARD_PACKAGE_ARGS) --target $(EMBEDDED_TARGET)
|
|
@set -e; for board in $(BOARD_PACKAGES); do \
|
|
$(SCRIPTS_DIR)/create-dfu-image.sh $(TARGET_DIR)/$$board; \
|
|
done
|
|
|
|
ifeq ($(PRIMARY_GOAL),run)
|
|
|
|
.PHONY: run
|
|
|
|
# Application arguments may also look like Make goals. The run recipe recovers
|
|
# their exact boundaries from the original invocation.
|
|
.DEFAULT:
|
|
@:
|
|
|
|
else
|
|
|
|
.PHONY: help run
|
|
|
|
help:
|
|
@printf '%s\n' 'Usage: make firmware/boards -- <cargo build arguments...>' '' \
|
|
'With no arguments, every board is built and packaged.'
|
|
|
|
endif
|