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.

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