-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
129 lines (96 loc) · 2.3 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/make -f
# -*- makefile -*-
# SPDX-License-Identifier: MIT
# Copyright: 2018-present Samsung Electronics France SAS, and contributors
default: help
-sync
project?=iotjs-express
example?=example/index.js
eslint_file?=node_modules/eslint/bin/eslint.js
runtime?=iotjs
deploy_dir ?= ${CURDIR}/tmp/deploy
deploy_modules_dir ?= ${deploy_dir}/iotjs_modules
deploy_module_dir ?= ${deploy_modules_dir}/${project}
deploy_srcs += ${deploy_module_dir}/lib/express.js
deploy_srcs += ${deploy_module_dir}/index.js
hostname?=localhost
domain?=
port?=8080
endpoint?=/
host?=${hostname}${domain}
url?=http://${host}:${port}${endpoint}
help:
@echo "## Usage:"
@echo "# make iotjs/setup"
@echo "# make iotjs/start"
@echo "# make node/start"
@echo "# make start"
@echo "# make lint"
@echo "# make check"
@echo "# make docker/run"
@echo "# make vagrant/run"
setup/iotjs: extra/tools/iotjs/setup.sh
$<
setup: setup/iotjs
@echo "# log: $@: $^"
node/start: ${example}
node $<
package.json:
npm init
node_modules: package.json
npm install
node/npm/start: node_modules
npm start
start: ${runtime}/start
@echo "# log: $@: $^"
run: start
@echo "# log: $@: $^"
cleanall:
rm -rf iotjs_modules node_modules
${eslint_file}:
npm install eslint --save-dev
eslint: ${eslint_file} .eslintrc.js
${eslint_file} --no-color --fix .
${eslint_file} --no-color .
lint: eslint
@echo "# log: $@: $^"
iotjs/start: ${example}
iotjs $<
iotjs/debug: ${example}
node $<
${deploy_module_dir}/%: %
@echo "# TODO: minify: $<"
install -d ${@D}
install $< $@
deploy: ${deploy_srcs}
ls $<
check/runtime/%:
@iotjs -h 2>&1 | grep -o 'Usage: ${@F}' > /dev/null
@echo "# log: $@: $^"
check: check/runtime/${runtime}
@echo "# log: $@: $^"
client/curl:
curl -i ${url}
@echo ""
client/iotjs: example/client.js
${runtime} $<
client: client/curl client/iotjs
@echo "# log: $@: $^"
client/put/%:
curl -H "Content-Type: application/json" -X PUT -d '{ "value": ${@F}}' "${url}db/value"
@echo ""
curl -i ${url}
@echo ""
client/put: client/put/0
@echo "# log: $@: $^"
client/demo: client client/put/1 client/put/2
@echo "# log: $@: $^"
demo:
curl --version
curl -i ${url}
curl -i ${url}.well-known/security.txt
-curl -i ${url}favicon.ico
docker/run: docker-compose.yml Dockerfile
docker-compose up
vagrant/run: Vagrantfile
${@D} up