forked from sdo9/talking-multimeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
98 lines (76 loc) · 3.16 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
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
87
88
89
90
91
92
93
94
95
96
97
98
# Language for word list selection.
# Can be overridden on the command line e.g. "make WORD_LIST_LANGUAGE=fr ..."
WORD_LIST_LANGUAGE := en
#WORD_LIST_LANGUAGE := fr
# eSpeak voice to use.
# Can be overriden on the command line e.g. "make VOICE=en-us ..."
VOICE ?= $(WORD_LIST_LANGUAGE)
all: writer dmm
build/words-flash-writer build/dmm-talking-arduino-sketch:
mkdir -p $@ && cd $@ && ano init
build/Adafruit_TinyFlash:
mkdir -p build && cd build && \
git clone https://github.com/adafruit/Adafruit_TinyFlash
build/%/lib/Adafruit_TinyFlash \
: patches/tiny-flash.diff | build/Adafruit_TinyFlash build/%
rm -rf $@ && cp -a build/Adafruit_TinyFlash $@ && \
patch -d $@ -p1 < patches/tiny-flash.diff
build/words-flash-writer/%: words-flash-writer/% | build/words-flash-writer
cp $< $@
# There is a bug in the ano build system where updated .h files
# are not considered as a proper dependency for a rebuild.
# Let's force it by removing affected product files.
define fixdeps
if [ "$(suffix $@)" = ".h" ]; then cd $(dir $@).. && ano clean; fi
endef
build/words-flash-writer/src/%: words-flash-writer/flash-writer-arduino-sketch/% | build/words-flash-writer
@cp -v $< $@ && $(fixdeps)
build/dmm-talking-arduino-sketch/src/%: dmm-talking-arduino-sketch/% | build/dmm-talking-arduino-sketch
@cp -v $< $@ && $(fixdeps)
build/dmm-talking-arduino-sketch/src/words_def.h: build/words-flash-writer/words_def.h | build/dmm-talking-arduino-sketch
@cp -v $< $@ && $(fixdeps)
writer_src_files := \
$(wildcard words-flash-writer/flash-writer-arduino-sketch/*)
writer_deps := \
build/words-flash-writer/lib/Adafruit_TinyFlash \
$(patsubst words-flash-writer/flash-writer-arduino-sketch/%, \
build/words-flash-writer/src/%, \
$(writer_src_files))
dmm_src_files := \
$(wildcard dmm-talking-arduino-sketch/*)
dmm_deps := \
build/dmm-talking-arduino-sketch/lib/Adafruit_TinyFlash \
build/dmm-talking-arduino-sketch/src/words_def.h \
$(patsubst dmm-talking-arduino-sketch/%, \
build/dmm-talking-arduino-sketch/src/%, \
$(dmm_src_files))
build/words-flash-writer/snd.data \
build/words-flash-writer/words_def.h \
: build/words-flash-writer/make.py build/words-flash-writer/list-$(WORD_LIST_LANGUAGE)
cd build/words-flash-writer && ./make.py --lang="$(WORD_LIST_LANGUAGE)" --voice="$(VOICE)"
writer: $(writer_deps)
cd build/words-flash-writer && \
ano build -m pro --cpu 8MHzatmega328
dmm: $(dmm_deps)
cd build/dmm-talking-arduino-sketch && \
ano build -m pro --cpu 8MHzatmega328
upload_dmm: dmm
cd build/dmm-talking-arduino-sketch && \
ano upload -m pro --cpu 8MHzatmega328
upload_words: build/words-flash-writer/snd.data build/words-flash-writer/sender.py writer
cd build/words-flash-writer && \
ano upload -m pro --cpu 8MHzatmega328 && \
sleep 2 && \
./sender.py
everything: upload_words upload_dmm
watch:
ano serial -b 115200
asmdump:
avr-objdump -d -S build/dmm-talking-arduino-sketch/.build_ano/pro/firmware.elf | less
clean:
rm -rf build/words-flash-writer/
rm -rf build/dmm-talking-arduino-sketch/
distclean:
rm -rf build/
.PHONY: writer dmm upload_dmm upload_words everything watch asmdump clean distclean
GNUMAKEFLAGS := --no-print-directory