AU processing details, still WIP
[carla.git] / Makefile.dist.mk
blob63c17bf02f66b5130965f937ef780ac028d991dd
1 #!/usr/bin/make -f
2 # Makefile for Carla #
3 # ------------------ #
4 # Created by falkTX
7 # NOTE to be imported from main Makefile
9 # ---------------------------------------------------------------------------------------------------------------------
11 PYTHON = $(EXE_WRAPPER) $(shell which python3$(APP_EXT))
13 ifeq ($(WINDOWS),true)
14 QT5_DLL_EXT = .dll
15 QT5_DLL_V = 5
16 endif
18 ifeq ($(MACOS),true)
19 QT5_LIB_PREFIX = lib
20 endif
22 ifeq ($(HAVE_QT5PKG),true)
23 QT5_PREFIX = $(shell pkg-config --variable=prefix Qt5OpenGLExtensions)
24 endif
26 # ---------------------------------------------------------------------------------------------------------------------
28 _PLUGIN_UIS = \
29 carla-plugin \
30 carla-plugin-patchbay \
31 bigmeter-ui \
32 midipattern-ui \
33 notes-ui \
34 xycontroller-ui
36 _QT5_DLLS = \
37 Qt$(QT5_DLL_V)Core$(QT5_DLL_EXT) \
38 Qt$(QT5_DLL_V)Gui$(QT5_DLL_EXT) \
39 Qt$(QT5_DLL_V)OpenGL$(QT5_DLL_EXT) \
40 Qt$(QT5_DLL_V)PrintSupport$(QT5_DLL_EXT) \
41 Qt$(QT5_DLL_V)Svg$(QT5_DLL_EXT) \
42 Qt$(QT5_DLL_V)Widgets$(QT5_DLL_EXT)
44 _QT5_PLUGINS = \
45 iconengines/$(QT5_LIB_PREFIX)qsvgicon$(LIB_EXT) \
46 imageformats/$(QT5_LIB_PREFIX)qjpeg$(LIB_EXT) \
47 imageformats/$(QT5_LIB_PREFIX)qsvg$(LIB_EXT)
49 ifeq ($(MACOS),true)
50 _QT5_PLUGINS += platforms/$(QT5_LIB_PREFIX)qcocoa$(LIB_EXT)
51 else ifeq ($(WINDOWS),true)
52 _QT5_PLUGINS += platforms/$(QT5_LIB_PREFIX)qwindows$(LIB_EXT)
53 endif
55 # NOTE this has to be hardcoded for now. oh well
56 ifeq ($(WINDOWS),true)
57 _PYTHON_FILES = \
58 libpython3.8.dll
59 endif
61 _THEME_FILES = \
62 styles/carlastyle.json \
63 styles/carlastyle$(LIB_EXT)
65 _CARLA_HOST_FILES = \
66 carla-bridge-lv2$(LIB_EXT) \
67 carla-bridge-lv2-gtk2$(APP_EXT) \
68 carla-bridge-lv2-gtk3$(APP_EXT) \
69 carla-bridge-native$(APP_EXT) \
70 carla-discovery-native$(APP_EXT) \
71 libcarla_frontend$(LIB_EXT) \
72 libcarla_utils$(LIB_EXT) \
73 $(_PLUGIN_UIS:%=resources/%$(APP_EXT))
75 ifeq ($(MACOS),true)
76 _CARLA_HOST_FILES += carla-bridge-lv2-cocoa$(APP_EXT)
77 _CARLA_HOST_FILES += magic.mgc
78 else ifeq ($(WINDOWS),true)
79 _CARLA_HOST_FILES += carla-bridge-lv2-windows$(APP_EXT)
80 endif
82 ifeq ($(MACOS),true)
83 ifneq ($(MACOS_UNIVERSAL),true)
84 _CARLA_HOST_FILES += carla-bridge-posix32
85 _CARLA_HOST_FILES += carla-discovery-posix32
86 endif
87 endif
89 ifeq ($(WIN64),true)
90 _CARLA_HOST_FILES += carla-bridge-win32$(APP_EXT)
91 _CARLA_HOST_FILES += carla-discovery-win32$(APP_EXT)
92 endif
94 _CARLA_APP_FILES = \
95 $(_CARLA_HOST_FILES) \
96 $(_PYTHON_FILES) \
97 $(_QT5_DLLS) \
98 $(_QT5_PLUGINS) \
99 $(_THEME_FILES) \
100 resources/lib
102 ifneq ($(EMBED_TARGET),true)
103 _CARLA_APP_FILES += \
104 Carla$(APP_EXT) \
105 libcarla_host-plugin$(LIB_EXT) \
106 libcarla_native-plugin$(LIB_EXT) \
107 libcarla_standalone2$(LIB_EXT)
109 _CARLA_CONTROL_APP_FILES = \
110 Carla-Control$(APP_EXT) \
111 libcarla_frontend$(LIB_EXT) \
112 libcarla_utils$(LIB_EXT) \
113 $(_PYTHON_FILES) \
114 $(_QT5_DLLS) \
115 $(_QT5_PLUGINS) \
116 $(_THEME_FILES)
118 _CARLA_LV2_PLUGIN_FILES = \
119 carla.lv2/carla$(LIB_EXT) \
120 carla.lv2/manifest.ttl \
121 carla.lv2/resources/lib/library.zip \
122 $(_CARLA_HOST_FILES:%=carla.lv2/%) \
123 $(_PYTHON_FILES:%=carla.lv2/resources/%) \
124 $(_QT5_DLLS:%=carla.lv2/resources/%) \
125 $(_QT5_PLUGINS:%=carla.lv2/resources/%) \
126 $(_THEME_FILES:%=carla.lv2/resources/%)
128 ifeq ($(MACOS),true)
129 _CARLA_VST2FX_PLUGIN_FILES = \
130 carlafx.vst/Contents/MacOS/CarlaVstFxShell \
131 carlafx.vst/Contents/MacOS/resources/lib/library.zip \
132 $(_CARLA_HOST_FILES:%=carlafx.vst/Contents/MacOS/%) \
133 $(_QT5_DLLS:%=carlafx.vst/Contents/MacOS/resources/%) \
134 $(_QT5_PLUGINS:%=carlafx.vst/Contents/MacOS/resources/%) \
135 $(_THEME_FILES:%=carlafx.vst/Contents/MacOS/resources/%)
137 _CARLA_VST2SYN_PLUGIN_FILES = \
138 carla.vst/Contents/MacOS/CarlaVstShell \
139 carla.vst/Contents/MacOS/resources/lib/library.zip \
140 $(_CARLA_HOST_FILES:%=carla.vst/Contents/MacOS/%) \
141 $(_QT5_DLLS:%=carla.vst/Contents/MacOS/resources/%) \
142 $(_QT5_PLUGINS:%=carla.vst/Contents/MacOS/resources/%) \
143 $(_THEME_FILES:%=carla.vst/Contents/MacOS/resources/%)
144 else ifeq ($(WINDOWS),true)
145 _CARLA_VST2_PLUGIN_FILES = \
146 carla.vst/CarlaVstShell.dll \
147 carla.vst/CarlaVstFxShell.dll \
148 carla.vst/resources/lib/library.zip \
149 $(_CARLA_HOST_FILES:%=carla.vst/%) \
150 $(_PYTHON_FILES:%=carla.vst/resources/%) \
151 $(_QT5_DLLS:%=carla.vst/resources/%) \
152 $(_QT5_PLUGINS:%=carla.vst/resources/%) \
153 $(_THEME_FILES:%=carla.vst/resources/%)
154 endif
155 endif # EMBED_TARGET
157 ifeq ($(MACOS),true)
158 CARLA_APP_FILES = $(_CARLA_APP_FILES:%=build/Carla.app/Contents/MacOS/%)
159 CARLA_CONTROL_APP_FILES = $(_CARLA_CONTROL_APP_FILES:%=build/Carla-Control.app/Contents/MacOS/%)
160 CARLA_PLUGIN_ZIPS = $(_PLUGIN_UIS:%=build/%.app/Contents/MacOS/lib/library.zip)
161 else ifeq ($(WINDOWS),true)
162 CARLA_APP_FILES = $(_CARLA_APP_FILES:%=build/Carla/%)
163 CARLA_CONTROL_APP_FILES = $(_CARLA_CONTROL_APP_FILES:%=build/Carla-Control/%)
164 CARLA_PLUGIN_FILES = $(_CARLA_LV2_PLUGIN_FILES:%=build/%) $(_CARLA_VST2_PLUGIN_FILES:%=build/%)
165 CARLA_PLUGIN_ZIPS = $(_PLUGIN_UIS:%=build/%-resources/lib/library.zip)
166 endif
168 # ---------------------------------------------------------------------------------------------------------------------
169 # entry point
171 ifeq ($(MACOS_UNIVERSAL),true)
172 TARGETS = Carla-$(VERSION)-macOS-universal.dmg
173 else ifeq ($(MACOS),true)
174 TARGETS = Carla-$(VERSION)-macOS.dmg
175 else ifeq ($(WINDOWS),true)
176 ifeq ($(CPU_X86_64),true)
177 TARGETS = Carla-$(VERSION)-win64.zip
178 else
179 TARGETS = Carla-$(VERSION)-win32.zip
180 endif
181 endif
183 ifeq ($(HAVE_QT5PKG),true)
184 dist: $(TARGETS)
185 else
186 dist:
187 @echo make dist not supported in this configuration
188 endif
190 # ---------------------------------------------------------------------------------------------------------------------
191 # create final file
193 Carla-$(VERSION)-macOS.dmg: $(CARLA_APP_FILES) $(CARLA_CONTROL_APP_FILES) $(CARLA_PLUGIN_FILES)build/Carla.app/Contents/Info.plist build/Carla-Control.app/Contents/Info.plist build/Carla-Plugins.pkg
194 $(call GENERATE_FINAL_DMG,intel)
196 Carla-$(VERSION)-macOS-universal.dmg: $(CARLA_APP_FILES) $(CARLA_CONTROL_APP_FILES) $(CARLA_PLUGIN_FILES)build/Carla.app/Contents/Info.plist build/Carla-Control.app/Contents/Info.plist build/Carla-Plugins.pkg
197 $(call GENERATE_FINAL_DMG,universal)
199 Carla-$(VERSION)-win32.zip: $(CARLA_APP_FILES) $(CARLA_CONTROL_APP_FILES) $(CARLA_PLUGIN_FILES)
200 $(call GENERATE_FINAL_ZIP,win32)
202 Carla-$(VERSION)-win64.zip: $(CARLA_APP_FILES) $(CARLA_CONTROL_APP_FILES) $(CARLA_PLUGIN_FILES)
203 $(call GENERATE_FINAL_ZIP,win64)
205 ifneq ($(TESTING),true)
206 define GENERATE_FINAL_DMG
207 rm -rf build/macos-pkg $@
208 mkdir build/macos-pkg
209 cp -r build/Carla.app build/Carla-Control.app build/Carla-Plugins.pkg data/macos/README build/macos-pkg/
210 hdiutil create $@ -srcfolder build/macos-pkg -volname "Carla-$(VERSION)-${1}" -fs HFS+ -ov
211 rm -rf build/macos-pkg
212 endef
213 define GENERATE_FINAL_ZIP
214 rm -rf build/Carla-$(VERSION)-${1} $@
215 mkdir build/Carla-$(VERSION)-${1}
216 cp -r build/Carla build/Carla-Control data/windows/README.txt build/Carla-$(VERSION)-${1}/
217 cp -r build/carla.lv2 build/Carla-$(VERSION)-${1}/Carla.lv2
218 cp -r build/carla.vst build/Carla-$(VERSION)-${1}/Carla.vst
219 (cd build && \
220 zip -r -9 ../$@ Carla-$(VERSION)-${1})
221 rm -rf build/Carla-$(VERSION)-${1}
222 endef
223 else
224 define GENERATE_FINAL_DMG
225 endef
226 define GENERATE_FINAL_ZIP
227 endef
228 endif
230 # ---------------------------------------------------------------------------------------------------------------------
231 # macOS plist files
233 build/Carla.app/Contents/Info.plist: build/Carla.app/Contents/MacOS/Carla
234 $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla)
235 # extra step for standalone, symlink resources used in plugin UIs
236 mkdir -p build/Carla.app/Contents/MacOS/resources
237 (cd build/Carla.app/Contents/MacOS/resources && \
238 ln -sf ../Qt* ../lib ../iconengines ../imageformats ../platforms ../styles .)
239 # mark as done
240 touch $@
242 build/Carla-Control.app/Contents/Info.plist: build/Carla-Control.app/Contents/MacOS/Carla-Control
243 $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla-Control)
244 # mark as done
245 touch $@
247 # ---------------------------------------------------------------------------------------------------------------------
248 # macOS main executables
250 build/Carla.app/Contents/MacOS/Carla: build/Carla.app/Contents/MacOS/lib/library.zip
251 $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla)
252 # mark as done
253 touch $@
255 build/Carla-Control.app/Contents/MacOS/Carla-Control: build/Carla-Control.app/Contents/MacOS/lib/library.zip
256 $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla-Control)
257 # mark as done
258 touch $@
260 # ---------------------------------------------------------------------------------------------------------------------
261 # win32 main executables
263 build/Carla/Carla.exe: build/Carla/lib/library.zip
264 $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla)
265 # mark as done
266 touch $@
268 build/Carla-Control/Carla-Control.exe: build/Carla-Control/lib/library.zip
269 $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla-Control)
270 # mark as done
271 touch $@
273 # ---------------------------------------------------------------------------------------------------------------------
274 # cleanup functions
276 ifeq ($(MACOS),true)
277 define PATCH_QT_DEPENDENCIES
278 install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" @executable_path/QtCore ${1} && \
279 install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" @executable_path/QtGui ${1} && \
280 install_name_tool -change "@rpath/QtOpenGL.framework/Versions/5/QtOpenGL" @executable_path/QtOpenGL ${1} && \
281 install_name_tool -change "@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport" @executable_path/QtPrintSupport ${1} && \
282 install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" @executable_path/QtSvg ${1} && \
283 install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" @executable_path/QtWidgets ${1} && \
284 install_name_tool -change "@rpath/QtMacExtras.framework/Versions/5/QtMacExtras" @executable_path/QtMacExtras ${1}
285 endef
287 define CLEANUP_AND_PATCH_CXFREEZE_FILES
288 # cleanup
289 find build/${1}.app/Contents/MacOS/ -type f -name "*.py" -delete
290 find build/${1}.app/Contents/MacOS/ -type f -name "*.pyi" -delete
291 find build/${1}.app/Contents/MacOS/ -type f -name "pylupdate.so" -delete
292 find build/${1}.app/Contents/MacOS/ -type f -name "pyrcc.so" -delete
293 find build/${1}.app/Contents/MacOS/ -type f -name "QtMacExtras*" -delete
294 find build/${1}.app/Contents/MacOS/ -type f -name "QtNetwork*" -delete
295 find build/${1}.app/Contents/MacOS/ -type f -name "QtSql*" -delete
296 find build/${1}.app/Contents/MacOS/ -type f -name "QtTest*" -delete
297 find build/${1}.app/Contents/MacOS/ -type f -name "QtXml*" -delete
298 #find build/${1}.app/Contents/MacOS/ -type f -name "*.pyc" -delete
299 rm -rf build/${1}.app/Contents/MacOS/lib/PyQt5/uic
300 # adjust binaries
301 (cd build/${1}.app/Contents/MacOS && \
302 for f in `find . -type f | grep -e /Qt -e QOpenGL -e libq -e carlastyle.dylib -e sip.so`; do \
303 $(call PATCH_QT_DEPENDENCIES,$$f); \
304 done)
305 endef
306 else ifeq ($(WINDOWS),true)
307 define CLEANUP_AND_PATCH_CXFREEZE_FILES
308 # cleanup
309 find build/${1}/ -type f -name "*.py" -delete
310 find build/${1}/ -type f -name "*.pyi" -delete
311 find build/${1}/ -type f -name "pylupdate.so" -delete
312 find build/${1}/ -type f -name "pyrcc.so" -delete
313 find build/${1}/ -type f -name "QtMacExtras*" -delete
314 find build/${1}/ -type f -name "QtNetwork*" -delete
315 find build/${1}/ -type f -name "QtSql*" -delete
316 find build/${1}/ -type f -name "QtTest*" -delete
317 find build/${1}/ -type f -name "QtXml*" -delete
318 #find build/${1}/ -type f -name "*.pyc" -delete
319 rm -rf build/${1}/lib/PyQt5/uic
320 endef
321 endif
323 # ---------------------------------------------------------------------------------------------------------------------
324 # cxfreeze library.zip generation function
326 ifeq ($(MACOS),true)
327 define GENERATE_LIBRARY_ZIP
328 rm -rf build/exe.*
329 env PYTHONPATH=$(CURDIR)/source/frontend SCRIPT_NAME=${1} $(PYTHON) ./data/macos/bundle.py bdist_mac --bundle-name=${1} 1>/dev/null
330 endef
331 else ifeq ($(WINDOWS),true)
332 define GENERATE_LIBRARY_ZIP
333 env PYTHONPATH="$(CURDIR)/source/frontend;$(QT5_PREFIX)/lib/python3/site-packages" SCRIPT_NAME=${1} $(PYTHON) ./data/windows/app-gui.py build_exe 1>/dev/null
334 endef
335 endif
337 # ---------------------------------------------------------------------------------------------------------------------
338 # macOS application library zip files
340 build/Carla.app/Contents/MacOS/lib/library.zip: $(CARLA_PLUGIN_ZIPS) data/macos/bundle.py data/macos/Carla.plist source/frontend/*
341 $(call GENERATE_LIBRARY_ZIP,Carla)
342 # merge all zips into 1
343 rm -rf build/Carla.app/Contents/MacOS/lib/_lib
344 mkdir build/Carla.app/Contents/MacOS/lib/_lib
345 (cd build/Carla.app/Contents/MacOS/lib/_lib && \
346 mv ../library.zip ../library-main.zip && \
347 $(_PLUGIN_UIS:%=unzip -n $(CURDIR)/build/%.app/Contents/MacOS/lib/library.zip &&) \
348 unzip -o ../library-main.zip && \
349 zip -r -9 ../library.zip *)
350 rm -rf build/Carla.app/Contents/MacOS/lib/_lib
351 rm -rf build/Carla.app/Contents/MacOS/lib/library-main.zip
353 build/Carla-Control.app/Contents/MacOS/lib/library.zip: data/macos/bundle.py data/macos/Carla-Control.plist source/frontend/*
354 $(call GENERATE_LIBRARY_ZIP,Carla-Control)
356 build/%.app/Contents/MacOS/lib/library.zip: data/macos/bundle.py source/frontend/%
357 $(call GENERATE_LIBRARY_ZIP,$*)
359 # ---------------------------------------------------------------------------------------------------------------------
360 # win32 application library zip files
362 build/Carla/lib/library.zip: $(CARLA_PLUGIN_ZIPS) data/windows/app-gui.py source/frontend/* resources/ico/carla.ico
363 $(call GENERATE_LIBRARY_ZIP,Carla)
364 # merge all zips into 1
365 rm -rf build/Carla/lib/_lib
366 mkdir build/Carla/lib/_lib
367 (cd build/Carla/lib/_lib && \
368 mv ../library.zip ../library-main.zip && \
369 $(_PLUGIN_UIS:%=unzip -n $(CURDIR)/build/%-resources/lib/library.zip &&) \
370 unzip -o ../library-main.zip && \
371 zip -r -9 ../library.zip *)
372 rm -rf build/Carla/lib/_lib
373 rm -rf build/Carla/lib/library-main.zip
374 ifeq ($(EMBED_TARGET),true)
375 rm -f build/Carla/Carla.exe
376 endif
378 build/Carla-Control/lib/library.zip: data/windows/app-gui.py source/frontend/* resources/ico/carla-control.ico
379 $(call GENERATE_LIBRARY_ZIP,Carla-Control)
381 build/%-resources/lib/library.zip: data/windows/app-gui.py source/frontend/% resources/ico/carla.ico
382 $(call GENERATE_LIBRARY_ZIP,$*)
383 # delete useless files
384 rm -rf build/$*-resources/lib/*.dll build/$*-resources/lib/*.pyd build/$*-resources/lib/PyQt5
386 # ---------------------------------------------------------------------------------------------------------------------
387 # macOS plugin UIs (stored in resources, depend on their respective library.zip)
389 build/Carla.app/Contents/MacOS/resources/%: build/%.app/Contents/MacOS/lib/library.zip
390 -@mkdir -p $(shell dirname $@)
391 @cp -v build/$*.app/Contents/MacOS/$* $@
393 # ---------------------------------------------------------------------------------------------------------------------
394 # win32 plugin UIs (stored in resources, depend on their respective library.zip)
396 build/Carla/resources/%.exe: build/%-resources/lib/library.zip
397 -@mkdir -p $(shell dirname $@)
398 @cp -v build/$*-resources/$*.exe $@
400 # ---------------------------------------------------------------------------------------------------------------------
401 # common generic bundle files (either Qt or Carla binaries)
403 ifeq ($(MACOS),true)
404 _BUNDLE_EXTRA_PATH = /Contents/MacOS
405 _APP_BUNDLE_EXTRA_PATH = .app$(_BUNDLE_EXTRA_PATH)
406 endif
408 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/iconengines/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/iconengines/%: $(QT5_PREFIX)/lib/qt5/plugins/iconengines/%
409 -@mkdir -p $(shell dirname $@)
410 @cp -v $< $@
412 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/imageformats/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/imageformats/%: $(QT5_PREFIX)/lib/qt5/plugins/imageformats/%
413 -@mkdir -p $(shell dirname $@)
414 @cp -v $< $@
416 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/platforms/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/platforms/%: $(QT5_PREFIX)/lib/qt5/plugins/platforms/%
417 -@mkdir -p $(shell dirname $@)
418 @cp -v $< $@
420 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/styles/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/styles/%: bin/styles/%
421 -@mkdir -p $(shell dirname $@)
422 @cp -v $< $@
424 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/lib: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/lib/library.zip
425 -@mkdir -p $(shell dirname $@)
426 @ln -sfv ../lib $@
428 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/%: bin/%
429 -@mkdir -p $(shell dirname $@)
430 @cp -v $< $@
432 # ---------------------------------------------------------------------------------------------------------------------
433 # macOS generic bundle files (either Qt or Carla binaries)
435 build/Carla.app/Contents/MacOS/Qt% build/Carla-Control.app/Contents/MacOS/Qt%: $(QT5_PREFIX)/lib/Qt%.framework
436 -@mkdir -p $(shell dirname $@)
437 @cp -v $</Versions/5/Qt$* $@
439 # ---------------------------------------------------------------------------------------------------------------------
440 # win32 generic bundle files (either Qt or Carla binaries)
442 build/Carla/libpython3% build/Carla-Control/libpython3%: $(QT5_PREFIX)/bin/libpython3%
443 -@mkdir -p $(shell dirname $@)
444 @cp -v $< $@
446 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/Qt5% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/Qt5%: $(QT5_PREFIX)/bin/Qt5%
447 -@mkdir -p $(shell dirname $@)
448 @cp -v $< $@
450 # ---------------------------------------------------------------------------------------------------------------------
451 # common plugin rules
453 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/carla-plugin-patchbay$(APP_EXT): build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/carla-plugin$(APP_EXT)
454 @ln -sfv carla-plugin$(APP_EXT) $@
456 build/Carla$(_APP_BUNDLE_EXTRA_PATH)/magic.mgc build/carla.lv2/magic.mgc build/carla.vst$(_BUNDLE_EXTRA_PATH)/magic.mgc build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/magic.mgc: $(QT5_PREFIX)/share/misc/magic.mgc
457 -@mkdir -p $(shell dirname $@)
458 @cp -v $< $@
460 build/carla.lv2/resources/lib/library.zip build/carla.vst$(_BUNDLE_EXTRA_PATH)/resources/lib/library.zip build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/resources/lib/library.zip: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/lib/library.zip
461 -@mkdir -p $(shell dirname $@)
462 @cp -rv build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/lib/* $(shell dirname $@)/
464 build/carla.lv2/resources/Qt% build/carla.vst$(_BUNDLE_EXTRA_PATH)/resources/Qt% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/resources/Qt%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/Qt%
465 -@mkdir -p $(shell dirname $@)
466 @cp -v $< $@
468 build/carla.lv2/resources/iconengines/% build/carla.vst$(_BUNDLE_EXTRA_PATH)/resources/iconengines/% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/resources/iconengines/%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/iconengines/%
469 -@mkdir -p $(shell dirname $@)
470 @cp -v $< $@
472 build/carla.lv2/resources/imageformats/% build/carla.vst$(_BUNDLE_EXTRA_PATH)/resources/imageformats/% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/resources/imageformats/%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/imageformats/%
473 -@mkdir -p $(shell dirname $@)
474 @cp -v $< $@
476 build/carla.lv2/resources/platforms/% build/carla.vst$(_BUNDLE_EXTRA_PATH)/resources/platforms/% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/resources/platforms/%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/platforms/%
477 -@mkdir -p $(shell dirname $@)
478 @cp -v $< $@
480 build/carla.lv2/resources/styles/% build/carla.vst$(_BUNDLE_EXTRA_PATH)/resources/styles/% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/resources/styles/%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/styles/%
481 -@mkdir -p $(shell dirname $@)
482 @cp -v $< $@
484 build/carla.lv2/resources/% build/carla.vst$(_BUNDLE_EXTRA_PATH)/resources/% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/resources/%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/%
485 -@mkdir -p $(shell dirname $@)
486 @cp -v $< $@
488 build/carla.lv2/%$(LIB_EXT) build/carla.vst$(_BUNDLE_EXTRA_PATH)/%$(LIB_EXT) build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/%$(LIB_EXT): bin/%$(LIB_EXT)
489 -@mkdir -p $(shell dirname $@)
490 @cp -v $< $@
492 build/carla.lv2/% build/carla.vst$(_BUNDLE_EXTRA_PATH)/% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/%
493 -@mkdir -p $(shell dirname $@)
494 @cp -v $< $@
496 # build/carla.lv2/resources/% build/carla.vst/resources/%: build/Carla/resources/%
497 # -@mkdir -p $(shell dirname $@)
498 # @cp -v $< $@
500 # ---------------------------------------------------------------------------------------------------------------------
501 # win32 plugin rules
503 build/carla.lv2/resources/libpython3% build/carla.vst/resources/libpython3%: build/Carla/libpython3%
504 -@mkdir -p $(shell dirname $@)
505 @cp -v $< $@
507 # ---------------------------------------------------------------------------------------------------------------------
508 # LV2 specific files
510 build/carla.lv2/manifest.ttl: bin/carla.lv2/manifest.ttl
511 -@mkdir -p $(shell dirname $@)
512 @cp -v bin/carla.lv2/*.ttl build/carla.lv2/
514 build/carla.lv2/carla$(LIB_EXT): bin/carla.lv2/carla$(LIB_EXT)
515 -@mkdir -p $(shell dirname $@)
516 @cp -v $< $@
518 # ---------------------------------------------------------------------------------------------------------------------
519 # macOS plugin rules
521 MACOS_PACKAGE_EXP = -e 's/version="0"/version="$(VERSION)"/'
522 ifeq ($(CPU_ARM64),true)
523 MACOS_PACKAGE_EXP += -e 's/hostArchitectures="x86_64"/hostArchitectures="arm64,x86_64"/'
524 endif
526 build/Carla-Plugins.pkg: build/carla-lv2.pkg build/carla-vst2fx.pkg build/carla-vst2syn.pkg build/package.xml
527 productbuild \
528 --distribution build/package.xml \
529 --identifier studio.kx.carla \
530 --package-path "build" \
531 --version "$(VERSION)" \
532 "$@"
534 build/package.xml: data/macos/package.xml
535 sed $(MACOS_PACKAGE_EXP) $< > $@
537 build/carla-lv2.pkg: $(_CARLA_LV2_PLUGIN_FILES:%=build/%)
538 pkgbuild \
539 --identifier "studio.kx.carla.lv2" \
540 --install-location "/Library/Audio/Plug-Ins/LV2/carla.lv2/" \
541 --root "build/carla.lv2/" \
542 "$@"
544 build/carla-vst2fx.pkg: $(_CARLA_VST2FX_PLUGIN_FILES:%=build/%)
545 pkgbuild \
546 --identifier "studio.kx.carla.vst2fx" \
547 --install-location "/Library/Audio/Plug-Ins/VST/carlafx.vst/" \
548 --root "build/carlafx.vst/" \
549 "$@"
551 build/carla-vst2syn.pkg: $(_CARLA_VST2SYN_PLUGIN_FILES:%=build/%)
552 pkgbuild \
553 --identifier "studio.kx.carla.vst2syn" \
554 --install-location "/Library/Audio/Plug-Ins/VST/carla.vst/" \
555 --root "build/carla.vst/" \
556 "$@"
558 # ---------------------------------------------------------------------------------------------------------------------
559 # macOS VST2 specific files
561 _MACVST_FILES = Contents/Info.plist Contents/PkgInfo Contents/Resources/empty.lproj
563 build/carla.vst/Contents/MacOS/CarlaVstShell: bin/CarlaVstShell.dylib $(_MACVST_FILES:%=build/carla.vst/%)
564 -@mkdir -p $(shell dirname $@)
565 @cp -v $< $@
567 build/carlafx.vst/Contents/MacOS/CarlaVstFxShell: bin/CarlaVstFxShell.dylib $(_MACVST_FILES:%=build/carlafx.vst/%)
568 -@mkdir -p $(shell dirname $@)
569 @cp -v $< $@
571 # ---------------------------------------------------------------------------------------------------------------------
573 build/carla.vst/Contents/Info.plist: data/macos/CarlaVstShell.plist
574 -@mkdir -p $(shell dirname $@)
575 @cp -v $< $@
577 build/carlafx.vst/Contents/Info.plist: data/macos/CarlaVstFxShell.plist
578 -@mkdir -p $(shell dirname $@)
579 @cp -v $< $@
581 build/%.vst/Contents/PkgInfo:
582 -@mkdir -p $(shell dirname $@)
583 @echo "BNDL????" > $@
585 build/%.vst/Contents/Resources/empty.lproj:
586 -@mkdir -p $(shell dirname $@)
587 @touch $@
589 # ---------------------------------------------------------------------------------------------------------------------