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.

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