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.

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