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. 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_WASM_OR_WINDOWS),true)
  78. ifneq ($(HEADLESS),true)
  79. ifneq ($(HAVE_OPENGL),true)
  80. $(error OpenGL dependency not installed/available)
  81. endif
  82. ifneq ($(HAVE_X11),true)
  83. $(error X11 dependency not installed/available)
  84. endif
  85. ifneq ($(HAVE_XCURSOR),true)
  86. $(warning Xcursor dependency not installed/available)
  87. endif
  88. ifneq ($(HAVE_XEXT),true)
  89. $(warning Xext dependency not installed/available)
  90. endif
  91. ifneq ($(HAVE_XRANDR),true)
  92. $(warning Xrandr dependency not installed/available)
  93. endif
  94. else
  95. CARLA_EXTRA_ARGS += HAVE_OPENGL=false
  96. CARLA_EXTRA_ARGS += HAVE_X11=false
  97. CARLA_EXTRA_ARGS += HAVE_XCURSOR=false
  98. CARLA_EXTRA_ARGS += HAVE_XEXT=false
  99. CARLA_EXTRA_ARGS += HAVE_XRANDR=false
  100. endif
  101. endif
  102. # --------------------------------------------------------------
  103. # Check for optional system-wide dependencies
  104. ifeq ($(shell $(PKG_CONFIG) --exists fftw3f && echo true),true)
  105. HAVE_FFTW3F = true
  106. else
  107. $(warning fftw3f dependency not installed/available)
  108. endif
  109. # --------------------------------------------------------------
  110. # MOD builds
  111. EXTRA_MOD_FLAGS = -I../include/single-precision -fsingle-precision-constant
  112. ifeq ($(MODDUO),true)
  113. EXTRA_MOD_FLAGS += -mno-unaligned-access
  114. endif
  115. ifeq ($(WITH_LTO),true)
  116. EXTRA_MOD_FLAGS += -ffat-lto-objects
  117. endif
  118. MOD_WORKDIR ?= $(HOME)/mod-workdir
  119. MOD_ENVIRONMENT = \
  120. AR=${1}/host/usr/bin/${2}-gcc-ar \
  121. CC=${1}/host/usr/bin/${2}-gcc \
  122. CPP=${1}/host/usr/bin/${2}-cpp \
  123. CXX=${1}/host/usr/bin/${2}-g++ \
  124. LD=${1}/host/usr/bin/${2}-ld \
  125. PKG_CONFIG=${1}/host/usr/bin/pkg-config \
  126. STRIP=${1}/host/usr/bin/${2}-strip \
  127. CFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS)" \
  128. CPPFLAGS= \
  129. CXXFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS) -Wno-attributes" \
  130. LDFLAGS="-L${1}/staging/usr/lib $(EXTRA_MOD_FLAGS)" \
  131. EXE_WRAPPER="qemu-${3}-static -L ${1}/target" \
  132. HEADLESS=true \
  133. MOD_BUILD=true \
  134. NOOPT=true \
  135. STATIC_BUILD=true
  136. modduo:
  137. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduo-static,arm-mod-linux-gnueabihf.static,arm)
  138. modduox:
  139. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduox-static,aarch64-mod-linux-gnueabi.static,aarch64)
  140. moddwarf:
  141. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/moddwarf,aarch64-mod-linux-gnu,aarch64)
  142. publish:
  143. tar -C bin -cz $(subst bin/,,$(wildcard bin/*.lv2)) | base64 | curl -F 'package=@-' http://192.168.51.1/sdk/install && echo
  144. ifneq (,$(findstring modduo-,$(MAKECMDGOALS)))
  145. $(MAKECMDGOALS):
  146. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduo-static,arm-mod-linux-gnueabihf.static,arm) $(subst modduo-,,$(MAKECMDGOALS))
  147. endif
  148. ifneq (,$(findstring modduox-,$(MAKECMDGOALS)))
  149. $(MAKECMDGOALS):
  150. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduox-static,aarch64-mod-linux-gnueabi.static,aarch64) $(subst modduox-,,$(MAKECMDGOALS))
  151. endif
  152. ifneq (,$(findstring moddwarf-,$(MAKECMDGOALS)))
  153. $(MAKECMDGOALS):
  154. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/moddwarf,aarch64-mod-linux-gnu,aarch64) $(subst moddwarf-,,$(MAKECMDGOALS))
  155. endif
  156. # --------------------------------------------------------------
  157. # Individual targets
  158. cardinal: carla deps dgl plugins
  159. $(MAKE) all -C src $(CARLA_EXTRA_ARGS)
  160. carla:
  161. ifneq ($(STATIC_BUILD),true)
  162. $(MAKE) static-plugin -C carla $(CARLA_EXTRA_ARGS) \
  163. CAN_GENERATE_LV2_TTL=false \
  164. CUSTOM_DPF_PATH=$(CURDIR)/dpf \
  165. STATIC_PLUGIN_TARGET=true \
  166. USING_CUSTOM_DPF=true
  167. endif
  168. deps:
  169. ifeq ($(SYSDEPS),true)
  170. $(MAKE) quickjs -C deps
  171. else
  172. $(MAKE) all -C deps
  173. endif
  174. ifeq ($(HAVE_FFTW3F),true)
  175. $(MAKE) all -C deps/aubio
  176. endif
  177. dgl:
  178. ifneq ($(HEADLESS),true)
  179. $(MAKE) -C dpf/dgl opengl $(DGL_EXTRA_ARGS)
  180. endif
  181. plugins: deps
  182. $(MAKE) all -C plugins
  183. resources: cardinal
  184. $(MAKE) resources -C plugins
  185. ifneq ($(CROSS_COMPILING),true)
  186. gen: cardinal resources dpf/utils/lv2_ttl_generator
  187. @$(CURDIR)/dpf/utils/generate-ttl.sh
  188. dpf/utils/lv2_ttl_generator:
  189. $(MAKE) -C dpf/utils/lv2-ttl-generator
  190. else
  191. gen:
  192. endif
  193. # --------------------------------------------------------------
  194. # Packaging standalone for CI
  195. unzipfx: deps/unzipfx/unzipfx2cat$(APP_EXT) Cardinal.zip
  196. cat deps/unzipfx/unzipfx2cat$(APP_EXT) Cardinal.zip > Cardinal
  197. chmod +x Cardinal
  198. Cardinal.zip: bin/Cardinal bin/CardinalFX.lv2/resources
  199. mkdir -p build/unzipfx
  200. ln -sf ../../bin/Cardinal build/unzipfx/Cardinal
  201. ln -s ../../bin/CardinalFX.lv2/resources build/unzipfx/resources
  202. cd build/unzipfx && \
  203. zip -r -9 ../../Cardinal.zip Cardinal resources
  204. deps/unzipfx/unzipfx2cat:
  205. make -C deps/unzipfx -f Makefile.linux
  206. deps/unzipfx/unzipfx2cat.exe:
  207. make -C deps/unzipfx -f Makefile.win32
  208. # --------------------------------------------------------------
  209. # Clean step
  210. clean:
  211. $(MAKE) distclean -C carla $(CARLA_EXTRA_ARGS) CAN_GENERATE_LV2_TTL=false STATIC_PLUGIN_TARGET=true
  212. $(MAKE) clean -C deps
  213. $(MAKE) clean -C deps/aubio
  214. $(MAKE) clean -C dpf/dgl
  215. $(MAKE) clean -C dpf/utils/lv2-ttl-generator
  216. $(MAKE) clean -C plugins
  217. $(MAKE) clean -C src
  218. rm -rf bin build
  219. # --------------------------------------------------------------
  220. # Install step
  221. install:
  222. install -d $(DESTDIR)$(PREFIX)/bin
  223. install -d $(DESTDIR)$(PREFIX)/lib/lv2/Cardinal.lv2
  224. install -d $(DESTDIR)$(PREFIX)/lib/lv2/CardinalFX.lv2
  225. install -d $(DESTDIR)$(PREFIX)/lib/lv2/CardinalSynth.lv2
  226. install -d $(DESTDIR)$(PREFIX)/lib/vst/Cardinal.vst
  227. ifeq ($(VST3_SUPPORTED),true)
  228. install -d $(DESTDIR)$(PREFIX)/lib/vst3/Cardinal.vst3/Contents
  229. install -d $(DESTDIR)$(PREFIX)/lib/vst3/CardinalFX.vst3/Contents
  230. install -d $(DESTDIR)$(PREFIX)/lib/vst3/CardinalSynth.vst3/Contents
  231. endif
  232. install -d $(DESTDIR)$(PREFIX)/share/cardinal
  233. install -d $(DESTDIR)$(PREFIX)/share/doc/cardinal/docs
  234. install -m 644 bin/Cardinal.lv2/*.* $(DESTDIR)$(PREFIX)/lib/lv2/Cardinal.lv2/
  235. install -m 644 bin/CardinalFX.lv2/*.* $(DESTDIR)$(PREFIX)/lib/lv2/CardinalFX.lv2/
  236. install -m 644 bin/CardinalSynth.lv2/*.* $(DESTDIR)$(PREFIX)/lib/lv2/CardinalSynth.lv2/
  237. install -m 644 bin/Cardinal.vst/*.* $(DESTDIR)$(PREFIX)/lib/vst/Cardinal.vst/
  238. ifeq ($(VST3_SUPPORTED),true)
  239. cp -rL bin/Cardinal.vst3/Contents/*-* $(DESTDIR)$(PREFIX)/lib/vst3/Cardinal.vst3/Contents/
  240. cp -rL bin/CardinalFX.vst3/Contents/*-* $(DESTDIR)$(PREFIX)/lib/vst3/CardinalFX.vst3/Contents/
  241. cp -rL bin/CardinalSynth.vst3/Contents/*-* $(DESTDIR)$(PREFIX)/lib/vst3/CardinalSynth.vst3/Contents/
  242. endif
  243. install -m 755 bin/Cardinal$(APP_EXT) $(DESTDIR)$(PREFIX)/bin/
  244. cp -rL bin/Cardinal.lv2/resources/* $(DESTDIR)$(PREFIX)/share/cardinal/
  245. install -m 644 README.md $(DESTDIR)$(PREFIX)/share/doc/cardinal/
  246. install -m 644 docs/*.md docs/*.png $(DESTDIR)$(PREFIX)/share/doc/cardinal/docs/
  247. # --------------------------------------------------------------
  248. # Tarball step, for releases
  249. TAR_ARGS = \
  250. --exclude=".appveyor*" \
  251. --exclude=".ci*" \
  252. --exclude=".clang*" \
  253. --exclude=".drone*" \
  254. --exclude=".editor*" \
  255. --exclude=".git*" \
  256. --exclude="*.kdev*" \
  257. --exclude=".travis*" \
  258. --exclude=".vscode*" \
  259. --exclude="carla/source/modules/juce_*" \
  260. --exclude="carla/source/native-plugins/external/zynaddsubfx*" \
  261. --exclude="src/Rack/dep/osdialog/osdialog_*" \
  262. --exclude="src/Rack/icon.*" \
  263. --exclude=bin \
  264. --exclude=build \
  265. --exclude=jucewrapper \
  266. --exclude=lv2export \
  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