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.

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