Audio plugin host https://kx.studio/carla
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.

715 lines
21KB

  1. #!/usr/bin/make -f
  2. # Makefile for Carla C++ code #
  3. # --------------------------- #
  4. # Created by falkTX
  5. #
  6. # ---------------------------------------------------------------------------------------------------------------------
  7. # Base environment vars
  8. AR ?= ar
  9. CC ?= gcc
  10. CXX ?= g++
  11. # ---------------------------------------------------------------------------------------------------------------------
  12. # Auto-detect OS if not defined
  13. TARGET_MACHINE := $(shell $(CC) -dumpmachine)
  14. ifneq ($(BSD),true)
  15. ifneq ($(HAIKU),true)
  16. ifneq ($(HURD),true)
  17. ifneq ($(LINUX),true)
  18. ifneq ($(MACOS),true)
  19. ifneq ($(WASM),true)
  20. ifneq ($(WINDOWS),true)
  21. ifneq (,$(findstring bsd,$(TARGET_MACHINE)))
  22. BSD = true
  23. else ifneq (,$(findstring haiku,$(TARGET_MACHINE)))
  24. HAIKU = true
  25. else ifneq (,$(findstring linux,$(TARGET_MACHINE)))
  26. LINUX = true
  27. else ifneq (,$(findstring gnu,$(TARGET_MACHINE)))
  28. HURD = true
  29. else ifneq (,$(findstring apple,$(TARGET_MACHINE)))
  30. MACOS = true
  31. else ifneq (,$(findstring mingw,$(TARGET_MACHINE)))
  32. WINDOWS = true
  33. else ifneq (,$(findstring msys,$(TARGET_MACHINE)))
  34. WINDOWS = true
  35. else ifneq (,$(findstring wasm,$(TARGET_MACHINE)))
  36. WASM = true
  37. else ifneq (,$(findstring windows,$(TARGET_MACHINE)))
  38. WINDOWS = true
  39. endif
  40. endif # WINDOWS
  41. endif # WASM
  42. endif # MACOS
  43. endif # LINUX
  44. endif # HURD
  45. endif # HAIKU
  46. endif # BSD
  47. # ---------------------------------------------------------------------------------------------------------------------
  48. # Auto-detect the processor
  49. TARGET_PROCESSOR := $(firstword $(subst -, ,$(TARGET_MACHINE)))
  50. ifneq (,$(filter i%86,$(TARGET_PROCESSOR)))
  51. CPU_I386 = true
  52. CPU_I386_OR_X86_64 = true
  53. endif
  54. ifneq (,$(filter wasm32,$(TARGET_PROCESSOR)))
  55. CPU_I386 = true
  56. CPU_I386_OR_X86_64 = true
  57. endif
  58. ifneq (,$(filter x86_64,$(TARGET_PROCESSOR)))
  59. CPU_X86_64 = true
  60. CPU_I386_OR_X86_64 = true
  61. endif
  62. ifneq (,$(filter arm%,$(TARGET_PROCESSOR)))
  63. CPU_ARM = true
  64. CPU_ARM_OR_AARCH64 = true
  65. endif
  66. ifneq (,$(filter arm64%,$(TARGET_PROCESSOR)))
  67. CPU_ARM64 = true
  68. CPU_ARM_OR_AARCH64 = true
  69. endif
  70. ifneq (,$(filter aarch64%,$(TARGET_PROCESSOR)))
  71. CPU_AARCH64 = true
  72. CPU_ARM_OR_AARCH64 = true
  73. endif
  74. ifneq (,$(filter riscv64%,$(TARGET_PROCESSOR)))
  75. CPU_RISCV64 = true
  76. endif
  77. # ---------------------------------------------------------------------------------------------------------------------
  78. # Set PKG_CONFIG (can be overridden by environment variable)
  79. ifeq ($(WASM),true)
  80. # Skip on wasm by default
  81. PKG_CONFIG ?= false
  82. else ifeq ($(WINDOWS),true)
  83. # Build statically on Windows by default
  84. PKG_CONFIG ?= pkg-config --static
  85. else
  86. PKG_CONFIG ?= pkg-config
  87. endif
  88. # ---------------------------------------------------------------------------------------------------------------------
  89. # Set cross compiling flag
  90. ifeq ($(WASM),true)
  91. CROSS_COMPILING = true
  92. endif
  93. # ---------------------------------------------------------------------------------------------------------------------
  94. # Set LINUX_OR_MACOS
  95. ifeq ($(LINUX),true)
  96. LINUX_OR_MACOS = true
  97. endif
  98. ifeq ($(MACOS),true)
  99. LINUX_OR_MACOS = true
  100. endif
  101. # ---------------------------------------------------------------------------------------------------------------------
  102. # Set HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS, HAIKU_OR_MACOS_OR_WINDOWS, MACOS_OR_WASM_OR_WINDOWS and MACOS_OR_WINDOWS
  103. ifeq ($(HAIKU),true)
  104. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  105. HAIKU_OR_MACOS_OR_WINDOWS = true
  106. endif
  107. ifeq ($(MACOS),true)
  108. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  109. HAIKU_OR_MACOS_OR_WINDOWS = true
  110. MACOS_OR_WASM_OR_WINDOWS = true
  111. MACOS_OR_WINDOWS = true
  112. endif
  113. ifeq ($(WASM),true)
  114. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  115. MACOS_OR_WASM_OR_WINDOWS = true
  116. endif
  117. ifeq ($(WINDOWS),true)
  118. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  119. HAIKU_OR_MACOS_OR_WINDOWS = true
  120. MACOS_OR_WASM_OR_WINDOWS = true
  121. MACOS_OR_WINDOWS = true
  122. endif
  123. # ---------------------------------------------------------------------------------------------------------------------
  124. # Set UNIX
  125. ifeq ($(BSD),true)
  126. UNIX = true
  127. endif
  128. ifeq ($(HURD),true)
  129. UNIX = true
  130. endif
  131. ifeq ($(LINUX),true)
  132. UNIX = true
  133. endif
  134. ifeq ($(MACOS),true)
  135. UNIX = true
  136. endif
  137. # ---------------------------------------------------------------------------------------------------------------------
  138. # Check for optional libs (required by backend or bridges)
  139. ifeq ($(LINUX),true)
  140. HAVE_ALSA = $(shell $(PKG_CONFIG) --exists alsa && echo true)
  141. HAVE_HYLIA = true
  142. else ifeq ($(MACOS),true)
  143. HAVE_HYLIA = true
  144. else ifeq ($(WINDOWS),true)
  145. HAVE_HYLIA = true
  146. endif
  147. ifeq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  148. HAVE_DGL = true
  149. HAVE_YSFXGUI = true
  150. else
  151. HAVE_DBUS = $(shell $(PKG_CONFIG) --exists dbus-1 && echo true)
  152. HAVE_DGL = $(shell $(PKG_CONFIG) --exists gl x11 xcursor xext xrandr && echo true)
  153. HAVE_YSFXGUI = $(shell $(PKG_CONFIG) --exists freetype2 fontconfig gl x11 && echo true)
  154. HAVE_X11 = $(shell $(PKG_CONFIG) --exists x11 && echo true)
  155. HAVE_XCURSOR = $(shell $(PKG_CONFIG) --exists xcursor && echo true)
  156. HAVE_XEXT = $(shell $(PKG_CONFIG) --exists xext && echo true)
  157. HAVE_XRANDR = $(shell $(PKG_CONFIG) --exists xrandr && echo true)
  158. endif
  159. # FIXME update to DGL with wasm compat
  160. ifeq ($(WASM),true)
  161. HAVE_DGL = false
  162. endif
  163. # NOTE opt-out rather than opt-in
  164. HAVE_YSFX = true
  165. # NOTE not yet implemented, disabled for now
  166. HAVE_YSFXGUI = false
  167. ifeq ($(UNIX),true)
  168. ifneq ($(MACOS),true)
  169. HAVE_PULSEAUDIO = $(shell $(PKG_CONFIG) --exists libpulse-simple && echo true)
  170. endif
  171. endif
  172. # ffmpeg values taken from https://ffmpeg.org/download.html (v2.8.15 maximum)
  173. HAVE_FFMPEG = $(shell $(PKG_CONFIG) --max-version=56.60.100 libavcodec && \
  174. $(PKG_CONFIG) --max-version=56.40.101 libavformat && \
  175. $(PKG_CONFIG) --max-version=54.31.100 libavutil && echo true)
  176. HAVE_FLUIDSYNTH = $(shell $(PKG_CONFIG) --atleast-version=1.1.7 fluidsynth && echo true)
  177. HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true)
  178. HAVE_QT4 = $(shell $(PKG_CONFIG) --exists QtCore QtGui && echo true)
  179. HAVE_QT5 = $(shell $(PKG_CONFIG) --exists Qt5Core Qt5Gui Qt5Widgets && \
  180. $(PKG_CONFIG) --variable=qt_config Qt5Core | grep -q -v "static" && echo true)
  181. HAVE_QT5PKG = $(shell $(PKG_CONFIG) --silence-errors --variable=prefix Qt5OpenGLExtensions 1>/dev/null && echo true)
  182. HAVE_SNDFILE = $(shell $(PKG_CONFIG) --exists sndfile && echo true)
  183. ifeq ($(HAVE_FLUIDSYNTH),true)
  184. HAVE_FLUIDSYNTH_INSTPATCH = $(shell $(PKG_CONFIG) --atleast-version=2.1.0 fluidsynth && \
  185. $(PKG_CONFIG) --atleast-version=1.1.4 libinstpatch-1.0 && echo true)
  186. endif
  187. ifeq ($(JACKBRIDGE_DIRECT),true)
  188. HAVE_JACK = $(shell $(PKG_CONFIG) --exists jack && echo true)
  189. HAVE_JACKLIB = $(HAVE_JACK)
  190. else ifeq ($(WASM),true)
  191. HAVE_JACK = false
  192. HAVE_JACKLIB = false
  193. else
  194. HAVE_JACK = true
  195. HAVE_JACKLIB = false
  196. endif
  197. ifeq ($(LINUX),true)
  198. # juce only supports the most common architectures
  199. ifneq (,$(findstring arm,$(TARGET_MACHINE)))
  200. HAVE_JUCE_SUPPORTED_ARCH = true
  201. endif
  202. ifneq (,$(findstring aarch64,$(TARGET_MACHINE)))
  203. HAVE_JUCE_SUPPORTED_ARCH = true
  204. endif
  205. ifneq (,$(findstring i486,$(TARGET_MACHINE)))
  206. HAVE_JUCE_SUPPORTED_ARCH = true
  207. endif
  208. ifneq (,$(findstring i586,$(TARGET_MACHINE)))
  209. HAVE_JUCE_SUPPORTED_ARCH = true
  210. endif
  211. ifneq (,$(findstring i686,$(TARGET_MACHINE)))
  212. HAVE_JUCE_SUPPORTED_ARCH = true
  213. endif
  214. ifneq (,$(findstring x86_64,$(TARGET_MACHINE)))
  215. HAVE_JUCE_SUPPORTED_ARCH = true
  216. endif
  217. ifeq ($(HAVE_JUCE_SUPPORTED_ARCH),true)
  218. HAVE_JUCE_LINUX_DEPS = $(shell $(PKG_CONFIG) --exists x11 xcursor xext freetype2 && echo true)
  219. endif
  220. endif
  221. ifeq ($(WASM),true)
  222. HAVE_SDL1 = false
  223. HAVE_SDL2 = true
  224. else
  225. HAVE_SDL1 = $(shell $(PKG_CONFIG) --exists sdl && echo true)
  226. HAVE_SDL2 = $(shell $(PKG_CONFIG) --exists sdl2 && echo true)
  227. endif
  228. # ---------------------------------------------------------------------------------------------------------------------
  229. # Check for optional libs (special non-pkgconfig tests)
  230. ifneq ($(WASM),true)
  231. ifneq ($(WINDOWS),true)
  232. ifeq ($(shell $(PKG_CONFIG) --exists libmagic && echo true),true)
  233. HAVE_LIBMAGIC = true
  234. HAVE_LIBMAGICPKG = true
  235. else
  236. # old libmagic versions don't have a pkg-config file, so we need to call the compiler to test it
  237. CFLAGS_WITHOUT_ARCH = $(subst -arch arm64,,$(CFLAGS))
  238. HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS_WITHOUT_ARCH) -x c -w -c - -o /dev/null 2>/dev/null && echo true)
  239. endif
  240. endif
  241. endif
  242. # ---------------------------------------------------------------------------------------------------------------------
  243. # Set Qt tools
  244. ifeq ($(HAVE_QT4),true)
  245. MOC_QT4 ?= $(shell $(PKG_CONFIG) --variable=moc_location QtCore)
  246. RCC_QT4 ?= $(shell $(PKG_CONFIG) --variable=rcc_location QtCore)
  247. ifeq (,$(wildcard $(MOC_QT4)))
  248. HAVE_QT4 = false
  249. endif
  250. ifeq (,$(wildcard $(RCC_QT4)))
  251. HAVE_QT4 = false
  252. endif
  253. endif
  254. ifeq ($(HAVE_QT5),true)
  255. QT5_HOSTBINS = $(shell $(PKG_CONFIG) --variable=host_bins Qt5Core)
  256. else ifeq ($(HAVE_QT5PKG),true)
  257. QT5_HOSTBINS = $(shell $(PKG_CONFIG) --variable=prefix Qt5OpenGLExtensions)/bin
  258. endif
  259. MOC_QT5 ?= $(QT5_HOSTBINS)/moc
  260. RCC_QT5 ?= $(QT5_HOSTBINS)/rcc
  261. UIC_QT5 ?= $(QT5_HOSTBINS)/uic
  262. ifeq (,$(wildcard $(MOC_QT5)))
  263. HAVE_QT5 = false
  264. endif
  265. ifeq (,$(wildcard $(RCC_QT5)))
  266. HAVE_QT5 = false
  267. endif
  268. ifeq (,$(wildcard $(UIC_QT5)))
  269. HAVE_QT5 = false
  270. endif
  271. ifeq ($(HAVE_QT4),true)
  272. HAVE_QT = true
  273. else ifeq ($(HAVE_QT5),true)
  274. HAVE_QT = true
  275. # FIXME
  276. else ifeq ($(WINDOWS),true)
  277. HAVE_QT = true
  278. endif
  279. ifneq (,$(findstring true,$(HAVE_QT5)$(HAVE_QT5PKG)))
  280. HAVE_THEME = true
  281. endif
  282. # ---------------------------------------------------------------------------------------------------------------------
  283. # Set PyQt tools
  284. PYRCC5 ?= $(shell which pyrcc5 2>/dev/null)
  285. PYUIC5 ?= $(shell which pyuic5 2>/dev/null)
  286. ifneq ($(PYUIC5),)
  287. ifneq ($(PYRCC5),)
  288. HAVE_PYQT = true
  289. ifneq (,$(findstring true,$(HAVE_QT5)$(HAVE_QT5PKG)))
  290. HAVE_FRONTEND = true
  291. endif
  292. endif
  293. endif
  294. # ---------------------------------------------------------------------------------------------------------------------
  295. # Set PyQt tools, part2
  296. PYRCC ?= $(PYRCC5)
  297. PYUIC ?= $(PYUIC5)
  298. # ---------------------------------------------------------------------------------------------------------------------
  299. # Set USING_JUCE
  300. ifeq ($(MACOS_OR_WINDOWS),true)
  301. USING_JUCE = true
  302. USING_JUCE_AUDIO_DEVICES = true
  303. else ifeq ($(HAVE_JUCE_LINUX_DEPS),true)
  304. USING_JUCE = true
  305. endif
  306. # ---------------------------------------------------------------------------------------------------------------------
  307. # Set USING_RTAUDIO
  308. ifneq ($(HAIKU),true)
  309. ifneq ($(WASM),true)
  310. ifneq ($(USING_JUCE_AUDIO_DEVICES),true)
  311. USING_RTAUDIO = true
  312. endif
  313. endif
  314. endif
  315. # ---------------------------------------------------------------------------------------------------------------------
  316. # Disable features for static plugin target
  317. ifeq ($(STATIC_PLUGIN_TARGET),true)
  318. HAVE_ALSA = false
  319. HAVE_JACK = false
  320. HAVE_JACKLIB = false
  321. HAVE_FRONTEND = false
  322. HAVE_HYLIA = false
  323. HAVE_LIBLO = false
  324. HAVE_PULSEAUDIO = false
  325. HAVE_PYQT = false
  326. HAVE_QT4 = false
  327. HAVE_QT5 = false
  328. HAVE_QT5PKG = false
  329. HAVE_SDL = false
  330. HAVE_SDL1 = false
  331. HAVE_SDL2 = false
  332. USING_JUCE = false
  333. USING_JUCE_AUDIO_DEVICES = false
  334. USING_RTAUDIO = false
  335. endif
  336. # ---------------------------------------------------------------------------------------------------------------------
  337. # Set libs stuff (part 1)
  338. ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true)
  339. LIBDL_LIBS = -ldl
  340. endif
  341. ifeq ($(HAVE_LIBLO),true)
  342. LIBLO_FLAGS = $(shell $(PKG_CONFIG) --cflags liblo)
  343. LIBLO_LIBS = $(shell $(PKG_CONFIG) --libs liblo)
  344. endif
  345. ifeq ($(HAVE_FFMPEG),true)
  346. FFMPEG_FLAGS = $(shell $(PKG_CONFIG) --cflags libavcodec libavformat libavutil)
  347. FFMPEG_LIBS = $(shell $(PKG_CONFIG) --libs libavcodec libavformat libavutil)
  348. endif
  349. ifeq ($(HAVE_FLUIDSYNTH),true)
  350. FLUIDSYNTH_FLAGS = $(shell $(PKG_CONFIG) --cflags fluidsynth)
  351. FLUIDSYNTH_LIBS = $(shell $(PKG_CONFIG) --libs fluidsynth)
  352. endif
  353. ifeq ($(HAVE_JACKLIB),true)
  354. JACK_FLAGS = $(shell $(PKG_CONFIG) --cflags jack)
  355. JACK_LIBS = $(shell $(PKG_CONFIG) --libs jack)
  356. JACK_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir jack)/jack
  357. endif
  358. ifeq ($(HAVE_QT5),true)
  359. QT5_FLAGS = $(shell $(PKG_CONFIG) --cflags Qt5Core Qt5Gui Qt5Widgets)
  360. QT5_LIBS = $(shell $(PKG_CONFIG) --libs Qt5Core Qt5Gui Qt5Widgets)
  361. endif
  362. ifeq ($(WASM),true)
  363. HAVE_SDL = true
  364. SDL_FLAGS = -sUSE_SDL=2
  365. SDL_LIBS = -sUSE_SDL=2
  366. else ifeq ($(HAVE_SDL2),true)
  367. HAVE_SDL = true
  368. SDL_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags sdl2)
  369. SDL_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs sdl2)
  370. else ifeq ($(HAVE_SDL1),true)
  371. HAVE_SDL = true
  372. SDL_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags sdl)
  373. SDL_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs sdl)
  374. endif
  375. ifeq ($(HAVE_SNDFILE),true)
  376. SNDFILE_FLAGS = $(shell $(PKG_CONFIG) --cflags sndfile)
  377. SNDFILE_LIBS = $(shell $(PKG_CONFIG) --libs sndfile)
  378. endif
  379. # ifeq ($(HAVE_YSFXGUI),true)
  380. # ifeq ($(MACOS),true)
  381. # YSFX_LIBS = -framework Cocoa -framework Carbon -framework Metal -framework Foundation
  382. # else ifeq ($(WASM),true)
  383. # # TODO
  384. # YSFX_LIBS =
  385. # else
  386. # YSFX_FLAGS = $(shell $(PKG_CONFIG) --cflags freetype2 fontconfig)
  387. # YSFX_LIBS = $(shell $(PKG_CONFIG) --libs freetype2 fontconfig gl x11)
  388. # endif
  389. # endif
  390. ifeq ($(HAVE_X11),true)
  391. X11_FLAGS = $(shell $(PKG_CONFIG) --cflags x11)
  392. X11_LIBS = $(shell $(PKG_CONFIG) --libs x11)
  393. endif
  394. # ---------------------------------------------------------------------------------------------------------------------
  395. # Set libs stuff (dgl)
  396. ifeq ($(HAVE_DGL),true)
  397. DGL_FLAGS = -DHAVE_OPENGL -DDGL_OPENGL -DHAVE_DGL
  398. ifeq ($(HAIKU),true)
  399. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags gl)
  400. DGL_LIBS = $(shell $(PKG_CONFIG) --libs gl) -lbe
  401. else ifeq ($(MACOS),true)
  402. DGL_FLAGS += -DGL_SILENCE_DEPRECATION=1 -Wno-deprecated-declarations
  403. DGL_LIBS = -framework OpenGL -framework Cocoa -framework CoreVideo
  404. else ifeq ($(WASM),true)
  405. ifneq ($(USE_GLES2)$(USE_GLES3),true)
  406. DGL_LIBS = -sLEGACY_GL_EMULATION -sGL_UNSAFE_OPTS=0
  407. endif
  408. else ifeq ($(WINDOWS),true)
  409. DGL_LIBS = -lopengl32 -lgdi32
  410. else
  411. DGL_FLAGS += -DHAVE_X11 -DHAVE_XCURSOR -DHAVE_XEXT -DHAVE_XSYNC -DHAVE_XRANDR
  412. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags gl x11 xcursor xext xrandr)
  413. DGL_LIBS = $(shell $(PKG_CONFIG) --libs gl x11 xcursor xext xrandr)
  414. ifeq ($(HAVE_DBUS)$(STATIC_PLUGIN_TARGET)$(USING_CUSTOM_DPF),truetruetrue)
  415. DGL_FLAGS += -DHAVE_DBUS
  416. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags dbus-1)
  417. DGL_LIBS += $(shell $(PKG_CONFIG) --libs dbus-1)
  418. endif
  419. endif
  420. endif
  421. # ---------------------------------------------------------------------------------------------------------------------
  422. # Set libs stuff (libmagic)
  423. ifeq ($(HAVE_LIBMAGICPKG),true)
  424. MAGIC_FLAGS = $(shell $(PKG_CONFIG) --cflags libmagic)
  425. # this is missing in upstream pkg-config
  426. MAGIC_FLAGS += -I$(shell $(PKG_CONFIG) --variable=includedir libmagic)
  427. MAGIC_LIBS = $(shell $(PKG_CONFIG) --libs libmagic)
  428. else ifeq ($(HAVE_LIBMAGIC),true)
  429. MAGIC_LIBS += -lmagic
  430. ifeq ($(LINUX_OR_MACOS),true)
  431. MAGIC_LIBS += -lz
  432. endif
  433. endif
  434. # ---------------------------------------------------------------------------------------------------------------------
  435. # Set libs stuff (juce)
  436. ifeq ($(USING_JUCE),true)
  437. ifeq ($(LINUX),true)
  438. JUCE_AUDIO_BASICS_LIBS =
  439. JUCE_AUDIO_DEVICES_LIBS = $(shell $(PKG_CONFIG) --libs alsa)
  440. JUCE_AUDIO_FORMATS_LIBS =
  441. JUCE_AUDIO_PROCESSORS_LIBS =
  442. JUCE_CORE_LIBS = -ldl -pthread -lrt
  443. JUCE_EVENTS_LIBS =
  444. JUCE_GRAPHICS_LIBS = $(shell $(PKG_CONFIG) --libs freetype2)
  445. JUCE_GUI_BASICS_LIBS =
  446. JUCE_GUI_EXTRA_LIBS =
  447. else ifeq ($(MACOS),true)
  448. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  449. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  450. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  451. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa
  452. JUCE_CORE_LIBS = -framework AppKit
  453. JUCE_EVENTS_LIBS = -framework AppKit
  454. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  455. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  456. JUCE_GUI_EXTRA_LIBS = -framework IOKit
  457. else ifeq ($(WINDOWS),true)
  458. JUCE_AUDIO_BASICS_LIBS =
  459. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  460. JUCE_AUDIO_FORMATS_LIBS =
  461. JUCE_AUDIO_PROCESSORS_LIBS =
  462. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  463. JUCE_EVENTS_LIBS = -lole32
  464. JUCE_GRAPHICS_LIBS = -lgdi32
  465. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  466. JUCE_GUI_EXTRA_LIBS =
  467. endif
  468. endif
  469. # ---------------------------------------------------------------------------------------------------------------------
  470. # Set libs stuff (rtaudio)
  471. ifeq ($(USING_RTAUDIO),true)
  472. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY
  473. RTMIDI_FLAGS =
  474. ifeq ($(DEBUG),true)
  475. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  476. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  477. endif
  478. ifeq ($(HAVE_ALSA),true)
  479. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) --cflags alsa) -D__LINUX_ALSA__
  480. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) --libs alsa) -pthread
  481. RTMIDI_FLAGS += $(shell $(PKG_CONFIG) --cflags alsa) -D__LINUX_ALSA__
  482. RTMIDI_LIBS += $(shell $(PKG_CONFIG) --libs alsa)
  483. endif
  484. ifeq ($(HAVE_JACK),true)
  485. ifeq ($(UNIX),true)
  486. RTAUDIO_FLAGS += -D__UNIX_JACK__
  487. endif
  488. endif
  489. ifeq ($(HAVE_PULSEAUDIO),true)
  490. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) --cflags libpulse-simple) -D__UNIX_PULSE__
  491. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) --libs libpulse-simple)
  492. endif
  493. ifeq ($(MACOS),true)
  494. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  495. RTAUDIO_LIBS += -framework CoreAudio
  496. RTMIDI_FLAGS += -D__MACOSX_CORE__
  497. RTMIDI_LIBS += -framework CoreMIDI
  498. else ifeq ($(WINDOWS),true)
  499. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__ -D__WINDOWS_WASAPI__
  500. RTAUDIO_LIBS += -ldsound -luuid -lksuser
  501. RTMIDI_FLAGS += -D__WINDOWS_MM__
  502. RTMIDI_LIBS += -lwinmm
  503. endif
  504. endif
  505. # ---------------------------------------------------------------------------------------------------------------------
  506. # Set libs stuff (extra)
  507. ifeq ($(BSD),true)
  508. HYLIA_FLAGS =
  509. HYLIA_LIBS =
  510. JACKBRIDGE_LIBS = -pthread -lrt
  511. LILV_LIBS = -lm -lrt
  512. RTMEMPOOL_LIBS = -pthread
  513. WATER_LIBS = -pthread -lrt
  514. else ifeq ($(HAIKU),true)
  515. HYLIA_FLAGS =
  516. HYLIA_LIBS =
  517. JACKBRIDGE_LIBS = -lpthread
  518. LILV_LIBS = -lm
  519. RTMEMPOOL_LIBS = -lpthread
  520. WATER_LIBS = -lpthread
  521. else ifeq ($(HURD),true)
  522. HYLIA_FLAGS =
  523. HYLIA_LIBS =
  524. JACKBRIDGE_LIBS = -ldl -pthread -lrt
  525. LILV_LIBS = -ldl -lm -lrt
  526. RTMEMPOOL_LIBS = -pthread -lrt
  527. WATER_LIBS = -ldl -pthread -lrt
  528. else ifeq ($(LINUX),true)
  529. HYLIA_FLAGS = -DLINK_PLATFORM_LINUX=1
  530. HYLIA_LIBS =
  531. JACKBRIDGE_LIBS = -ldl -pthread -lrt
  532. LILV_LIBS = -ldl -lm -lrt
  533. RTMEMPOOL_LIBS = -pthread -lrt
  534. WATER_LIBS = -ldl -pthread -lrt
  535. else ifeq ($(MACOS),true)
  536. HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1
  537. HYLIA_LIBS =
  538. JACKBRIDGE_LIBS = -pthread
  539. LILV_LIBS = -lm
  540. RTMEMPOOL_LIBS = -pthread
  541. WATER_LIBS = -pthread -framework AppKit
  542. else ifeq ($(WASM),true)
  543. HYLIA_FLAGS =
  544. HYLIA_LIBS =
  545. JACKBRIDGE_LIBS =
  546. LILV_LIBS = -ldl -lm
  547. RTMEMPOOL_LIBS =
  548. WATER_LIBS =
  549. else ifeq ($(WINDOWS),true)
  550. HYLIA_FLAGS = -DLINK_PLATFORM_WINDOWS=1
  551. HYLIA_LIBS = -liphlpapi
  552. JACKBRIDGE_LIBS = -pthread
  553. LILV_LIBS = -lm
  554. RTMEMPOOL_LIBS = -pthread
  555. WATER_LIBS = -pthread -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  556. endif
  557. # ---------------------------------------------------------------------------------------------------------------------
  558. AUDIO_DECODER_LIBS = $(FFMPEG_LIBS)
  559. AUDIO_DECODER_LIBS += $(SNDFILE_LIBS)
  560. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  561. NATIVE_PLUGINS_LIBS += $(FFMPEG_LIBS)
  562. NATIVE_PLUGINS_LIBS += $(SNDFILE_LIBS)
  563. STATIC_CARLA_PLUGIN_LIBS = $(AUDIO_DECODER_LIBS)
  564. STATIC_CARLA_PLUGIN_LIBS += $(NATIVE_PLUGINS_LIBS)
  565. STATIC_CARLA_PLUGIN_LIBS += $(FLUIDSYNTH_LIBS)
  566. STATIC_CARLA_PLUGIN_LIBS += $(HYLIA_LIBS)
  567. STATIC_CARLA_PLUGIN_LIBS += $(LIBLO_LIBS)
  568. STATIC_CARLA_PLUGIN_LIBS += $(LILV_LIBS)
  569. STATIC_CARLA_PLUGIN_LIBS += $(MAGIC_LIBS)
  570. STATIC_CARLA_PLUGIN_LIBS += $(RTMEMPOOL_LIBS)
  571. STATIC_CARLA_PLUGIN_LIBS += $(WATER_LIBS)
  572. STATIC_CARLA_PLUGIN_LIBS += $(YSFX_LIBS)
  573. ifeq ($(USING_JUCE),true)
  574. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_AUDIO_BASICS_LIBS)
  575. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_AUDIO_FORMATS_LIBS)
  576. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_AUDIO_PROCESSORS_LIBS)
  577. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_CORE_LIBS)
  578. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_EVENTS_LIBS)
  579. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_GRAPHICS_LIBS)
  580. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_GUI_BASICS_LIBS)
  581. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_GUI_EXTRA_LIBS)
  582. endif
  583. ifeq ($(EXTERNAL_PLUGINS),true)
  584. ifneq ($(DEBUG),true)
  585. ifneq ($(TESTBUILD),true)
  586. ifeq ($(shell $(PKG_CONFIG) --exists liblo fftw3 mxml zlib && echo true),true)
  587. STATIC_CARLA_PLUGIN_LIBS += $(filter-out -lpthread,$(shell $(PKG_CONFIG) --libs liblo fftw3 mxml zlib))
  588. ifneq ($(WASM),true)
  589. STATIC_CARLA_PLUGIN_LIBS += -pthread
  590. endif
  591. endif
  592. endif
  593. endif
  594. endif
  595. # ---------------------------------------------------------------------------------------------------------------------