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.

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