forked from qq99/echoplexus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (48 loc) · 2.44 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
GEMS=sass
GLOBAL_NODE_PACKAGES=nodemon uglify-js backbone async
NODE_PACKAGES=express socket.io underscore crypto redis
SASS_FILES=sass/combined.scss sass/main.scss sass/monokai.scss
PUBLIC_DIR=server/public
BUILD_DIR=build
SANDBOX_USERNAME=sandbox
# !! order is important in the client libs !!
LIBS=client/lib/underscore-min.js client/lib/jquery.min.js client/lib/jquery.cookie.js client/lib/moment.min.js client/lib/backbone/backbone.js
CLIENT_JS=client/lib/codemirror-3.11/lib/codemirror.js client/lib/codemirror-3.11/mode/javascript/javascript.js client/lib/codemirror-3.11/mode/xml/xml.js client/lib/codemirror-3.11/mode/css/css.js client/lib/codemirror-3.11/mode/htmlmixed/htmlmixed.js client/client.js client/regex.js client/ui/Autocomplete.js client/ui/Notifications.js client/ui/Log.js client/ui/Scrollback.js client/ui/SyncedEditor.js client/ui/ChatLog.js client/ChatClient.js client/CodeClient.js client/DrawingClient.js client/ui/ChannelSwitcher.js client/ui.js
.PHONY: server install_packages assets clean
all: client
server: server/main.js
nodemon -e js --delay 5 server/main.js
install_packages:
npm install $(NODE_PACKAGES) && sudo gem install $(GEMS) && sudo npm install -g $(GLOBAL_NODE_PACKAGES)
.libs: $(LIBS)
mkdir -p $(BUILD_DIR)
cat $(LIBS) > $(BUILD_DIR)/libs.js
uglifyjs $(BUILD_DIR)/libs.js > $(BUILD_DIR)/libs.min.js
cp $(BUILD_DIR)/libs.min.js $(PUBLIC_DIR)/libs.min.js
touch .libs
.js: $(CLIENT_JS)
mkdir -p $(BUILD_DIR)
cat $(CLIENT_JS) > $(BUILD_DIR)/echoplexus.js
uglifyjs --compress --define DEBUG=false $(BUILD_DIR)/echoplexus.js > $(BUILD_DIR)/echoplexus.min.js
cp $(BUILD_DIR)/echoplexus.min.js $(PUBLIC_DIR)/echoplexus.min.js
touch .js
.css: $(SASS_FILES)
mkdir -p $(PUBLIC_DIR)/css
sass --style compressed sass/combined.scss:$(PUBLIC_DIR)/css/main.css
touch .css
client: .libs .js .css
dangerzone:
echo 'Creating a new user account with disabled login named ' $(SANDBOX_USERNAME)
sudo adduser --disabled-login --gecos 'Sandbox' $(SANDBOX_USERNAME)
dangerzone_dir:
mkdir -p $(PUBLIC_DIR)/sandbox
echo 'Allowing $(SANDBOX_USERNAME) user access to ' $(PUBLIC_DIR)/sandbox
chown -R :sandbox $(PUBLIC_DIR)/sandbox
chmod -R g+rw $(PUBLIC_DIR)/sandbox
echo 'If you want to run phantomjs-screenshotter, you must now enable it in config.js, install phantomjs, and install the phantomjs_screenshot sister repository beside the echoplexus repository.'
clean:
rm .libs
rm .js
rm .css
rm $(PUBLIC_DIR)/css/*.css
rm -rf $(BUILD_DIR)