-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
192 lines (160 loc) · 6.3 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
include VERSION
DOCS=*.md LICENSE
SRCS=bundler.json cmd/*/*.go [c-z]*.go */*.go resources/app/*html resources/app/static/css/*.css resources/app/static/js/*js
EXES=$(EXE_MAC) $(EXE_WINDOWS) $(EXE_LINUX_AMD64) $(EXE_LINUX_386) $(EXE_LINUX_ARM) ${EXE_WINDOWS_TEST}
EXE_MAC=output/darwin-amd64/Synergize.app/Contents/MacOS/Synergize
EXE_WINDOWS=output/windows-386/Synergize.exe
EXE_WINDOWS_TEST=output/windows-386-cmd/Synergize-cmd.exe
EXE_LINUX_AMD64=output/linux-amd64/Synergize
EXE_LINUX_386=output/linux-386/Synergize
EXE_LINUX_ARM=output/linux-arm/Synergize
DX2SYNS=$(DX2SYN_MAC) $(DX2SYN_WINDOWS) $(DX2SYN_LINUX_AMD64) $(DX2SYN_LINUX_386) $(DX2SYN_LINUX_ARM)
DX2SYN_MAC=output/darwin-amd64/Synergize.app/Contents/MacOS/dx2syn
DX2SYN_WINDOWS=output/windows-386/dx2syn.exe
DX2SYN_LINUX_AMD64=output/linux-amd64/dx2syn
DX2SYN_LINUX_386=output/linux-386/dx2syn
DX2SYN_LINUX_ARM=output/linux-arm/dx2syn
# NOTE: must build the exes before we can run the test since some variables
# used in main.go are generated as side-effects of the astielectron-bundler
# Must build dx2syn after EXEs since astilectron-bundler will nuke the output directory
.PHONY: all
all: $(EXES) $(DX2SYNS)
$(DX2SYN_MAC): $(SRCS)
mkdir -p output/darwin-amd64/Synergize.app/Contents/MacOS
cd cmd/dx2syn && go build -o ../../output/darwin-amd64/Synergize.app/Contents/MacOS
$(DX2SYN_WINDOWS): $(SRCS)
mkdir -p output/windows-386
cd cmd/dx2syn && GOOS=windows GOARCH=386 go build -o ../../output/windows-386
$(DX2SYN_LINUX_AMD64):
mkdir -p output/linux-amd64
cd cmd/dx2syn && GOOS=linux GOARCH=amd64 go build -o ../../output/linux-amd64
$(DX2SYN_LINUX_386):
mkdir -p output/linux-386
cd cmd/dx2syn && GOOS=linux GOARCH=386 go build -o ../../output/linux-386
$(DX2SYN_LINUX_ARM):
mkdir -p output/linux-arm
cd cmd/dx2syn && GOOS=linux GOARCH=arm go build -o ../../output/linux-arm
$(EXE_MAC) $(EXE_WINDOWS) $(EXE_LINUX_AMD64) $(EXE_LINUX_386) $(EXE_LINUX_ARM) : $(SRCS)
rm -f windows.syso # delete temporary file side effect of windows build - linux-arm chokes on it.
astilectron-bundler
# command line friendly variant for running batch serial comms tests
$(EXE_WINDOWS_TEST): $(SRCS)
mkdir -p output/windows-386-cmd
GOOS=windows GOARCH=386 go build -o $(EXE_WINDOWS_TEST)
.PHONY: mac
mac: version.go
rm -rf output/windows* output/linux*
astilectron-bundler -c bundler-mac-only.json
$(MAKE) $(DX2SYN_MAC)
.PHONY: cibuild
cibuild: version.go
astilectron-bundler -c bundler-ci.json
.PHONY: package
package: test all packageMac packageWindows packageLinux
cp osc/touchosc/Synergize-v*.touchosc packages
# uses create-dmg (installed via "brew install create-dmg"):
.PHONY: packageMac
packageMac: packages/Synergize-Installer-mac-$(VERSION).dmg
packages/Synergize-Installer-mac-$(VERSION).dmg : $(EXE_MAC)
mkdir -p packages
rm -f packages/Synergize-Installer-mac-$(VERSION).dmg
create-dmg \
--volname "Synergize Installer" \
--volicon resources/icon.icns \
--icon-size 100 \
--window-size 450 400 \
--icon "Synergize.app" 100 120 \
--app-drop-link 300 120 \
"packages/Synergize-Installer-mac-$(VERSION).dmg" \
output/darwin-amd64
# uses msitools (installed via "brew install msitools"):
.PHONY: packageWindows
packageWindows: packages/Synergize-Installer-windows-$(VERSION).msi $(EXE_WINDOWS) $(EXE_WINDOWS_TEST)
packages/Synergize-Installer-windows-$(VERSION).msi : windows-installer.wxs $(EXE_WINDOWS) $(EXE_WINDOWS_TEST)
mkdir -p packages
rm -f packages/Synergize-Installer-windows-$(VERSION).msi
wixl -v \
-a x86 \
-D VERSION=$(VERSION) \
-D SourceDir=output/windows-386/ \
-o packages/Synergize-Installer-windows-$(VERSION).msi \
windows-installer.wxs
.PHONY: packageLinux
packageLinux: \
packages/Synergize-linux-amd64-$(VERSION).tar.gz \
packages/Synergize-linux-386-$(VERSION).tar.gz \
packages/Synergize-linux-arm-$(VERSION).tar.gz
packages/Synergize-linux-amd64-$(VERSION).tar.gz: $(EXE_LINUX_AMD64) $(DX2SYN_LINUX_AMD64)
mkdir -p packages
cd output/linux-amd64 && tar czvf ../../packages/Synergize-linux-amd64-$(VERSION).tar.gz Synergize dx2syn
packages/Synergize-linux-386-$(VERSION).tar.gz: $(EXE_LINUX_386) $(DX2SYN_LINUX_386)
mkdir -p packages
cd output/linux-386 && tar czvf ../../packages/Synergize-linux-386-$(VERSION).tar.gz Synergize dx2syn
packages/Synergize-linux-arm-$(VERSION).tar.gz: $(EXE_LINUX_ARM) $(DX2SYN_LINUX_ARM)
mkdir -p packages
cd output/linux-arm && tar czvf ../../packages/Synergize-linux-arm-$(VERSION).tar.gz Synergize dx2syn
.PHONY: test
test:
cd data && go test
cd osc && go test
cd synio && go test
cd dx2syn && go test
cd seq && go test
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SCREENSHOT_ARCH=darwin
PORT=/dev/tty.usbserial-AL05OC8S
endif
ifeq ($(UNAME_S),Linux)
SCREENSHOT_ARCH=linux
PORT=/dev/ttyS0
endif
ifeq ($(PORT),'')
SCREENSHOT_ARCH=win32
PORT=COM1
endif
.PHONY: itest
itest:
cd osc && go test -v -oscio
cd synio && go test -v -synio -port $(PORT)
.PHONY: uitest
uitest:
/bin/rm -f uitest/test/screenshots/$(SCREENSHOT_ARCH)/DEBUG*.png
/bin/rm -f uitest/test/screenshots/$(SCREENSHOT_ARCH)/*failed.png
-cd uitest && npm test | tee uitest-$(SCREENSHOT_ARCH).log
ls uitest/test/screenshots/$(SCREENSHOT_ARCH)/*failed.png
.PHONY: uitest-diff
uitest-diff:
-open uitest/test/screenshots/$(SCREENSHOT_ARCH)/AFTERHOOK*.failed.png
for f in `/bin/ls -1 uitest/test/screenshots/$(SCREENSHOT_ARCH)/*.failed.png | grep -v AFTERHOOK`; do \
echo f: $$f; \
s="`basename "$$f" .failed.png`"; \
echo s: $$s; \
compare "uitest/test/screenshots/$(SCREENSHOT_ARCH)/$${s}.png" "$$f" /tmp/diff.png; \
open /tmp/diff.png ;\
echo press RETURN for next image; \
read;\
done
version.go : VERSION
echo package main > version.go
echo >> version.go
echo const Version = \"$(VERSION)\" >> version.go
.PHONY: tags
tags: $(SRCS) $(DOCS)
etags $(SRCS) $(DOCS)
.PHONY: installDependencies
installDependencies:
go get -u github.com/asticode/go-astilectron
go get -u github.com/asticode/go-astilectron-bundler
go get -u github.com/asticode/go-astilectron-bootstrap
go get -v -t -d ./...
go install github.com/asticode/go-astilectron
go install github.com/asticode/go-astilectron-bundler/astilectron-bundler
go install github.com/asticode/go-astilectron-bootstrap
.PHONY: localdoc
localdoc:
echo use http://localhost:4000/synergize/
docker compose up
.PHONY: clean
clean:
rm -rf packages output bind_*.go *.log