-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRules.old.mk
87 lines (70 loc) · 1.95 KB
/
Rules.old.mk
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
$(module-header,old,$/Rules.old.mk)
#
# ------------ --
#DIR := $/mydir
#include $(call rules,$(DIR)/)
#
# DMK += $/dynamic-makefile.mk
# DEP += $/generated-dependency
# TRGT += $/build-target
# CLN += $/tmpfile
# TEST += $/testtarget
CLN += $(shell find $/ -name .dep -or -name .lib -o -name *.o -o -name *.swp -o -name *.swo)
ARDUINO_DIR = /usr/share/arduino
PORTS = \
USB0=/dev/ttyUSB0 \
USB1=/dev/ttyUSB1 \
USB2=/dev/ttyUSB2 \
usbserial=/dev/tty.usbserial-A900TTH0
BOARDS_FILES := $(wildcard \
$(ARDUINO_DIR)/hardware/*/boards.txt \
./hardware/*/boards.txt)
# TODO filter boards for existing entry
# BRD
# PRT
define build-arduino-firmware
[ -e "$<" ] && { \
$(ll) attention "$@" "Building flash image, board $(BRD).." "$(<)"; \
} || { \
echo "Missing source"; \
$(ll) error "$@" "Missing source" "$<"; \
exit 1; \
};
P=$$(realpath .); \
BOARDS_TXT=$(shell grep -l '$(BRD).name=' $(BOARDS_FILES));\
cd $$(dirname $<); \
make -f $$P/arduino.debian.mk \
ARDUINO_DIR=$(ARDUINO_DIR) \
BOARDS_TXT=$$BOARDS_TXT \
BOARD_TAG=$(BRD) \
ARDUINO_PORT=$(call key,PORTS,$(PRT)) \
ARDUINO_LIBS=$(ARDUINO_LIBS) \
$(ARDUINO_TARGETS);
[ -e "$@" ] && { \
$(ll) ok "$@" "Done"; \
} || { \
$(ll) error "$@" "Missing target"; \
exit 1; \
};
endef
$/%.hex: $/%.ino
@\
$(build-arduino-firmware)
$/%.hex: $/%.pde
@\
$(build-arduino-firmware)
Mpe/CarrierCase/CarrierCase.hex: BRD := uno
carriercase: BRD := uno
carriercase: P := Mpe/CarrierCase/
carriercase: I := Mpe/CarrierCase/CarrierCase.hex
carriercase: jeenode upload
# XXX: how does Mpe/MySketch/MySketch.hex get to firmware/Mpe-MySketch-<version>-<static-params>-<board>.hex
# Or how does some rule or one like this trigger the build and rename of
# Mpe/MySketch?
#firmware/Mpe-CarrierCase-uno-DEBUG.hex: DEBUG_BUILD := 1
# via params perhaps
#firmware/Mpe-CarrierCase.builds
# XXX: look at passing env vars
# ------------ --
#
# vim:noet: