forked from WebThingsIO/webthing-arduino
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
69 lines (51 loc) · 1.73 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
#!/usr/bin/make -f
# SPDX-License-Identifier: MPL-2.0
#{
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
#}
default: rule/help
topdir?=${CURDIR}
extra_dir?=${topdir}/tmp
arduino_version?=1.8.5
arduino_host?=linux32
arduino_url?=https://downloads.arduino.cc/arduino-${arduino_version}-${arduino_host}.tar.xz
ARDUINO_DIR?=${extra_dir}/arduino-${arduino_version}
arduino_mk_url?=https://github.com/sudar/Arduino-Makefile
ARDMK_DIR?=${extra_dir}/arduino-mk
rule/help:
@echo "# Usage:"
@echo "# make rule/setup # Will install tools and deps"
@echo "# make rule/all # Will build all examples"
${ARDUINO_DIR}:
mkdir -p ${@D}
cd ${@D} && curl ${arduino_url} | tar -xJ
rule/arduino_dir: ${ARDUINO_DIR}
ls $<
${ARDMK_DIR}:
mkdir -p ${@D}
git clone --recursive --depth 1 ${arduino_mk_url} $@
rule/arduino_mk_dir: ${ARDMK_DIR}
ls $<
#{ Libraries
USER_LIB_PATH?=${extra_dir}/Arduino/libraries
ArduinoJson_url?=https://github.com/bblanchon/ArduinoJson
ArduinoJson_dir?=${extra_dir}/Arduino/libraries/ArduinoJson
${ArduinoJson_dir}:
@mkdir -p ${@D}
git clone --depth 1 --recursive ${ArduinoJson_url} $@
ArduinoMDNS_url=https://github.com/arduino-libraries/ArduinoMDNS
ArduinoMDNS_dir?=${extra_dir}/Arduino/libraries/ArduinoMDNS
${ArduinoMDNS_dir}:
@mkdir -p ${@D}
git clone --depth 1 --recursive ${ArduinoMDNS_url} $@
rule/arduino_lib_dirs: ${ArduinoMDNS_dir} ${ArduinoJson_dir}
ls $^
#}
rule/setup: rule/arduino_dir rule/arduino_mk_dir rule/arduino_lib_dirs
sync
rule/all: $(wildcard examples/*/Makefile | sort)
for file in $^; do \
dirname=$$(dirname -- "$${file}") ; ${MAKE} -C $${dirname}; \
done