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.

368 lines
11KB

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