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.

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