forked from rzr/color-sensor-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
140 lines (104 loc) · 2.36 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
130
131
132
133
134
135
136
137
138
139
140
#!/bin/make -f
# -*- makefile -*-
# SPDX-License-Identifier: Apache-2.0
#{
# Copyright 2019-present Samsung Electronics France SAS, and other contributors
#}
default: help all
@echo "log: $@: $^"
tmp_dir ?= tmp
runtime ?= iotjs
export runtime
eslint ?= node_modules/eslint/bin/eslint.js
srcs_dir ?= lib example
srcs ?= $(wildcard *.js lib/*.js | sort | uniq)
controller ?= simulator
test_src ?= lib/${controller}.js
main_src ?= example/index.js
NODE_PATH := .:${NODE_PATH}
export NODE_PATH
help:
@echo "## Usage: "
@echo "# make start"
@echo "# make -C example/color-sensor-webthing start"
all: build
@echo "log: $@: $^"
setup/%:
${@F}
node_modules: package.json
npm install
package-lock.json: package.json
rm -fv "$@"
npm install
ls "$@"
setup/node: node_modules
@echo "NODE_PATH=$${NODE_PATH}"
node --version
npm --version
setup: setup/${runtime}
build/%: setup
@echo "log: $@: $^"
build/node: setup node_modules eslint
build: build/${runtime}
run/%: ${main_src} build
${@F} $< ${run_args}
run/npm: ${main_src} setup
npm start
run: run/${runtime}
clean:
rm -rf ${tmp_dir}
cleanall: clean
rm -f *~
distclean: cleanall
rm -rf node_modules
test/npm: package.json
npm test
test/${runtime}: ${test_src}
${@F} $<
test: test/${runtime}
@echo "log: $@: $^"
start: run
check/%: ${srcs}
${MAKE} setup
@echo "log: SHELL=$${SHELL}"
status=0 ; \
for src in $^; do \
echo "log: check: $${src}: ($@)" ; \
${@F} $${src} \
&& echo "log: check: $${src}: OK" \
|| status=1 ; \
done ; \
exit $${status}
check/npm:
npm run lint
check: check/${runtime}
git/commit/%:
-git commit -sam "${runtime}: WIP: About to do something (${@})"
eslint: .eslintrc.js ${eslint}
@rm -rf tmp/dist
${eslint} --no-color --fix . ||:
${eslint} --no-color .
git diff --exit-code
eslint/setup: node_modules
ls ${eslint} || npm install eslint-plugin-node eslint
${eslint} --version
${eslint}:
ls $@ || make eslint/setup
touch $@
.eslintrc.js: ${eslint}
ls $@ || $< --init
lint/%: eslint
echo "$@: $^"
lint: lint/${runtime}
echo "$@: $^"
setup/iotjs: ${iotjs_modules_dir}
@echo "Expected to see IoT.js' help"
${@F} --help ||:
ls $<
rule/npm/version/%: package.json
npm version
-git describe --tags
-cd example/color-sensor-webthing && npm version ${@F}
-git commit -sam "webthing: Update version to ${@F}"
-npm version ${@F}
git commit -sam "npm: Update version to ${@F}"