-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
114 lines (82 loc) · 2.37 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/make -f
# -*- makefile -*-
# SPDX-License-Identifier: Apache-2.0
# Copyright: 2018-present Samsung Electronics France SAS, and contributors
default: help start
-sync
example_file?=index.js
IOTJS_EXTRA_MODULE_PATH?=../..
export IOTJS_EXTRA_MODULE_PATH
port?=8888
base_url?=http://localhost:${port}
runtime?=iotjs
iotjs_modules_dir?=${CURDIR}/iotjs_modules
webthing-iotjs_url?=https://github.com/rzr/webthing-iotjs
webthing-iotjs_revision?=webthing-iotjs-0.12.1-1
webthing-iotjs_dir?=${iotjs_modules_dir}/webthing-iotjs
iotjs_modules_dirs+=${webthing-iotjs_dir}
message?=${webthing-iotjs_url} \#WebThingIotJs test using \#MastodonLite
run_args+=${port}
help:
@echo "## Usage:"
@echo "# make start # will start sensor server"
@echo "# make demo"
@echo "# make put # will start actuator server"
@echo "# make client/put"
@echo '# make client/put message="$${message}"'
${webthing-iotjs_dir}:
@mkdir -p $@
git clone --depth 1 --recursive --branch ${webthing-iotjs_revision} ${webthing-iotjs_url} $@
make -C $@ iotjs/modules iotjs_modules_dir=${iotjs_modules_dir}
iotjs/start: ${example_file} modules
iotjs $< ${run_args}
iotjs/debug: ${example_file}
rm -rf node_modules
NODE_PATH=iotjs_modules:../.. node $<
test: client/get client/post
curl ${base_url}/properties/message
client/get:
curl ${base_url}
@echo
curl ${base_url}/properties
@echo
curl ${base_url}/properties/message
@echo
client/put:
curl \
-X PUT \
-H "Content-Type: application/json" \
--data "{\"message\":\"${message}\"}" \
"${base_url}/properties/message"
@echo
client/post: client/put
@echo "# TODO: $@ maybe be implemented differently than $<"
iotjs_modules: ${iotjs_modules_dirs}
ls $<
node_modules: package.json
npm install
node/modules: node_modules
ls $<
modules: ${runtime}/modules
@echo "# $@: $^"
node/start: node_modules
npm start ${run_args}
start: ${runtime}/start
@echo "# $@: $^"
run: start
@echo "# $@: $^"
cleanall:
rm -rf iotjs_modules node_modules
put:
${MAKE} ${runtime}/start run_args="${port} $@"
get:
${MAKE} ${runtime}/start run_args="${port} $@"
timelines/%: ${example_file} ${iotjs_modules_subdirs}
iotjs $< ${run_args} get '$@?limit=1'
# npm start ${run_args} get '$@?limit=1'
${HOME}/.mastodon-lite.conf: ../../mastodon-lite.js
make -C ${<D} start
demo: timelines/home ${HOME}/.mastodon-lite.conf
@echo "# $@: $^"
iotjs/modules: ${iotjs_modules_dirs}
ls $<