-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (48 loc) · 1.62 KB
/
Makefile
File metadata and controls
63 lines (48 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
## Default goal
.DEFAULT_GOAL := help
SHELL := /bin/bash
ROOT_DIR := $(abspath $(CURDIR))
EX_DIR := examples
SELECT_PROBE_SCRIPT := $(ROOT_DIR)/scripts/select-probe.sh
EXAMPLES := stm32g0-charging stm32g0-otg stm32g0-sc8815-sw2303 stm32g4
.PHONY: help select-probe
help:
@echo 'Usage:'
@echo ' 1. eval "$$(make -s select-probe)"'
@echo ' 2. make <target>'
@echo
@echo 'Targets by example (release build + probe-rs tooling):'
@for ex in $(EXAMPLES); do \
echo " $$ex: help run build attach reset reset-attach select-probe"; \
done
@echo
@echo 'Shortcuts:'
@echo ' run-<example> -> make -C examples/<example> run'
@echo ' build-<example> -> make -C examples/<example> build'
@echo ' attach-<example> -> make -C examples/<example> attach'
@echo ' reset-<example> -> make -C examples/<example> reset'
@echo ' reset-attach-<example> -> make -C examples/<example> reset-attach'
@echo ' help-<example> -> make -C examples/<example> help'
@echo
@echo 'Examples:'
@echo ' make run-stm32g0-otg'
@echo ' make -C examples/stm32g0-otg help'
@echo ' eval "$$(make -s select-probe)"'
select-probe:
@$(SELECT_PROBE_SCRIPT)
define MAKE_DELEGATES
.PHONY: run-$(1) build-$(1) attach-$(1) reset-$(1) reset-attach-$(1) help-$(1)
run-$(1):
$(MAKE) -C $(EX_DIR)/$(1) run
build-$(1):
$(MAKE) -C $(EX_DIR)/$(1) build
attach-$(1):
$(MAKE) -C $(EX_DIR)/$(1) attach
reset-$(1):
$(MAKE) -C $(EX_DIR)/$(1) reset
reset-attach-$(1):
$(MAKE) -C $(EX_DIR)/$(1) reset-attach
help-$(1):
$(MAKE) -C $(EX_DIR)/$(1) help
endef
$(foreach ex,$(EXAMPLES),$(eval $(call MAKE_DELEGATES,$(ex))))