-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.ciq
105 lines (83 loc) · 2.36 KB
/
Makefile.ciq
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
99
100
101
102
103
104
105
## ConnectIQ resources
# SDK root path
ifndef CIQ_ROOT
CIQ_ROOT := /opt/connectiq-sdk-linux
endif
# Monkey C compiler
ifndef CIQ_MONKEYC
CIQ_MONKEYC := ${CIQ_ROOT}/bin/monkeyc
endif
# Simulator
ifndef CIQ_SIMULATOR
CIQ_SIMULATOR := ${CIQ_ROOT}/bin/simulator
endif
# Simulation launcher
ifndef CIQ_MONKEYDO
CIQ_MONKEYDO := ${CIQ_ROOT}/bin/monkeydo
endif
# FIT-file viewer
ifndef CIQ_MONKEYGRAPH
CIQ_MONKEYGRAPH := ${CIQ_ROOT}/bin/fit-graph.jar
endif
# Target API version
ifndef CIQ_API
CIQ_API := 3.0.0
endif
# Target device
ifndef CIQ_DEVICE
CIQ_DEVICE := d2charlie
endif
# Developer key
ifndef CIQ_DEVKEY
CIQ_DEVKEY := /undefined/GarminConnectIQ-developer-key.der
endif
# FIT-file
ifndef CIQ_FITFILE
CIQ_FITFILE := ./session.fit
endif
## Build environment (verify)
# SDK root path
${CIQ_ROOT}:
$(error Invalid SDK root path; CIQ_ROOT=${CIQ_ROOT})
# Monkey C compiler
${CIQ_MONKEYC}: | ${CIQ_ROOT}
$(error Invalid Monkey C compiler path; CIQ_MONKEYC=${CIQ_MONKEYC})
# Simulator
${CIQ_SIMULATOR}: | ${CIQ_ROOT}
$(error Invalid simulator path; CIQ_SIMULATOR=${CIQ_SIMULATOR})
# Simulation launcher
${CIQ_MONKEYDO}: | ${CIQ_ROOT}
$(error Invalid simulation launcher path; CIQ_MONKEYDO=${CIQ_MONKEYDO})
# FIT-file viewer
${CIQ_MONKEYGRAPH}: | ${CIQ_ROOT}
$(error Invalid FIT-file viewer path; CIQ_MONKEYGRAPH=${CIQ_MONKEYGRAPH})
# Developer key
${CIQ_DEVKEY}:
$(error Invalid developer key; CIQ_DEVKEY=${CIQ_DEVKEY})
# FIT-file
${CIQ_FITFILE}:
$(error Invalid FIT-file; CIQ_FITFILE=${CIQ_FITFILE})
## Helpers
# Help
.PHONY: ciq-help
ciq-help:
@echo 'ConnectIQ targets:'
@echo ' ciq-help - display this help message'
@echo ' ciq-devices - list available target devices'
@echo 'Environment (variables):'
@echo ' CIQ_ROOT = ${CIQ_ROOT}'
@echo ' CIQ_MONKEYC = ${CIQ_MONKEYC}'
@echo ' CIQ_SIMULATOR = ${CIQ_SIMULATOR}'
@echo ' CIQ_MONKEYDO = ${CIQ_MONKEYDO}'
@echo ' CIQ_API = ${CIQ_API}'
@echo ' CIQ_DEVICE = ${CIQ_DEVICE}'
@echo ' CIQ_DEVKEY = ${CIQ_DEVKEY}'
@echo ' CIQ_FITFILE = ${CIQ_FITFILE}'
# Devices
.PHONY: ciq-devices
ciq-devices:
@find ${HOME}/.Garmin/ConnectIQ/Devices/ -maxdepth 2 -name compiler.json \
| sort \
| while read -r device; do \
jq -r '.deviceId+" "+ .deviceFamily+" "+(.appTypes[]|select(.type=="watchApp")|.memoryLimit|tostring)+" "+(.partNumbers[]|(.connectIQVersion+" ("+.number+")"))' "$${device}" \
; done