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 23KB

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