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.

424 lines
12KB

  1. #!/usr/bin/make -f
  2. # Makefile for DISTRHO Plugins #
  3. # ---------------------------- #
  4. # Created by falkTX
  5. #
  6. # also set in:
  7. # src/CardinalCommon.cpp `CARDINAL_VERSION`
  8. # src/CardinalPlugin.cpp `getVersion`
  9. VERSION = 22.06
  10. # --------------------------------------------------------------
  11. # Import base definitions
  12. include dpf/Makefile.base.mk
  13. # --------------------------------------------------------------
  14. # Build targets
  15. all: cardinal carla deps dgl plugins gen resources
  16. # --------------------------------------------------------------
  17. # Build config
  18. PREFIX ?= /usr/local
  19. DESTDIR ?=
  20. ifeq ($(BSD),true)
  21. SYSDEPS ?= true
  22. else
  23. SYSDEPS ?= false
  24. endif
  25. ifeq ($(LINUX),true)
  26. VST3_SUPPORTED = true
  27. else ifeq ($(MACOS),true)
  28. VST3_SUPPORTED = true
  29. else ifeq ($(WINDOWS),true)
  30. VST3_SUPPORTED = true
  31. endif
  32. # --------------------------------------------------------------
  33. # Carla config
  34. CARLA_EXTRA_ARGS = \
  35. CARLA_BACKEND_NAMESPACE=Cardinal \
  36. DGL_NAMESPACE=CardinalDGL \
  37. HAVE_FFMPEG=false \
  38. HAVE_FLUIDSYNTH=false \
  39. HAVE_PROJECTM=false \
  40. HAVE_ZYN_DEPS=false \
  41. HAVE_ZYN_UI_DEPS=false
  42. ifneq ($(DEBUG),true)
  43. CARLA_EXTRA_ARGS += EXTERNAL_PLUGINS=true
  44. endif
  45. # --------------------------------------------------------------
  46. # DGL config
  47. DGL_EXTRA_ARGS = \
  48. DISTRHO_NAMESPACE=CardinalDISTRHO \
  49. DGL_NAMESPACE=CardinalDGL \
  50. NVG_DISABLE_SKIPPING_WHITESPACE=true \
  51. NVG_FONT_TEXTURE_FLAGS=NVG_IMAGE_NEAREST \
  52. USE_NANOVG_FBO=true \
  53. WASM_EXCEPTIONS=true \
  54. WINDOWS_ICON_ID=401
  55. # --------------------------------------------------------------
  56. # Check for required system-wide dependencies
  57. ifeq ($(SYSDEPS),true)
  58. ifneq ($(shell pkg-config --exists jansson && echo true),true)
  59. $(error jansson dependency not installed/available)
  60. endif
  61. ifneq ($(shell pkg-config --exists libarchive && echo true),true)
  62. $(error libarchive dependency not installed/available)
  63. endif
  64. ifneq ($(shell pkg-config --exists samplerate && echo true),true)
  65. $(error samplerate dependency not installed/available)
  66. endif
  67. ifneq ($(shell pkg-config --exists speexdsp && echo true),true)
  68. $(error speexdsp dependency not installed/available)
  69. endif
  70. endif
  71. ifeq ($(HEADLESS),true)
  72. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  73. $(error liblo dependency not installed/available)
  74. endif
  75. endif
  76. # --------------------------------------------------------------
  77. # Check for X11+OpenGL dependencies (unless headless build)
  78. ifneq ($(HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS),true)
  79. ifneq ($(HEADLESS),true)
  80. ifneq ($(HAVE_OPENGL),true)
  81. $(error OpenGL dependency not installed/available)
  82. endif
  83. ifneq ($(HAVE_X11),true)
  84. $(error X11 dependency not installed/available)
  85. endif
  86. ifneq ($(HAVE_XCURSOR),true)
  87. $(warning Xcursor dependency not installed/available)
  88. endif
  89. ifneq ($(HAVE_XEXT),true)
  90. $(warning Xext dependency not installed/available)
  91. endif
  92. ifneq ($(HAVE_XRANDR),true)
  93. $(warning Xrandr dependency not installed/available)
  94. endif
  95. else
  96. CARLA_EXTRA_ARGS += HAVE_OPENGL=false
  97. CARLA_EXTRA_ARGS += HAVE_X11=false
  98. CARLA_EXTRA_ARGS += HAVE_XCURSOR=false
  99. CARLA_EXTRA_ARGS += HAVE_XEXT=false
  100. CARLA_EXTRA_ARGS += HAVE_XRANDR=false
  101. endif
  102. endif
  103. # --------------------------------------------------------------
  104. # Check for optional system-wide dependencies
  105. ifeq ($(shell $(PKG_CONFIG) --exists fftw3f && echo true),true)
  106. HAVE_FFTW3F = true
  107. else
  108. $(warning fftw3f dependency not installed/available)
  109. endif
  110. # --------------------------------------------------------------
  111. # MOD builds
  112. EXTRA_MOD_FLAGS = -I../include/single-precision -fsingle-precision-constant
  113. ifeq ($(MODDUO),true)
  114. EXTRA_MOD_FLAGS += -mno-unaligned-access
  115. endif
  116. ifeq ($(WITH_LTO),true)
  117. EXTRA_MOD_FLAGS += -ffat-lto-objects
  118. endif
  119. MOD_WORKDIR ?= $(HOME)/mod-workdir
  120. MOD_ENVIRONMENT = \
  121. AR=${1}/host/usr/bin/${2}-gcc-ar \
  122. CC=${1}/host/usr/bin/${2}-gcc \
  123. CPP=${1}/host/usr/bin/${2}-cpp \
  124. CXX=${1}/host/usr/bin/${2}-g++ \
  125. LD=${1}/host/usr/bin/${2}-ld \
  126. PKG_CONFIG=${1}/host/usr/bin/pkg-config \
  127. STRIP=${1}/host/usr/bin/${2}-strip \
  128. CFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS)" \
  129. CPPFLAGS= \
  130. CXXFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS) -Wno-attributes" \
  131. LDFLAGS="-L${1}/staging/usr/lib $(EXTRA_MOD_FLAGS)" \
  132. EXE_WRAPPER="qemu-${3}-static -L ${1}/target" \
  133. HEADLESS=true \
  134. MOD_BUILD=true \
  135. NOOPT=true \
  136. STATIC_BUILD=true
  137. modduo:
  138. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduo-static,arm-mod-linux-gnueabihf.static,arm)
  139. modduox:
  140. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduox-static,aarch64-mod-linux-gnueabi.static,aarch64)
  141. moddwarf:
  142. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/moddwarf,aarch64-mod-linux-gnu,aarch64)
  143. publish:
  144. tar -C bin -cz $(subst bin/,,$(wildcard bin/*.lv2)) | base64 | curl -F 'package=@-' http://192.168.51.1/sdk/install && echo
  145. ifneq (,$(findstring modduo-,$(MAKECMDGOALS)))
  146. $(MAKECMDGOALS):
  147. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduo-static,arm-mod-linux-gnueabihf.static,arm) $(subst modduo-,,$(MAKECMDGOALS))
  148. endif
  149. ifneq (,$(findstring modduox-,$(MAKECMDGOALS)))
  150. $(MAKECMDGOALS):
  151. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduox-static,aarch64-mod-linux-gnueabi.static,aarch64) $(subst modduox-,,$(MAKECMDGOALS))
  152. endif
  153. ifneq (,$(findstring moddwarf-,$(MAKECMDGOALS)))
  154. $(MAKECMDGOALS):
  155. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/moddwarf,aarch64-mod-linux-gnu,aarch64) $(subst moddwarf-,,$(MAKECMDGOALS))
  156. endif
  157. # --------------------------------------------------------------
  158. # Individual targets
  159. cardinal: carla deps dgl plugins
  160. $(MAKE) all -C src $(CARLA_EXTRA_ARGS)
  161. carla:
  162. ifneq ($(STATIC_BUILD),true)
  163. $(MAKE) static-plugin -C carla $(CARLA_EXTRA_ARGS) \
  164. CAN_GENERATE_LV2_TTL=false \
  165. CUSTOM_DPF_PATH=$(CURDIR)/dpf \
  166. STATIC_PLUGIN_TARGET=true \
  167. USING_CUSTOM_DPF=true
  168. endif
  169. deps:
  170. ifeq ($(SYSDEPS),true)
  171. $(MAKE) quickjs -C deps
  172. else
  173. $(MAKE) all -C deps
  174. endif
  175. ifeq ($(HAVE_FFTW3F),true)
  176. $(MAKE) all -C deps/aubio
  177. endif
  178. dgl:
  179. ifneq ($(HEADLESS),true)
  180. $(MAKE) -C dpf/dgl opengl $(DGL_EXTRA_ARGS)
  181. endif
  182. plugins: deps
  183. $(MAKE) all -C plugins
  184. resources: cardinal
  185. $(MAKE) resources -C plugins
  186. ifneq ($(CROSS_COMPILING),true)
  187. gen: cardinal resources dpf/utils/lv2_ttl_generator
  188. @$(CURDIR)/dpf/utils/generate-ttl.sh
  189. dpf/utils/lv2_ttl_generator:
  190. $(MAKE) -C dpf/utils/lv2-ttl-generator
  191. else
  192. gen:
  193. endif
  194. # --------------------------------------------------------------
  195. # Packaging standalone for CI
  196. unzipfx: deps/unzipfx/unzipfx2cat$(APP_EXT) Cardinal.zip
  197. cat deps/unzipfx/unzipfx2cat$(APP_EXT) Cardinal.zip > Cardinal
  198. chmod +x Cardinal
  199. Cardinal.zip: bin/Cardinal bin/CardinalFX.lv2/resources
  200. mkdir -p build/unzipfx
  201. ln -sf ../../bin/Cardinal build/unzipfx/Cardinal
  202. ln -s ../../bin/CardinalFX.lv2/resources build/unzipfx/resources
  203. cd build/unzipfx && \
  204. zip -r -9 ../../Cardinal.zip Cardinal resources
  205. deps/unzipfx/unzipfx2cat:
  206. make -C deps/unzipfx -f Makefile.linux
  207. deps/unzipfx/unzipfx2cat.exe:
  208. make -C deps/unzipfx -f Makefile.win32
  209. # --------------------------------------------------------------
  210. # Clean step
  211. clean:
  212. $(MAKE) distclean -C carla $(CARLA_EXTRA_ARGS) CAN_GENERATE_LV2_TTL=false STATIC_PLUGIN_TARGET=true
  213. $(MAKE) clean -C deps
  214. $(MAKE) clean -C deps/aubio
  215. $(MAKE) clean -C dpf/dgl
  216. $(MAKE) clean -C dpf/utils/lv2-ttl-generator
  217. $(MAKE) clean -C plugins
  218. $(MAKE) clean -C src
  219. rm -rf bin build
  220. # --------------------------------------------------------------
  221. # Install step
  222. install:
  223. install -d $(DESTDIR)$(PREFIX)/bin
  224. install -d $(DESTDIR)$(PREFIX)/lib/lv2/Cardinal.lv2
  225. install -d $(DESTDIR)$(PREFIX)/lib/lv2/CardinalFX.lv2
  226. install -d $(DESTDIR)$(PREFIX)/lib/lv2/CardinalSynth.lv2
  227. install -d $(DESTDIR)$(PREFIX)/lib/vst/Cardinal.vst
  228. ifeq ($(VST3_SUPPORTED),true)
  229. install -d $(DESTDIR)$(PREFIX)/lib/vst3/Cardinal.vst3/Contents
  230. install -d $(DESTDIR)$(PREFIX)/lib/vst3/CardinalFX.vst3/Contents
  231. install -d $(DESTDIR)$(PREFIX)/lib/vst3/CardinalSynth.vst3/Contents
  232. endif
  233. install -d $(DESTDIR)$(PREFIX)/share/cardinal
  234. install -d $(DESTDIR)$(PREFIX)/share/doc/cardinal/docs
  235. install -m 644 bin/Cardinal.lv2/*.* $(DESTDIR)$(PREFIX)/lib/lv2/Cardinal.lv2/
  236. install -m 644 bin/CardinalFX.lv2/*.* $(DESTDIR)$(PREFIX)/lib/lv2/CardinalFX.lv2/
  237. install -m 644 bin/CardinalSynth.lv2/*.* $(DESTDIR)$(PREFIX)/lib/lv2/CardinalSynth.lv2/
  238. install -m 644 bin/Cardinal.vst/*.* $(DESTDIR)$(PREFIX)/lib/vst/Cardinal.vst/
  239. ifeq ($(VST3_SUPPORTED),true)
  240. cp -rL bin/Cardinal.vst3/Contents/*-* $(DESTDIR)$(PREFIX)/lib/vst3/Cardinal.vst3/Contents/
  241. cp -rL bin/CardinalFX.vst3/Contents/*-* $(DESTDIR)$(PREFIX)/lib/vst3/CardinalFX.vst3/Contents/
  242. cp -rL bin/CardinalSynth.vst3/Contents/*-* $(DESTDIR)$(PREFIX)/lib/vst3/CardinalSynth.vst3/Contents/
  243. endif
  244. install -m 755 bin/Cardinal$(APP_EXT) $(DESTDIR)$(PREFIX)/bin/
  245. cp -rL bin/Cardinal.lv2/resources/* $(DESTDIR)$(PREFIX)/share/cardinal/
  246. install -m 644 README.md $(DESTDIR)$(PREFIX)/share/doc/cardinal/
  247. install -m 644 docs/*.md docs/*.png $(DESTDIR)$(PREFIX)/share/doc/cardinal/docs/
  248. # --------------------------------------------------------------
  249. # Tarball step, for releases
  250. TAR_ARGS = \
  251. --exclude=".appveyor*" \
  252. --exclude=".ci*" \
  253. --exclude=".clang*" \
  254. --exclude=".drone*" \
  255. --exclude=".editor*" \
  256. --exclude=".git*" \
  257. --exclude="*.kdev*" \
  258. --exclude=".travis*" \
  259. --exclude=".vscode*" \
  260. --exclude="carla/source/modules/juce_*" \
  261. --exclude="carla/source/native-plugins/external/zynaddsubfx*" \
  262. --exclude="src/Rack/dep/osdialog/osdialog_*" \
  263. --exclude="src/Rack/icon.*" \
  264. --exclude=bin \
  265. --exclude=build \
  266. --exclude=jucewrapper \
  267. --exclude=lv2export \
  268. --exclude=carla/data \
  269. --exclude=carla/source/frontend \
  270. --exclude=carla/source/interposer \
  271. --exclude=carla/source/libjack \
  272. --exclude=carla/source/native-plugins/resources \
  273. --exclude=carla/source/rest \
  274. --exclude=carla/source/tests.old \
  275. --exclude=carla/source/theme \
  276. --exclude=carla/resources \
  277. --exclude=deps/PawPaw \
  278. --exclude=deps/sysroot \
  279. --exclude=deps/unzipfx \
  280. --exclude=docs/.generate-plugin-licenses.sh \
  281. --exclude=docs/MODDEVICES.md \
  282. --exclude=dpf/cmake \
  283. --exclude=dpf/examples \
  284. --exclude=dpf/lac \
  285. --exclude=dpf/tests \
  286. --exclude=plugins/.kdev_include_paths \
  287. --exclude=plugins/todo.txt \
  288. --exclude=plugins/AriaModules/res/Arcane \
  289. --exclude=plugins/AudibleInstruments/design \
  290. --exclude=plugins/BaconPlugs/res/midi/beeth \
  291. --exclude=plugins/BogaudioModules/res-pp \
  292. --exclude=plugins/BogaudioModules/res-src \
  293. --exclude=plugins/Cardinal/orig \
  294. --exclude=plugins/GrandeModular/res-src \
  295. --exclude=src/MOD \
  296. --exclude=src/Rack/adapters \
  297. --exclude=src/Rack/dep/filesystem/cmake \
  298. --exclude=src/Rack/dep/filesystem/examples \
  299. --exclude=src/Rack/dep/filesystem/test \
  300. --exclude=src/Rack/dep/glfw/CMake \
  301. --exclude=src/Rack/dep/glfw/deps \
  302. --exclude=src/Rack/dep/glfw/docs \
  303. --exclude=src/Rack/dep/glfw/examples \
  304. --exclude=src/Rack/dep/glfw/src \
  305. --exclude=src/Rack/dep/glfw/tests \
  306. --exclude=src/Rack/dep/nanosvg/example \
  307. --exclude=src/Rack/dep/nanovg \
  308. --exclude=src/Rack/dep/rtaudio \
  309. --exclude=src/Rack/include/audio.hpp \
  310. --exclude=src/Rack/include/midi.hpp \
  311. --exclude=src/Rack/include/engine/Port.hpp \
  312. --exclude=src/Rack/src/core \
  313. --exclude=src/Rack/src/asset.cpp \
  314. --exclude=src/Rack/src/audio.cpp \
  315. --exclude=src/Rack/src/common.cpp \
  316. --exclude=src/Rack/src/context.cpp \
  317. --exclude=src/Rack/src/dep.cpp \
  318. --exclude=src/Rack/src/discord.cpp \
  319. --exclude=src/Rack/src/gamepad.cpp \
  320. --exclude=src/Rack/src/keyboard.cpp \
  321. --exclude=src/Rack/src/library.cpp \
  322. --exclude=src/Rack/src/midi.cpp \
  323. --exclude=src/Rack/src/network.cpp \
  324. --exclude=src/Rack/src/plugin.cpp \
  325. --exclude=src/Rack/src/rtaudio.cpp \
  326. --exclude=src/Rack/src/rtmidi.cpp \
  327. --exclude=src/Rack/src/app/AudioDisplay.cpp \
  328. --exclude=src/Rack/src/app/MenuBar.cpp \
  329. --exclude=src/Rack/src/app/MidiDisplay.cpp \
  330. --exclude=src/Rack/src/app/Scene.cpp \
  331. --exclude=src/Rack/src/app/TipWindow.cpp \
  332. --exclude=src/Rack/src/engine/Engine.cpp \
  333. --exclude=src/Rack/src/plugin/Model.cpp \
  334. --exclude=src/Rack/src/window/Window.cpp \
  335. --exclude=src/Rack/res/Core \
  336. --exclude=src/Rack/res/icon.png \
  337. --transform='s,^\.\.,-.-.,' \
  338. --transform='s,^\.,cardinal-$(VERSION),' \
  339. --transform='s,^-\.-\.,..,' \
  340. download:
  341. $(MAKE) download -C deps
  342. tarball:
  343. $(MAKE) clean -C deps
  344. rm -f ../cardinal-$(VERSION).tar.xz
  345. tar -c --lzma $(TAR_ARGS) -f ../cardinal-$(VERSION).tar.xz .
  346. tarball+deps: download
  347. rm -f ../cardinal+deps-$(VERSION).tar.xz
  348. tar -c --lzma $(TAR_ARGS) -f ../cardinal+deps-$(VERSION).tar.xz .
  349. version:
  350. @echo $(VERSION)
  351. # --------------------------------------------------------------
  352. .PHONY: carla deps plugins