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.

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