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.

526 lines
21KB

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