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.

550 lines
22KB

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