-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
43 lines (34 loc) · 1.08 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
# On development servers we have to use versioned node and a unix-socket.
# Otherwise (for local development) we use the /usr/bin/node and a web-socket (localhost:<port>).
# Bellow you can see this detection.
SERVER_NODE := /opt/nodejs/0.10/bin/node
SERVER_NPM := /opt/nodejs/0.10/bin/npm
LOCAL_NODE := node
LOCAL_NPM := npm
NODE := $(firstword $(shell which $(SERVER_NODE) $(LOCAL_NODE)))
NPM := $(firstword $(shell which $(SERVER_NPM) $(LOCAL_NPM)))
# if server node isn't found then specify PORT for local development
ifneq ($(NODE),$(SERVER_NODE))
PORT ?= 8080
endif
NODE_MODULES_BIN := node_modules/.bin
ENB := $(NODE_MODULES_BIN)/enb
#MOCHA_FLAGS ?= -R dot
all: npm build
# Install npm modules
npm:
@$(NPM) install
# Build project
build:
$(ENB) make $(ENB_FLAGS)
@rm -rf build/index/lib
@cp -rf lib build/index/lib
@mv build/index/index.ru.html build/index/index.html
# Build and run client tests
test:
$(ENB) make test -n
$(NODE_MODULES_BIN)/mocha-phantomjs $(MOCHA_FLAGS) test/client/test.html
# Clean build results
clean:
$(ENB) make clean
.PHONY: all install build clean test