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

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