forked from turtl/desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (109 loc) · 3.43 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
.PHONY: all clean release run urn electron-rebuild package-electron release-windows release-linux release-osx
# non-versioned include
-include vars.mk
export SHELL := /bin/bash
export BUILD := build
export RELEASE := release
OS ?= $(shell uname)
mkdir = @mkdir -p $(dir $@)
CONFIG_FILE := config.js
ELECTRON := ./node_modules/.bin/electron
ELECTRON_REBUILD := ./node_modules/.bin/electron-rebuild
allcss = $(shell find ../js/css/ -name "*.css" \
| grep -v 'reset.css')
alljs = $(shell echo "../js/main.js" \
&& find ../js/{config,controllers,handlers,lib,models} -name "*.js" \
| grep -v '(ignore|\.thread\.)')
alljsassets = $(shell find ../js -type f | grep -v '\.git' | grep -v 'node_modules' | grep -v 'build')
alllibs = $(shell find lib/ -name "*.js")
allrs = $(shell find ../core/ -name "*.rs")
version := $(shell cat package.json \
| grep '"version"' \
| sed -E 's|.*: +"([^"]+)".*|\1|')
libprefix := lib
libsuffix := so
ifneq (,$(findstring NT, $(OS)))
libprefix :=
libsuffix := dll
endif
ifneq (,$(findstring Darwin, $(OS)))
libsuffix := dylib
endif
all: $(BUILD)/turtl_core.$(libsuffix) $(BUILD)/config.yaml $(BUILD)/clippo/parsers.yaml $(BUILD)/make-js $(BUILD)/config.js $(BUILD)/index.html $(BUILD)/popup.html
release: override CONFIG_FILE := config.live.js
release: package
./scripts/release
run: all
$(ELECTRON) .
run-bat: all
start "scripts\debug-win.bat"
urn:
@echo "Is there a Ralphs around here?"
$(BUILD)/app/index.html: $(alljsassets) $(allcss) ../js/index.html
$(mkdir)
@cd ../js && make
@echo "- rsync project: " $?
@rsync \
-azz \
--exclude=node_modules \
--exclude=.git \
--exclude=tests \
--delete \
--delete-excluded \
--checksum \
../js/ \
$(BUILD)/app
@touch $@
$(BUILD)/config.yaml: ../core/config.yaml.default
$(mkdir)
@echo "- core config: " $?
@cp $? $@
$(BUILD)/clippo/parsers.yaml: ../core/clippo/parsers.yaml
$(mkdir)
@echo "- core parsers.yaml: " $?
@cp $? $@
$(BUILD)/turtl_core.$(libsuffix): $(allrs)
$(mkdir)
@echo "- core build: " $?
cd ../core && make CARGO_BUILD_ARGS=$(CARGO_BUILD_ARGS) release
cp ../core/target/release/$(libprefix)turtl_core.$(libsuffix) $@
$(BUILD)/config.js: config/$(CONFIG_FILE)
@echo "- Config: " $?
@cp config/$(CONFIG_FILE) $@
$(BUILD)/make-js: $(alljs) $(allcss)
$(mkdir)
@cd ../js && make
@touch $@
# if the app's index changed, we know to change this one
$(BUILD)/index.html: $(BUILD)/make-js $(BUILD)/app/index.html $(alllibs) ./scripts/gen-index
@echo "- $@: " $?
@./scripts/gen-index > $@
$(BUILD)/popup.html: lib/app/popup/index.html.tpl $(alllibs) ./scripts/gen-index
@test -d "$(@D)" || mkdir -p "$(@D)"
@echo "- $@: " $?
@./scripts/gen-index popup > $@
electron-rebuild:
$(ELECTRON_REBUILD)
clean:
rm -rf $(BUILD)
package-electron: electron-rebuild all
./node_modules/.bin/electron-packager \
--overwrite \
--prune \
--executable-name=turtl \
--icon=scripts/resources/favicon.128.ico \
--out=target/ \
.
cp \
config/config.live.js \
`find target/ -type f | grep -v 'final/' | grep 'app/build/config.js' | head -1`
release-windows: package-electron
cp \
$(SSL_LIB_PATH)/libeay32.dll \
$(SSL_LIB_PATH)/ssleay32.dll \
`ls -d target/Turtl-* | head -1`
./scripts/release/windows $(version) `ls -d target/Turtl-* | head -1`
release-linux: package-electron
./scripts/release/linux $(version) `ls -d target/Turtl-* | head -1`
release-osx: package-electron
./scripts/release/osx $(version) `ls -d target/Turtl-* | head -1`