1
|
.PHONY: all serve clean
|
2
|
|
3
|
COFFEE:=./node_modules/.bin/coffee
|
4
|
|
5
|
#### General
|
6
|
|
7
|
all: build
|
8
|
|
9
|
build: src/*coffee
|
10
|
@$(COFFEE) -v > /dev/null
|
11
|
$(COFFEE) -o lib/ -c src/*.coffee
|
12
|
|
13
|
clean:
|
14
|
rm -f lib/*.js
|
15
|
|
16
|
|
17
|
#### Testing
|
18
|
|
19
|
test_server: build
|
20
|
node tests/test_server/server.js
|
21
|
|
22
|
serve:
|
23
|
@if [ -e .pidfile.pid ]; then \
|
24
|
kill `cat .pidfile.pid`; \
|
25
|
rm .pidfile.pid; \
|
26
|
fi
|
27
|
|
28
|
@while [ 1 ]; do \
|
29
|
make build; \
|
30
|
echo " [*] Running http server"; \
|
31
|
make test_server & \
|
32
|
SRVPID=$$!; \
|
33
|
echo $$SRVPID > .pidfile.pid; \
|
34
|
echo " [*] Server pid: $$SRVPID"; \
|
35
|
inotifywait -r -q -e modify .; \
|
36
|
kill `cat .pidfile.pid`; \
|
37
|
rm -f .pidfile.pid; \
|
38
|
sleep 0.1; \
|
39
|
done
|