-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (108 loc) · 3.67 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
135
136
137
138
139
140
141
142
143
BUILD_DIR=build
RELEASE_DIR=release
PACKAGE_DIR=dist
HTML_FILE=$(BUILD_DIR)/index.html
JS_FILE=$(BUILD_DIR)/elm.js
ASSETS_PATH = $(BUILD_DIR)/assets
JS_SOURCES = $(wildcard src/*.elm) $(wildcard src/**/*.elm)
ASSET_FILES = $(wildcard assets/*)
MAIN_FILE = $(BUILD_DIR)/main.js
CSS_FILES = $(wildcard static/*.scss)
CSS_TARGETS = $(subst static,build,$(CSS_FILES:.scss=.css))
ELECTRON_BUILD=./node_modules/.bin/electron-builder
SASS_CMD=./node_modules/node-sass/bin/node-sass
all: $(BUILD_DIR) static $(JS_FILE)
run: all
NODE_ENV=development electron $(MAIN_FILE)
run-prod: all
NODE_ENV=production electron $(MAIN_FILE)
run-debug: $(BUILD_DIR) static
elm make src/Main-Debugger.elm --output $(JS_FILE) --debug
NODE_ENV=development electron $(MAIN_FILE)
rm $(JS_FILE)
run-watch: all
$(SASS_CMD) --watch --recursive --output build/ --source-map true --source-map-contents static/ &
NODE_ENV=development electron $(MAIN_FILE) &
npm run watch
watch-css: all
$(SASS_CMD) --watch --recursive --output build/ --source-map true --source-map-contents static/
package-setup: all
cp icon.* $(BUILD_DIR)
cp package.json $(BUILD_DIR)
sed -i -e "s/build\/main/main/g" $(BUILD_DIR)/package.json
cd $(BUILD_DIR) && npm install --no-save --production
release-setup: all
rm -rf $(RELEASE_DIR)/tmp/*
mkdir -p $(RELEASE_DIR)/tmp/syncrypt
mkdir -p $(RELEASE_DIR)/tmp/build
cp icon.* $(RELEASE_DIR)/tmp/
cp -r $(BUILD_DIR)/* $(RELEASE_DIR)/tmp/syncrypt
cp package.json $(RELEASE_DIR)/tmp/
sed -i -e "s/build\/main/syncrypt\/main/g" $(RELEASE_DIR)/tmp/package.json
sed -i -e "s/\"electron-forge\": \"^4.0.2\",//g" $(RELEASE_DIR)/tmp/package.json
cp client/* $(RELEASE_DIR)/tmp/syncrypt/
cd $(RELEASE_DIR)/tmp && npm install --no-save
release: release-setup
#cd $(BUILD_DIR) && electron-packager ./ Syncrypt --overwrite
cd $(RELEASE_DIR)/tmp && \
npm run make-installer
mv $(RELEASE_DIR)/tmp/out/make/* $(RELEASE_DIR)/
# Linux builds
Syncrypt-Desktop-linux.zip: all
rm -rf $(PACKAGE_DIR) $@
$(ELECTRON_BUILD) --linux zip
cp $(PACKAGE_DIR)/Syncrypt-Desktop-linux.zip $@
Syncrypt-Desktop.AppImage: all
rm -rf $(PACKAGE_DIR) $@
$(ELECTRON_BUILD) --linux AppImage
cp $(PACKAGE_DIR)/Syncrypt-Desktop.AppImage $@
# Darwin builds
Syncrypt-Desktop-darwin.zip: all
rm -rf $(PACKAGE_DIR) $@
$(ELECTRON_BUILD) --mac zip
cp $(PACKAGE_DIR)/Syncrypt-Desktop-mac.zip $@
Syncrypt-Desktop.dmg: all
rm -rf $(PACKAGE_DIR) $@
$(ELECTRON_BUILD) --mac dmg
cp $(PACKAGE_DIR)/Syncrypt-Desktop.dmg $@
# Windows builds
Syncrypt-Desktop-win32.zip: all
rm -rf $(PACKAGE_DIR) $@
$(ELECTRON_BUILD) --win zip
cp $(PACKAGE_DIR)/Syncrypt-Desktop-win.zip $@
Syncrypt-Desktop-Setup.exe: all
rm -rf $(PACKAGE_DIR) $@
$(ELECTRON_BUILD) --win nsis
cp $(PACKAGE_DIR)/Syncrypt-Desktop-Setup.exe $@
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
static: $(BUILD_DIR)/index.html $(CSS_TARGETS) $(ASSETS_PATH)
$(BUILD_DIR)/index.html : static/main.html static/main.js static/ports.js
cp static/main.html $(BUILD_DIR)/index.html
cp static/main.js $(BUILD_DIR)/
cp static/ports.js $(BUILD_DIR)/
build/%.css: static/%.scss
$(SASS_CMD) $< $@
$(ASSETS_PATH): $(ASSET_FILES)
mkdir -p $(ASSETS_PATH)
cp -r assets/* $(ASSETS_PATH)
$(JS_FILE): $(JS_SOURCES)
elm make src/Main.elm --output $(BUILD_DIR)/elm.js $(DEBUG)
test-setup:
cd tests && elm-install
test:
elm-test
deps:
npm install --no-save && node_modules/.bin/elm-install
clean-deps:
rm -rf elm-stuff
rm -rf node_modules/
clean:
rm -rf $(BUILD_DIR)
rm -rf $(PACKAGE_DIR)
rm -rf $(RELEASE_DIR)/tmp/
rm -rf Syncrypt-Desktop-linux.zip Syncrypt-Desktop-darwin.zip Syncrypt-Desktop-win32.zip
distclean: clean clean-deps
rm -rf $(RELEASE_DIR)
version:
@node -p "require('./package.json').version"