-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathMakefile
74 lines (61 loc) · 1.81 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
NODE_BIN=./node_modules/.bin
ELECTRON=$(NODE_BIN)/electron
BROWSERIFY=$(NODE_BIN)/browserify
TSC=$(NODE_BIN)/tsc
LESS=$(NODE_BIN)/lessc
ASAR=$(NODE_BIN)/asar
all: dep build
run: build
@$(ELECTRON) .
dep:
@npm install
build: clean
@mkdir build
@mkdir build/browser
@mkdir build/renderer
# move config
cp -r config build/
# build renderer scripts
$(TSC) -p ./renderer
$(BROWSERIFY) ./build/renderer/app.js -o build/renderer.js --ignore ipc --debug
# build browser scripts
$(TSC) -p ./browser
# build styles
$(LESS) ./style/main.less > build/built.css
clean: clean-asar
@rm -rf ./build
asar: clean-asar build
@mkdir asar
@cp ./main.js asar/
@cp ./index.html asar/
@cp ./package.json asar/
@cp -r ./build asar/
@cp -r ./config asar/
@cp -r ./resource asar/
@cd asar; npm install --production; cd ..
$(ASAR) pack asar build/app.asar
clean-asar:
@rm -rf ./asar
download-shell: clean-shell
@mkdir shell
@curl -o shell/osx.zip https://raw.githubusercontent.com/KokoIRC/koko-shell/master/zip/osx.zip
@curl -o shell/win32.zip https://raw.githubusercontent.com/KokoIRC/koko-shell/master/zip/win32.zip
@curl -o shell/win64.zip https://raw.githubusercontent.com/KokoIRC/koko-shell/master/zip/win64.zip
clean-shell:
@rm -rf ./shell
package: package-mac package-win
package-mac: clean asar
@echo "packaging an executable for OS X executable"
@if [ ! -d ./shell ]; then make download-shell; fi
@unzip shell/osx.zip -d build
@cp build/app.asar build/koko.app/Contents/Resources/
@echo "done"
package-win: clean asar
@echo "packaging executables for Windows done"
@if [ ! -d ./shell ]; then make download-shell; fi
@unzip shell/win32.zip -d build/win32
@unzip shell/win64.zip -d build/win64
@cp build/app.asar build/win32/resources/
@cp build/app.asar build/win64/resources/
@echo "done"
.PHONY: run dep build clean