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.

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