forked from mruby-zest/mruby-zest-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
213 lines (178 loc) · 7.9 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
all: linux
windows-hotload: HOTLOADING=UI_HOTLOAD=1
windows-hotload: windows
linux-hotload: HOTLOADING=UI_HOTLOAD=1
linux-hotload: linux
linux:
ruby ./rebuild-fcache.rb
cd deps/nanovg/src && $(CC) nanovg.c -c -fPIC
$(AR) rc deps/libnanovg.a deps/nanovg/src/*.o
cd deps/mruby-file-stat/src && ../configure
cd src/osc-bridge && make lib
# force rebuilding all code that depends on hotloading.
touch src/mruby-widget-lib/src/api.c
cd mruby && $(HOTLOADING) MRUBY_CONFIG=../build_config.rb rake
$(CC) -shared -o libzest.so `find mruby/build/host -type f | grep -v mrbc | grep -e "\.o$$" | grep -v bin` ./deps/libnanovg.a \
./deps/libnanovg.a \
src/osc-bridge/libosc-bridge.a \
$(CFLAGS) \
`pkg-config --libs libuv` -lm -lX11 -lGL -lpthread \
$(LDFLAGS)
$(CC) zest.c deps/pugl/pugl/pugl_x11.c \
$(CFLAGS) \
-DPUGL_HAVE_GL \
-ldl -o zest -lX11 -lGL -lpthread -I deps/pugl -std=gnu99 -Wno-trigraphs \
$(LDFLAGS)
osx: deps/libuv.a deps/pugl/waflib
ruby ./rebuild-fcache.rb
cd deps/nanovg/src && $(CC) nanovg.c -c -fPIC
$(AR) rc deps/libnanovg.a deps/nanovg/src/*.o
cd deps/pugl && python2 ./waf configure --no-cairo --static
# cd deps/pugl && python2 ./waf configure --no-cairo --static --debug
cd deps/pugl && python2 ./waf
cd src/osc-bridge && CFLAGS="-I ../../deps/libuv/include " make lib
cd mruby && MRUBY_CONFIG=../build_config.rb rake
$(CC) -shared -o libzest.so `find mruby/build/host -type f | grep -v mrbc | grep -e "\.o$$" | grep -v bin` ./deps/libnanovg.a \
./deps/libnanovg.a \
src/osc-bridge/libosc-bridge.a \
./deps/libuv/.libs/libuv.a -lm -framework OpenGL -lpthread
$(CC) zest.c deps/pugl/build/libpugl-0.a -ldl -o zest -framework OpenGL -framework AppKit -lpthread -I deps/pugl -std=gnu99
deps/pugl/waflib:
rm -f deps/pugl/waf
git clone https://github.com/poweraudio/autowaf deps/pugl/waflib
git -C deps/pugl/waflib checkout 1404d77833817870cc86245ce9675d5b31f8e733
cp deps/pugl/waflib/waf deps/pugl/
windows: buildpuglwin deps/libuv-win.a
ruby ./rebuild-fcache.rb
cd deps/nanovg/src && $(CC) -mstackrealign nanovg.c -c
$(AR) rc deps/libnanovg.a deps/nanovg/src/*.o
cd src/osc-bridge && CFLAGS="-mstackrealign -I ../../deps/libuv/include " make lib
cd mruby && WINDOWS=1 MRUBY_CONFIG=../build_config.rb rake
$(CC) -mstackrealign -shared -o libzest.dll -static-libgcc `find mruby/build/w64 -type f | grep -e "\.o$$" | grep -v bin` \
./deps/libnanovg.a \
src/osc-bridge/libosc-bridge.a \
./deps/libuv-win.a \
-lm -lpthread -lws2_32 -lkernel32 -lpsapi -luserenv -liphlpapi -lglu32 -lgdi32 -lopengl32
$(CC) -mstackrealign -DWIN32 zest.c deps/pugl/build/libpugl-0.a -o zest.exe -lpthread -I deps/pugl -std=c99 -lws2_32 -lkernel32 -lpsapi -luserenv -liphlpapi -lglu32 -lgdi32 -lopengl32
# Bypass PUGL's WAF builder by manually build according to WAF-generated cmdline
buildpuglwin:
cd deps/pugl && rm -rf build && mkdir build
cd deps/pugl/pugl; \
$(CXX) \
-DNDEBUG -fshow-column -I../ -DHAVE_GL=1 -DPUGL_HAVE_GL=1 -DPUGL_VERSION="0.2.0" pugl_win.cpp \
-c -o ../build/pugl_win.cpp.2.o
cd deps/pugl/build/ && $(AR) rcs libpugl-0.a pugl_win.cpp.2.o
.PHONY: buildpuglwin
deps/libuv.a:
cd deps/libuv && ./autogen.sh
cd deps/libuv && CFLAGS=-fPIC ./configure
cd deps/libuv && CFLAGS=-fPIC make
cp deps/libuv/.libs/libuv.a deps/
deps/libuv-win.a:
cd deps/libuv && ./autogen.sh
cd deps/libuv && CC="" CCLD="" CXX="" AR="" LD="" CFLAGS="-mstackrealign" ./configure --host=x86_64-w64-mingw32 --disable-shared --enable-static
cd deps/libuv && CC="" CCLD="" CXX="" AR="" LD=x86_64-w64-mingw32-gcc make
cp deps/libuv/.libs/libuv.a deps/libuv-win.a
push:
cd src/osc-bridge && git push
cd src/mruby-qml-parse && git push
cd src/mruby-qml-spawn && git push
cd src/mruby-zest && git push
git push
status:
cd src/osc-bridge && git status
cd src/mruby-qml-parse && git status
cd src/mruby-qml-spawn && git status
cd src/mruby-zest && git status
git status
diff:
cd src/osc-bridge && git diff
cd src/mruby-qml-parse && git diff
cd src/mruby-qml-spawn && git diff
cd src/mruby-zest && git diff
git diff
stats:
@echo 'main repo commits: ' `git log --oneline | wc -l`
@echo 'mruby-zest commits: ' `cd src/mruby-zest && git log --oneline | wc -l`
@echo 'mruby-qml-parse commits: ' `cd src/mruby-qml-parse && git log --oneline | wc -l`
@echo 'mruby-qml-spawn commits: ' `cd src/mruby-qml-spawn && git log --oneline | wc -l`
@echo 'osc-bridge commits: ' `cd src/osc-bridge && git log --oneline | wc -l`
@echo 'number of qml files:' `find src/ -type f | grep -e qml$$ | wc -l`
@echo 'number of ruby files:' `find src/ -type f | grep -e rb$$ | wc -l`
@echo 'number of c files:' `find src/ -type f | grep -e c$$ | wc -l`
@echo 'number of header files:' `find src/ -type f | grep -e h$$ | wc -l`
@echo 'lines of OSC schema:' `wc -l src/osc-bridge/schema/test.json`
@echo 'lines of qml:'
@wc -l `find src/ -type f | grep qml$$` | tail -n 1
@echo 'lines of ruby:'
@wc -l `find src/ -type f | grep -e rb$$ | grep -v fcache` | tail -n 1
@echo 'lines of c source:'
@wc -l `find src/ -type f | grep -e c$$` | tail -n 1
@echo 'lines of c header:'
@wc -l `find src/ -type f | grep -e h$$` | tail -n 1
@echo 'total lines of code:'
@wc -l `find src/ -type f | grep -Ee "(qml|rb|c|h)$$" | grep -v fcache` | tail -n 1
verbose: ## Compile mruby with --trace
cd mruby && MRUBY_CONFIG=../build_config.rb rake --trace
test:
cd mruby && MRUBY_CONFIG=../build_config.rb rake test
rtest:
cd src/mruby-qml-parse && ruby test-non-mruby.rb
cd src/mruby-qml-spawn && ruby test-non-mruby.rb
# How to launch zest locally during development.
ZEST_LAUNCH_CMD=./zest osc.udp://127.0.0.1:1337
run: ## Launch zest. Connects to an already running zynaddsubfx via port 1337.
$(ZEST_LAUNCH_CMD)
valgrind: ## Launch zest with valgrind
valgrind --leak-check=full --show-reachable=yes --log-file=leak-log.txt $(ZEST_LAUNCH_CMD)
callgrind: ## Launch zest with callgrind
valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes $(ZEST_LAUNCH_CMD)
gdb:
gdb --args $(ZEST_LAUNCH_CMD)
gltrace: ## Launch with apitrace
/work/mytmp/apitrace/build/apitrace trace $(ZEST_LAUNCH_CMD)
qtrace:
/work/mytmp/apitrace/build/qapitrace ./mruby.trace
scratch:
./mruby/bin/mruby scratch.rb
clean: ## Clean Build Data
cd mruby && MRUBY_CONFIG=../build_config.rb rake clean
cd mruby && rm -rf build/w64
rm -f deps/libuv.a deps/libuv-win.a
pack:
rm -rf package
mkdir package
mkdir package/schema
mkdir package/qml
mkdir package/font
mkdir package/completions
cp src/mruby-zest/qml/* package/qml/
cp src/mruby-zest/example/* package/qml/
cp src/osc-bridge/schema/test.json package/schema/
cp deps/nanovg/example/*.ttf package/font/
cp mruby/bin/mruby package/
cp libzest.so package/
cp zest package/
cp completions/zyn-fusion package/completions
echo 'Version 3.0.0-pre ' >> package/VERSION
echo 'built on: ' >> package/VERSION
echo `date` >> package/VERSION
rm -f zest-dist.tar
rm -f zest-dist.tar.bz2
tar cf zest-dist.tar package/
bzip2 zest-dist.tar
pack32: ## Create 64bit Linux Package
make pack
mv zest-dist.tar.bz2 zest-dist-x86.tar.bz2
pack64: ## Create 64bit Linux Package
make pack
mv zest-dist.tar.bz2 zest-dist-x86_64.tar.bz2
put32: ## Push to the server
scp zest-dist-x86.tar.bz2 mark@fundamental-code.com:/var/www/htdocs/zest/
put64: ## Push to the server
scp zest-dist-x86_64.tar.bz2 mark@fundamental-code.com:/var/www/htdocs/zest/
putsrc:
scp zynaddsubfx-3.0.0.tar.bz2 mark@fundamental-code.com:/var/www/htdocs/zest/
.PHONY: help
help: ## This help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'