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.

Makefile.dist.mk 21KB

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