-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (44 loc) · 1.06 KB
/
Makefile
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
TARGET ?= /dev/ttyACM0
IVORYFLAGS ?= --const-fold
APPS := \
logger \
lorawan
TESTS := \
ads-test \
blink-test \
heater-test \
radiocommand-test \
rfm-test \
rfm-init-test \
rfm-loopback-test \
uartbridge-test
CLEANS := \
$(foreach test,$(TESTS),$(test)-clean) \
$(foreach app,$(APPS),$(app)-clean)
GDB := arm-none-eabi-gdb \
--ex 'target extended-remote $(TARGET)' \
--ex 'monitor connect_srst disable' \
--ex 'monitor swdp_scan' \
--ex 'set mem inaccessible-by-default off' \
--ex 'attach 1'
.PHONY: test clean $(TESTS) $(CLEANS)
test: $(TESTS)
clean: $(CLEANS)
define MKTEST
$(1):
cabal new-run $(1)-gen -- --src-dir=build/$(1) $(IVORYFLAGS)
make -C build/$(1)
$(1)-clean:
rm -rf dist-newstyle
rm -rf build/$(1)
$(1)-gdb: $(1)
$(GDB) build/$(1)/image
$(1)-gdbtui: $(1)
$(GDB) -tui build/$(1)/image
$(1)-load: $(1)
$(GDB) --ex 'load' build/$(1)/image
$(1)-run: $(1)
$(GDB) --ex 'load' --ex 'run' build/$(1)/image
endef
$(foreach test,$(APPS),$(eval $(call MKTEST,$(test))))
$(foreach test,$(TESTS),$(eval $(call MKTEST,$(test))))