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

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