forked from VCVRack/Rack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
198 lines (160 loc) · 5.03 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
RACK_DIR ?= .
VERSION = 0.6.2b
FLAGS += \
-Iinclude \
-Idep/include -Idep/lib/libzip/include
include arch.mk
STRIP ?= strip
# Sources and build flags
SOURCES += dep/nanovg/src/nanovg.c
SOURCES += dep/osdialog/osdialog.c
SOURCES += $(wildcard dep/jpommier-pffft-*/pffft.c) $(wildcard dep/jpommier-pffft-*/fftpack.c)
SOURCES += $(wildcard src/*.cpp src/*/*.cpp)
ifdef ARCH_MAC
SOURCES += dep/osdialog/osdialog_mac.m
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++ -lpthread -ldl \
-framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
-Ldep/lib dep/lib/libglfw3.a dep/lib/libGLEW.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libzip.a dep/lib/libz.a dep/lib/librtaudio.a dep/lib/librtmidi.a dep/lib/libcrypto.a dep/lib/libssl.a dep/lib/libcurl.a
TARGET := Rack
BUNDLE := dist/$(TARGET).app
endif
ifdef ARCH_WIN
SOURCES += dep/osdialog/osdialog_win.c
LDFLAGS += -static \
-Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
-Ldep/lib -lglew32 -lglfw3 -ljansson -lspeexdsp -lzip -lz -lcurl -lssl -lcrypto -lrtaudio -lrtmidi \
-lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi
TARGET := Rack.exe
OBJECTS += Rack.res
endif
ifdef ARCH_LIN
SOURCES += dep/osdialog/osdialog_gtk2.c
CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
LDFLAGS += -rdynamic \
-Ldep/lib \
-Wl,-Bstatic -lglfw3 -lGLEW -ljansson -lspeexdsp -lzip -lz -lrtmidi -lrtaudio -lcurl -lssl -lcrypto \
-Wl,-Bdynamic -lpthread -lGL -ldl -lX11 -lasound -ljack \
$(shell pkg-config --libs gtk+-2.0)
TARGET := Rack
endif
# Convenience targets
all: $(TARGET)
dep:
$(MAKE) -C dep
run: $(TARGET)
./$< -d
runr: $(TARGET)
./$<
debug: $(TARGET)
ifdef ARCH_MAC
lldb --args ./$< -d
endif
ifdef ARCH_WIN
gdb --args ./$< -d
endif
ifdef ARCH_LIN
gdb --args ./$< -d
endif
perf: $(TARGET)
ifdef ARCH_LIN
perf record --call-graph dwarf -o perf.data ./$< -d
endif
clean:
rm -rfv $(TARGET) libRack.a Rack.res build dist
ifdef ARCH_WIN
# For Windows resources
%.res: %.rc
windres $^ -O coff -o $@
endif
# This target is not intended for public use
dist: all
rm -rf dist
mkdir -p dist
@# Rack
$(MAKE) -C plugins/Fundamental dist
ifdef ARCH_MAC
mkdir -p $(BUNDLE)
mkdir -p $(BUNDLE)/Contents
mkdir -p $(BUNDLE)/Contents/Resources
cp Info.plist $(BUNDLE)/Contents/
cp -R LICENSE* icon.icns res $(BUNDLE)/Contents/Resources
mkdir -p $(BUNDLE)/Contents/MacOS
cp $(TARGET) $(BUNDLE)/Contents/MacOS/
$(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
cp plugins/Fundamental/dist/Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
cp -R Bridge/AU/dist/VCV-Bridge.component dist/
cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
cp -R Bridge/VST/dist/VCV-Bridge-fx.vst dist/
@# Make DMG image
cd dist && ln -s /Applications Applications
cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
endif
ifdef ARCH_WIN
mkdir -p dist/Rack
mkdir -p dist/Rack/Bridge
cp Bridge/VST/dist/VCV-Bridge-{32,64,fx-32,fx-64}.dll dist/Rack/Bridge/
cp -R LICENSE* res dist/Rack/
cp $(TARGET) dist/Rack/
$(STRIP) -s dist/Rack/$(TARGET)
cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
cp /mingw64/bin/libstdc++-6.dll dist/Rack/
cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
@# Make ZIP
cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
@# Make NSIS installer
makensis installer.nsi
mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
endif
ifdef ARCH_LIN
mkdir -p dist/Rack
mkdir -p dist/Rack/Bridge
cp Bridge/VST/dist/VCV-Bridge{,-fx}.so dist/Rack/Bridge/
cp -R LICENSE* res dist/Rack/
cp $(TARGET) dist/Rack/
$(STRIP) -s dist/Rack/$(TARGET)
ldd dist/Rack/$(TARGET)
cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
@# Make ZIP
cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
endif
@# Rack SDK
mkdir -p dist/Rack-SDK
cp LICENSE* dist/Rack-SDK/
cp *.mk dist/Rack-SDK/
cp -R include dist/Rack-SDK/
mkdir -p dist/Rack-SDK/dep/
cp -R dep/include dist/Rack-SDK/dep/
ifdef ARCH_WIN
cp libRack.a dist/Rack-SDK/
endif
cd dist && zip -5 -r Rack-SDK-$(VERSION)-$(ARCH).zip Rack-SDK
# Obviously this will only work if you have the private keys to my server
UPLOAD_URL := [email protected]:files/
upload:
ifdef ARCH_MAC
rsync dist/*.{dmg,zip} $(UPLOAD_URL) -zP
endif
ifdef ARCH_WIN
rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
endif
ifdef ARCH_LIN
rsync dist/*.zip $(UPLOAD_URL) -zP
endif
# Plugin helpers
allplugins:
for f in plugins/*; do $(MAKE) -C "$$f"; done
cleanplugins:
for f in plugins/*; do $(MAKE) -C "$$f" clean; done
distplugins:
for f in plugins/*; do $(MAKE) -C "$$f" dist; done
plugins:
for f in plugins/*; do (cd "$$f" && ${CMD}); done
# Includes
include compile.mk
.PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
.DEFAULT_GOAL := all