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.

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