Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

578 lines
23KB

  1. #!/usr/bin/make -f
  2. # Makefile for Carla #
  3. # ------------------ #
  4. # Created by falkTX
  5. #
  6. # NOTE to be imported from main Makefile
  7. # ---------------------------------------------------------------------------------------------------------------------
  8. PYTHON = $(EXE_WRAPPER) $(shell which python3$(APP_EXT))
  9. ifeq ($(WIN32),true)
  10. QT5_DLL_EXT = .dll
  11. QT5_DLL_V = 5
  12. endif
  13. ifeq ($(MACOS),true)
  14. QT5_LIB_PREFIX = lib
  15. endif
  16. ifeq ($(HAVE_QT5PKG),true)
  17. QT5_PREFIX = $(shell pkg-config --variable=prefix Qt5OpenGLExtensions)
  18. endif
  19. # ---------------------------------------------------------------------------------------------------------------------
  20. _PLUGIN_UIS = \
  21. carla-plugin \
  22. carla-plugin-patchbay \
  23. bigmeter-ui \
  24. midipattern-ui \
  25. notes-ui \
  26. xycontroller-ui
  27. _QT5_DLLS = \
  28. Qt$(QT5_DLL_V)Core$(QT5_DLL_EXT) \
  29. Qt$(QT5_DLL_V)Gui$(QT5_DLL_EXT) \
  30. Qt$(QT5_DLL_V)OpenGL$(QT5_DLL_EXT) \
  31. Qt$(QT5_DLL_V)PrintSupport$(QT5_DLL_EXT) \
  32. Qt$(QT5_DLL_V)Svg$(QT5_DLL_EXT) \
  33. Qt$(QT5_DLL_V)Widgets$(QT5_DLL_EXT)
  34. _QT5_PLUGINS = \
  35. iconengines/$(QT5_LIB_PREFIX)qsvgicon$(LIB_EXT) \
  36. imageformats/$(QT5_LIB_PREFIX)qjpeg$(LIB_EXT) \
  37. imageformats/$(QT5_LIB_PREFIX)qsvg$(LIB_EXT)
  38. ifeq ($(MACOS),true)
  39. _QT5_PLUGINS += platforms/$(QT5_LIB_PREFIX)qcocoa$(LIB_EXT)
  40. else ifeq ($(WIN32),true)
  41. _QT5_PLUGINS += platforms/$(QT5_LIB_PREFIX)qwindows$(LIB_EXT)
  42. endif
  43. # NOTE this has to be hardcoded for now. oh well
  44. ifeq ($(WIN32),true)
  45. _PYTHON_FILES = \
  46. libpython3.8.dll
  47. endif
  48. _THEME_FILES = \
  49. styles/carlastyle.json \
  50. styles/carlastyle$(LIB_EXT)
  51. _CARLA_HOST_FILES = \
  52. carla-bridge-lv2$(LIB_EXT) \
  53. carla-bridge-lv2-gtk2$(APP_EXT) \
  54. carla-bridge-lv2-gtk3$(APP_EXT) \
  55. carla-bridge-native$(APP_EXT) \
  56. carla-discovery-native$(APP_EXT) \
  57. libcarla_utils$(LIB_EXT) \
  58. $(_PLUGIN_UIS:%=resources/%$(APP_EXT))
  59. ifeq ($(MACOS),true)
  60. _CARLA_HOST_FILES += carla-bridge-lv2-cocoa$(APP_EXT)
  61. _CARLA_HOST_FILES += magic.mgc
  62. else ifeq ($(WIN32),true)
  63. _CARLA_HOST_FILES += carla-bridge-lv2-windows$(APP_EXT)
  64. endif
  65. ifeq ($(MACOS),true)
  66. ifneq ($(MACOS_UNIVERSAL),true)
  67. _CARLA_HOST_FILES += carla-bridge-posix32
  68. _CARLA_HOST_FILES += carla-discovery-posix32
  69. endif
  70. endif
  71. ifeq ($(WIN64),true)
  72. _CARLA_HOST_FILES += carla-bridge-win32$(APP_EXT)
  73. _CARLA_HOST_FILES += carla-discovery-win32$(APP_EXT)
  74. endif
  75. _CARLA_APP_FILES = \
  76. Carla$(APP_EXT) \
  77. libcarla_host-plugin$(LIB_EXT) \
  78. libcarla_native-plugin$(LIB_EXT) \
  79. libcarla_standalone2$(LIB_EXT) \
  80. $(_CARLA_HOST_FILES) \
  81. $(_PYTHON_FILES) \
  82. $(_QT5_DLLS) \
  83. $(_QT5_PLUGINS) \
  84. $(_THEME_FILES) \
  85. resources/lib
  86. _CARLA_CONTROL_APP_FILES = \
  87. Carla-Control$(APP_EXT) \
  88. libcarla_utils$(LIB_EXT) \
  89. $(_PYTHON_FILES) \
  90. $(_QT5_DLLS) \
  91. $(_QT5_PLUGINS) \
  92. $(_THEME_FILES)
  93. _CARLA_LV2_PLUGIN_FILES = \
  94. carla.lv2/carla$(LIB_EXT) \
  95. carla.lv2/manifest.ttl \
  96. carla.lv2/resources/lib/library.zip \
  97. $(_CARLA_HOST_FILES:%=carla.lv2/%) \
  98. $(_PYTHON_FILES:%=carla.lv2/resources/%) \
  99. $(_QT5_DLLS:%=carla.lv2/resources/%) \
  100. $(_QT5_PLUGINS:%=carla.lv2/resources/%) \
  101. $(_THEME_FILES:%=carla.lv2/resources/%)
  102. ifeq ($(MACOS),true)
  103. _CARLA_VST2FX_PLUGIN_FILES = \
  104. carlafx.vst/Contents/MacOS/CarlaVstFxShell \
  105. carlafx.vst/Contents/MacOS/resources/lib/library.zip \
  106. $(_CARLA_HOST_FILES:%=carlafx.vst/Contents/MacOS/%) \
  107. $(_QT5_DLLS:%=carlafx.vst/Contents/MacOS/resources/%) \
  108. $(_QT5_PLUGINS:%=carlafx.vst/Contents/MacOS/resources/%) \
  109. $(_THEME_FILES:%=carlafx.vst/Contents/MacOS/resources/%)
  110. _CARLA_VST2SYN_PLUGIN_FILES = \
  111. carla.vst/Contents/MacOS/CarlaVstShell \
  112. carla.vst/Contents/MacOS/resources/lib/library.zip \
  113. $(_CARLA_HOST_FILES:%=carla.vst/Contents/MacOS/%) \
  114. $(_QT5_DLLS:%=carla.vst/Contents/MacOS/resources/%) \
  115. $(_QT5_PLUGINS:%=carla.vst/Contents/MacOS/resources/%) \
  116. $(_THEME_FILES:%=carla.vst/Contents/MacOS/resources/%)
  117. else ifeq ($(WIN32),true)
  118. _CARLA_VST2_PLUGIN_FILES = \
  119. carla.vst/CarlaVstShell.dll \
  120. carla.vst/CarlaVstFxShell.dll \
  121. carla.vst/resources/lib/library.zip \
  122. $(_CARLA_HOST_FILES:%=carla.vst/%) \
  123. $(_PYTHON_FILES:%=carla.vst/resources/%) \
  124. $(_QT5_DLLS:%=carla.vst/resources/%) \
  125. $(_QT5_PLUGINS:%=carla.vst/resources/%) \
  126. $(_THEME_FILES:%=carla.vst/resources/%)
  127. endif
  128. ifeq ($(MACOS),true)
  129. CARLA_APP_FILES = $(_CARLA_APP_FILES:%=build/Carla.app/Contents/MacOS/%)
  130. CARLA_CONTROL_APP_FILES = $(_CARLA_CONTROL_APP_FILES:%=build/Carla-Control.app/Contents/MacOS/%)
  131. CARLA_PLUGIN_ZIPS = $(_PLUGIN_UIS:%=build/%.app/Contents/MacOS/lib/library.zip)
  132. else ifeq ($(WIN32),true)
  133. CARLA_APP_FILES = $(_CARLA_APP_FILES:%=build/Carla/%)
  134. CARLA_CONTROL_APP_FILES = $(_CARLA_CONTROL_APP_FILES:%=build/Carla-Control/%)
  135. CARLA_PLUGIN_FILES = $(_CARLA_LV2_PLUGIN_FILES:%=build/%) $(_CARLA_VST2_PLUGIN_FILES:%=build/%)
  136. CARLA_PLUGIN_ZIPS = $(_PLUGIN_UIS:%=build/%-resources/lib/library.zip)
  137. endif
  138. # ---------------------------------------------------------------------------------------------------------------------
  139. # entry point
  140. ifeq ($(MACOS_UNIVERSAL),true)
  141. TARGETS = Carla-$(VERSION)-macOS-universal.dmg
  142. else ifeq ($(MACOS),true)
  143. TARGETS = Carla-$(VERSION)-macOS.dmg
  144. else ifeq ($(WIN64),true)
  145. TARGETS = Carla-$(VERSION)-win64.zip
  146. else ifeq ($(WIN32),true)
  147. TARGETS = Carla-$(VERSION)-win32.zip
  148. endif
  149. ifeq ($(HAVE_QT5PKG),true)
  150. dist: $(TARGETS)
  151. else
  152. dist:
  153. @echo make dist not supported in this configuration
  154. endif
  155. # ---------------------------------------------------------------------------------------------------------------------
  156. # create final file
  157. 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
  158. $(call GENERATE_FINAL_DMG,intel)
  159. 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
  160. $(call GENERATE_FINAL_DMG,universal)
  161. Carla-$(VERSION)-win32.zip: $(CARLA_APP_FILES) $(CARLA_CONTROL_APP_FILES) $(CARLA_PLUGIN_FILES)
  162. $(call GENERATE_FINAL_ZIP,win32)
  163. Carla-$(VERSION)-win64.zip: $(CARLA_APP_FILES) $(CARLA_CONTROL_APP_FILES) $(CARLA_PLUGIN_FILES)
  164. $(call GENERATE_FINAL_ZIP,win64)
  165. ifneq ($(TESTING),true)
  166. define GENERATE_FINAL_DMG
  167. rm -rf build/macos-pkg $@
  168. mkdir build/macos-pkg
  169. cp -r build/Carla.app build/Carla-Control.app build/Carla-Plugins.pkg data/macos/README build/macos-pkg/
  170. hdiutil create $@ -srcfolder build/macos-pkg -volname "Carla-$(VERSION)-${1}" -fs HFS+ -ov
  171. rm -rf build/macos-pkg
  172. endef
  173. define GENERATE_FINAL_ZIP
  174. rm -rf build/Carla-$(VERSION)-${1} $@
  175. mkdir build/Carla-$(VERSION)-${1}
  176. cp -r build/Carla build/Carla-Control data/windows/README.txt build/Carla-$(VERSION)-${1}/
  177. cp -r build/carla.lv2 build/Carla-$(VERSION)-${1}/Carla.lv2
  178. cp -r build/carla.vst build/Carla-$(VERSION)-${1}/Carla.vst
  179. (cd build && \
  180. zip -r -9 ../$@ Carla-$(VERSION)-${1})
  181. rm -rf build/Carla-$(VERSION)-${1}
  182. endef
  183. else
  184. define GENERATE_FINAL_DMG
  185. endef
  186. define GENERATE_FINAL_ZIP
  187. endef
  188. endif
  189. # ---------------------------------------------------------------------------------------------------------------------
  190. # macOS plist files
  191. build/Carla.app/Contents/Info.plist: build/Carla.app/Contents/MacOS/Carla
  192. $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla)
  193. # extra step for standalone, symlink resources used in plugin UIs
  194. mkdir -p build/Carla.app/Contents/MacOS/resources
  195. (cd build/Carla.app/Contents/MacOS/resources && \
  196. ln -sf ../Qt* ../lib ../iconengines ../imageformats ../platforms ../styles .)
  197. # mark as done
  198. touch $@
  199. build/Carla-Control.app/Contents/Info.plist: build/Carla-Control.app/Contents/MacOS/Carla-Control
  200. $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla-Control)
  201. # mark as done
  202. touch $@
  203. # ---------------------------------------------------------------------------------------------------------------------
  204. # macOS main executables
  205. build/Carla.app/Contents/MacOS/Carla: build/Carla.app/Contents/MacOS/lib/library.zip
  206. $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla)
  207. # mark as done
  208. touch $@
  209. build/Carla-Control.app/Contents/MacOS/Carla-Control: build/Carla-Control.app/Contents/MacOS/lib/library.zip
  210. $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla-Control)
  211. # mark as done
  212. touch $@
  213. # ---------------------------------------------------------------------------------------------------------------------
  214. # win32 main executables
  215. build/Carla/Carla.exe: build/Carla/lib/library.zip
  216. $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla)
  217. # mark as done
  218. touch $@
  219. build/Carla-Control/Carla-Control.exe: build/Carla-Control/lib/library.zip
  220. $(call CLEANUP_AND_PATCH_CXFREEZE_FILES,Carla-Control)
  221. # mark as done
  222. touch $@
  223. # ---------------------------------------------------------------------------------------------------------------------
  224. # cleanup functions
  225. ifeq ($(MACOS),true)
  226. define PATCH_QT_DEPENDENCIES
  227. install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" @executable_path/QtCore ${1} && \
  228. install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" @executable_path/QtGui ${1} && \
  229. install_name_tool -change "@rpath/QtOpenGL.framework/Versions/5/QtOpenGL" @executable_path/QtOpenGL ${1} && \
  230. install_name_tool -change "@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport" @executable_path/QtPrintSupport ${1} && \
  231. install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" @executable_path/QtSvg ${1} && \
  232. install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" @executable_path/QtWidgets ${1} && \
  233. install_name_tool -change "@rpath/QtMacExtras.framework/Versions/5/QtMacExtras" @executable_path/QtMacExtras ${1}
  234. endef
  235. define CLEANUP_AND_PATCH_CXFREEZE_FILES
  236. # cleanup
  237. find build/${1}.app/Contents/MacOS/ -type f -name "*.py" -delete
  238. find build/${1}.app/Contents/MacOS/ -type f -name "*.pyi" -delete
  239. find build/${1}.app/Contents/MacOS/ -type f -name "pylupdate.so" -delete
  240. find build/${1}.app/Contents/MacOS/ -type f -name "pyrcc.so" -delete
  241. find build/${1}.app/Contents/MacOS/ -type f -name "QtMacExtras*" -delete
  242. find build/${1}.app/Contents/MacOS/ -type f -name "QtNetwork*" -delete
  243. find build/${1}.app/Contents/MacOS/ -type f -name "QtSql*" -delete
  244. find build/${1}.app/Contents/MacOS/ -type f -name "QtTest*" -delete
  245. find build/${1}.app/Contents/MacOS/ -type f -name "QtXml*" -delete
  246. #find build/${1}.app/Contents/MacOS/ -type f -name "*.pyc" -delete
  247. rm -rf build/${1}.app/Contents/MacOS/lib/PyQt5/uic
  248. # adjust binaries
  249. (cd build/${1}.app/Contents/MacOS && \
  250. for f in `find . -type f | grep -e /Qt -e QOpenGL -e libq -e carlastyle.dylib -e sip.so`; do \
  251. $(call PATCH_QT_DEPENDENCIES,$$f); \
  252. done)
  253. endef
  254. else ifeq ($(WIN32),true)
  255. define CLEANUP_AND_PATCH_CXFREEZE_FILES
  256. # cleanup
  257. find build/${1}/ -type f -name "*.py" -delete
  258. find build/${1}/ -type f -name "*.pyi" -delete
  259. find build/${1}/ -type f -name "pylupdate.so" -delete
  260. find build/${1}/ -type f -name "pyrcc.so" -delete
  261. find build/${1}/ -type f -name "QtMacExtras*" -delete
  262. find build/${1}/ -type f -name "QtNetwork*" -delete
  263. find build/${1}/ -type f -name "QtSql*" -delete
  264. find build/${1}/ -type f -name "QtTest*" -delete
  265. find build/${1}/ -type f -name "QtXml*" -delete
  266. #find build/${1}/ -type f -name "*.pyc" -delete
  267. rm -rf build/${1}/lib/PyQt5/uic
  268. endef
  269. endif
  270. # ---------------------------------------------------------------------------------------------------------------------
  271. # cxfreeze library.zip generation function
  272. ifeq ($(MACOS),true)
  273. define GENERATE_LIBRARY_ZIP
  274. rm -rf build/exe.*
  275. env PYTHONPATH=$(CURDIR)/source/frontend SCRIPT_NAME=${1} $(PYTHON) ./data/macos/bundle.py bdist_mac --bundle-name=${1} 1>/dev/null
  276. endef
  277. else ifeq ($(WIN32),true)
  278. define GENERATE_LIBRARY_ZIP
  279. 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
  280. endef
  281. endif
  282. # ---------------------------------------------------------------------------------------------------------------------
  283. # macOS application library zip files
  284. build/Carla.app/Contents/MacOS/lib/library.zip: $(CARLA_PLUGIN_ZIPS) data/macos/bundle.py data/macos/Carla.plist source/frontend/*
  285. $(call GENERATE_LIBRARY_ZIP,Carla)
  286. # merge all zips into 1
  287. rm -rf build/Carla.app/Contents/MacOS/lib/_lib
  288. mkdir build/Carla.app/Contents/MacOS/lib/_lib
  289. (cd build/Carla.app/Contents/MacOS/lib/_lib && \
  290. mv ../library.zip ../library-main.zip && \
  291. $(_PLUGIN_UIS:%=unzip -n $(CURDIR)/build/%.app/Contents/MacOS/lib/library.zip &&) \
  292. unzip -o ../library-main.zip && \
  293. zip -r -9 ../library.zip *)
  294. rm -rf build/Carla.app/Contents/MacOS/lib/_lib
  295. rm -rf build/Carla.app/Contents/MacOS/lib/library-main.zip
  296. build/Carla-Control.app/Contents/MacOS/lib/library.zip: data/macos/bundle.py data/macos/Carla-Control.plist source/frontend/*
  297. $(call GENERATE_LIBRARY_ZIP,Carla-Control)
  298. build/%.app/Contents/MacOS/lib/library.zip: data/macos/bundle.py source/frontend/%
  299. $(call GENERATE_LIBRARY_ZIP,$*)
  300. # ---------------------------------------------------------------------------------------------------------------------
  301. # win32 application library zip files
  302. build/Carla/lib/library.zip: $(CARLA_PLUGIN_ZIPS) data/windows/app-gui.py source/frontend/* resources/ico/carla.ico
  303. $(call GENERATE_LIBRARY_ZIP,Carla)
  304. # merge all zips into 1
  305. rm -rf build/Carla/lib/_lib
  306. mkdir build/Carla/lib/_lib
  307. (cd build/Carla/lib/_lib && \
  308. mv ../library.zip ../library-main.zip && \
  309. $(_PLUGIN_UIS:%=unzip -n $(CURDIR)/build/%-resources/lib/library.zip &&) \
  310. unzip -o ../library-main.zip && \
  311. zip -r -9 ../library.zip *)
  312. rm -rf build/Carla/lib/_lib
  313. rm -rf build/Carla/lib/library-main.zip
  314. build/Carla-Control/lib/library.zip: data/windows/app-gui.py source/frontend/* resources/ico/carla-control.ico
  315. $(call GENERATE_LIBRARY_ZIP,Carla-Control)
  316. build/%-resources/lib/library.zip: data/windows/app-gui.py source/frontend/% resources/ico/carla.ico
  317. $(call GENERATE_LIBRARY_ZIP,$*)
  318. # delete useless files
  319. rm -rf build/$*-resources/lib/*.dll build/$*-resources/lib/*.pyd build/$*-resources/lib/PyQt5
  320. # ---------------------------------------------------------------------------------------------------------------------
  321. # macOS plugin UIs (stored in resources, depend on their respective library.zip)
  322. build/Carla.app/Contents/MacOS/resources/%: build/%.app/Contents/MacOS/lib/library.zip
  323. -@mkdir -p $(shell dirname $@)
  324. @cp -v build/$*.app/Contents/MacOS/$* $@
  325. # ---------------------------------------------------------------------------------------------------------------------
  326. # win32 plugin UIs (stored in resources, depend on their respective library.zip)
  327. build/Carla/resources/%.exe: build/%-resources/lib/library.zip
  328. -@mkdir -p $(shell dirname $@)
  329. @cp -v build/$*-resources/$*.exe $@
  330. # ---------------------------------------------------------------------------------------------------------------------
  331. # common generic bundle files (either Qt or Carla binaries)
  332. ifeq ($(MACOS),true)
  333. _BUNDLE_EXTRA_PATH = /Contents/MacOS
  334. _APP_BUNDLE_EXTRA_PATH = .app$(_BUNDLE_EXTRA_PATH)
  335. endif
  336. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/iconengines/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/iconengines/%: $(QT5_PREFIX)/lib/qt5/plugins/iconengines/%
  337. -@mkdir -p $(shell dirname $@)
  338. @cp -v $< $@
  339. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/imageformats/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/imageformats/%: $(QT5_PREFIX)/lib/qt5/plugins/imageformats/%
  340. -@mkdir -p $(shell dirname $@)
  341. @cp -v $< $@
  342. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/platforms/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/platforms/%: $(QT5_PREFIX)/lib/qt5/plugins/platforms/%
  343. -@mkdir -p $(shell dirname $@)
  344. @cp -v $< $@
  345. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/styles/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/styles/%: bin/styles/%
  346. -@mkdir -p $(shell dirname $@)
  347. @cp -v $< $@
  348. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/lib: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/lib/library.zip
  349. -@mkdir -p $(shell dirname $@)
  350. @ln -sfv ../lib $@
  351. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/%: bin/%
  352. -@mkdir -p $(shell dirname $@)
  353. @cp -v $< $@
  354. # ---------------------------------------------------------------------------------------------------------------------
  355. # macOS generic bundle files (either Qt or Carla binaries)
  356. build/Carla.app/Contents/MacOS/Qt% build/Carla-Control.app/Contents/MacOS/Qt%: $(QT5_PREFIX)/lib/Qt%.framework
  357. -@mkdir -p $(shell dirname $@)
  358. @cp -v $</Versions/5/Qt$* $@
  359. # ---------------------------------------------------------------------------------------------------------------------
  360. # win32 generic bundle files (either Qt or Carla binaries)
  361. build/Carla/libpython3% build/Carla-Control/libpython3%: $(QT5_PREFIX)/bin/libpython3%
  362. -@mkdir -p $(shell dirname $@)
  363. @cp -v $< $@
  364. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/Qt5% build/Carla-Control$(_APP_BUNDLE_EXTRA_PATH)/Qt5%: $(QT5_PREFIX)/bin/Qt5%
  365. -@mkdir -p $(shell dirname $@)
  366. @cp -v $< $@
  367. # ---------------------------------------------------------------------------------------------------------------------
  368. # common plugin rules
  369. build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/carla-plugin-patchbay$(APP_EXT): build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/carla-plugin$(APP_EXT)
  370. @ln -sfv carla-plugin$(APP_EXT) $@
  371. 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
  372. -@mkdir -p $(shell dirname $@)
  373. @cp -v $< $@
  374. 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
  375. -@mkdir -p $(shell dirname $@)
  376. @cp -rv build/Carla$(_APP_BUNDLE_EXTRA_PATH)/resources/lib/* $(shell dirname $@)/
  377. 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%
  378. -@mkdir -p $(shell dirname $@)
  379. @cp -v $< $@
  380. 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/%
  381. -@mkdir -p $(shell dirname $@)
  382. @cp -v $< $@
  383. 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/%
  384. -@mkdir -p $(shell dirname $@)
  385. @cp -v $< $@
  386. 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/%
  387. -@mkdir -p $(shell dirname $@)
  388. @cp -v $< $@
  389. 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/%
  390. -@mkdir -p $(shell dirname $@)
  391. @cp -v $< $@
  392. 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/%
  393. -@mkdir -p $(shell dirname $@)
  394. @cp -v $< $@
  395. build/carla.lv2/%$(LIB_EXT) build/carla.vst$(_BUNDLE_EXTRA_PATH)/%$(LIB_EXT) build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/%$(LIB_EXT): bin/%$(LIB_EXT)
  396. -@mkdir -p $(shell dirname $@)
  397. @cp -v $< $@
  398. build/carla.lv2/% build/carla.vst$(_BUNDLE_EXTRA_PATH)/% build/carlafx.vst$(_BUNDLE_EXTRA_PATH)/%: build/Carla$(_APP_BUNDLE_EXTRA_PATH)/%
  399. -@mkdir -p $(shell dirname $@)
  400. @cp -v $< $@
  401. # build/carla.lv2/resources/% build/carla.vst/resources/%: build/Carla/resources/%
  402. # -@mkdir -p $(shell dirname $@)
  403. # @cp -v $< $@
  404. # ---------------------------------------------------------------------------------------------------------------------
  405. # win32 plugin rules
  406. build/carla.lv2/resources/libpython3% build/carla.vst/resources/libpython3%: build/Carla/libpython3%
  407. -@mkdir -p $(shell dirname $@)
  408. @cp -v $< $@
  409. # ---------------------------------------------------------------------------------------------------------------------
  410. # LV2 specific files
  411. build/carla.lv2/manifest.ttl: bin/carla.lv2/manifest.ttl
  412. -@mkdir -p $(shell dirname $@)
  413. @cp -v bin/carla.lv2/*.ttl build/carla.lv2/
  414. build/carla.lv2/carla$(LIB_EXT): bin/carla.lv2/carla$(LIB_EXT)
  415. -@mkdir -p $(shell dirname $@)
  416. @cp -v $< $@
  417. # ---------------------------------------------------------------------------------------------------------------------
  418. # macOS plugin rules
  419. MACOS_PACKAGE_EXP = -e 's/version="0"/version="$(VERSION)"/'
  420. ifeq ($(CPU_ARM64),true)
  421. MACOS_PACKAGE_EXP += -e 's/hostArchitectures="x86_64"/hostArchitectures="arm64,x86_64"/'
  422. endif
  423. build/Carla-Plugins.pkg: build/carla-lv2.pkg build/carla-vst2fx.pkg build/carla-vst2syn.pkg build/package.xml
  424. productbuild \
  425. --distribution build/package.xml \
  426. --identifier studio.kx.carla \
  427. --package-path "build" \
  428. --version "$(VERSION)" \
  429. "$@"
  430. build/package.xml: data/macos/package.xml
  431. sed $(MACOS_PACKAGE_EXP) $< > $@
  432. build/carla-lv2.pkg: $(_CARLA_LV2_PLUGIN_FILES:%=build/%)
  433. pkgbuild \
  434. --identifier "studio.kx.carla.lv2" \
  435. --install-location "/Library/Audio/Plug-Ins/LV2/carla.lv2/" \
  436. --root "build/carla.lv2/" \
  437. "$@"
  438. build/carla-vst2fx.pkg: $(_CARLA_VST2FX_PLUGIN_FILES:%=build/%)
  439. pkgbuild \
  440. --identifier "studio.kx.carla.vst2fx" \
  441. --install-location "/Library/Audio/Plug-Ins/VST/carlafx.vst/" \
  442. --root "build/carlafx.vst/" \
  443. "$@"
  444. build/carla-vst2syn.pkg: $(_CARLA_VST2SYN_PLUGIN_FILES:%=build/%)
  445. pkgbuild \
  446. --identifier "studio.kx.carla.vst2syn" \
  447. --install-location "/Library/Audio/Plug-Ins/VST/carla.vst/" \
  448. --root "build/carla.vst/" \
  449. "$@"
  450. # ---------------------------------------------------------------------------------------------------------------------
  451. # macOS VST2 specific files
  452. _MACVST_FILES = Contents/Info.plist Contents/PkgInfo Contents/Resources/empty.lproj
  453. build/carla.vst/Contents/MacOS/CarlaVstShell: bin/CarlaVstShell.dylib $(_MACVST_FILES:%=build/carla.vst/%)
  454. -@mkdir -p $(shell dirname $@)
  455. @cp -v $< $@
  456. build/carlafx.vst/Contents/MacOS/CarlaVstFxShell: bin/CarlaVstFxShell.dylib $(_MACVST_FILES:%=build/carlafx.vst/%)
  457. -@mkdir -p $(shell dirname $@)
  458. @cp -v $< $@
  459. # ---------------------------------------------------------------------------------------------------------------------
  460. build/carla.vst/Contents/Info.plist: data/macos/CarlaVstShell.plist
  461. -@mkdir -p $(shell dirname $@)
  462. @cp -v $< $@
  463. build/carlafx.vst/Contents/Info.plist: data/macos/CarlaVstFxShell.plist
  464. -@mkdir -p $(shell dirname $@)
  465. @cp -v $< $@
  466. build/%.vst/Contents/PkgInfo:
  467. -@mkdir -p $(shell dirname $@)
  468. @echo "BNDL????" > $@
  469. build/%.vst/Contents/Resources/empty.lproj:
  470. -@mkdir -p $(shell dirname $@)
  471. @touch $@
  472. # ---------------------------------------------------------------------------------------------------------------------