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.

Makefile.deps.mk 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  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 not yet implemented, disabled for now
  164. HAVE_YSFXGUI = false
  165. ifeq ($(UNIX),true)
  166. ifneq ($(MACOS),true)
  167. HAVE_PULSEAUDIO = $(shell $(PKG_CONFIG) --exists libpulse-simple && echo true)
  168. endif
  169. endif
  170. # ffmpeg values taken from https://ffmpeg.org/download.html (v2.8.15 maximum)
  171. HAVE_FFMPEG = $(shell $(PKG_CONFIG) --max-version=56.60.100 libavcodec && \
  172. $(PKG_CONFIG) --max-version=56.40.101 libavformat && \
  173. $(PKG_CONFIG) --max-version=54.31.100 libavutil && echo true)
  174. HAVE_FLUIDSYNTH = $(shell $(PKG_CONFIG) --atleast-version=1.1.7 fluidsynth && echo true)
  175. HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true)
  176. HAVE_QT4 = $(shell $(PKG_CONFIG) --exists QtCore QtGui && echo true)
  177. HAVE_QT5 = $(shell $(PKG_CONFIG) --exists Qt5Core Qt5Gui Qt5Widgets && \
  178. $(PKG_CONFIG) --variable=qt_config Qt5Core | grep -q -v "static" && echo true)
  179. HAVE_QT5PKG = $(shell $(PKG_CONFIG) --silence-errors --variable=prefix Qt5OpenGLExtensions 1>/dev/null && echo true)
  180. HAVE_SNDFILE = $(shell $(PKG_CONFIG) --exists sndfile && echo true)
  181. ifeq ($(HAVE_FLUIDSYNTH),true)
  182. HAVE_FLUIDSYNTH_INSTPATCH = $(shell $(PKG_CONFIG) --atleast-version=2.1.0 fluidsynth && \
  183. $(PKG_CONFIG) --atleast-version=1.1.4 libinstpatch-1.0 && echo true)
  184. endif
  185. ifeq ($(JACKBRIDGE_DIRECT),true)
  186. HAVE_JACK = $(shell $(PKG_CONFIG) --exists jack && echo true)
  187. HAVE_JACKLIB = $(HAVE_JACK)
  188. else ifeq ($(WASM),true)
  189. HAVE_JACK = false
  190. HAVE_JACKLIB = false
  191. else
  192. HAVE_JACK = true
  193. HAVE_JACKLIB = false
  194. endif
  195. ifeq ($(LINUX),true)
  196. # juce only supports the most common architectures
  197. ifneq (,$(findstring arm,$(TARGET_MACHINE)))
  198. HAVE_JUCE_SUPPORTED_ARCH = true
  199. endif
  200. ifneq (,$(findstring aarch64,$(TARGET_MACHINE)))
  201. HAVE_JUCE_SUPPORTED_ARCH = true
  202. endif
  203. ifneq (,$(findstring i486,$(TARGET_MACHINE)))
  204. HAVE_JUCE_SUPPORTED_ARCH = true
  205. endif
  206. ifneq (,$(findstring i586,$(TARGET_MACHINE)))
  207. HAVE_JUCE_SUPPORTED_ARCH = true
  208. endif
  209. ifneq (,$(findstring i686,$(TARGET_MACHINE)))
  210. HAVE_JUCE_SUPPORTED_ARCH = true
  211. endif
  212. ifneq (,$(findstring x86_64,$(TARGET_MACHINE)))
  213. HAVE_JUCE_SUPPORTED_ARCH = true
  214. endif
  215. ifeq ($(HAVE_JUCE_SUPPORTED_ARCH),true)
  216. HAVE_JUCE_LINUX_DEPS = $(shell $(PKG_CONFIG) --exists x11 xcursor xext freetype2 && echo true)
  217. endif
  218. endif
  219. ifeq ($(WASM),true)
  220. HAVE_SDL1 = false
  221. HAVE_SDL2 = true
  222. else
  223. HAVE_SDL1 = $(shell $(PKG_CONFIG) --exists sdl && echo true)
  224. HAVE_SDL2 = $(shell $(PKG_CONFIG) --exists sdl2 && echo true)
  225. endif
  226. # ---------------------------------------------------------------------------------------------------------------------
  227. # Check for optional libs (special non-pkgconfig tests)
  228. ifneq ($(WASM),true)
  229. ifneq ($(WINDOWS),true)
  230. ifeq ($(shell $(PKG_CONFIG) --exists libmagic && echo true),true)
  231. HAVE_LIBMAGIC = true
  232. HAVE_LIBMAGICPKG = true
  233. else
  234. # old libmagic versions don't have a pkg-config file, so we need to call the compiler to test it
  235. CFLAGS_WITHOUT_ARCH = $(subst -arch arm64,,$(CFLAGS))
  236. HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS_WITHOUT_ARCH) -x c -w -c - -o /dev/null 2>/dev/null && echo true)
  237. endif
  238. endif
  239. endif
  240. # ---------------------------------------------------------------------------------------------------------------------
  241. # Set Qt tools
  242. ifeq ($(HAVE_QT4),true)
  243. MOC_QT4 ?= $(shell $(PKG_CONFIG) --variable=moc_location QtCore)
  244. RCC_QT4 ?= $(shell $(PKG_CONFIG) --variable=rcc_location QtCore)
  245. ifeq (,$(wildcard $(MOC_QT4)))
  246. HAVE_QT4 = false
  247. endif
  248. ifeq (,$(wildcard $(RCC_QT4)))
  249. HAVE_QT4 = false
  250. endif
  251. endif
  252. ifeq ($(HAVE_QT5),true)
  253. QT5_HOSTBINS = $(shell $(PKG_CONFIG) --variable=host_bins Qt5Core)
  254. else ifeq ($(HAVE_QT5PKG),true)
  255. QT5_HOSTBINS = $(shell $(PKG_CONFIG) --variable=prefix Qt5OpenGLExtensions)/bin
  256. endif
  257. MOC_QT5 ?= $(QT5_HOSTBINS)/moc
  258. RCC_QT5 ?= $(QT5_HOSTBINS)/rcc
  259. UIC_QT5 ?= $(QT5_HOSTBINS)/uic
  260. ifeq (,$(wildcard $(MOC_QT5)))
  261. HAVE_QT5 = false
  262. endif
  263. ifeq (,$(wildcard $(RCC_QT5)))
  264. HAVE_QT5 = false
  265. endif
  266. ifeq (,$(wildcard $(UIC_QT5)))
  267. HAVE_QT5 = false
  268. endif
  269. ifeq ($(HAVE_QT4),true)
  270. HAVE_QT = true
  271. else ifeq ($(HAVE_QT5),true)
  272. HAVE_QT = true
  273. # FIXME
  274. else ifeq ($(WINDOWS),true)
  275. HAVE_QT = true
  276. endif
  277. ifneq (,$(findstring true,$(HAVE_QT5)$(HAVE_QT5PKG)))
  278. HAVE_THEME = true
  279. endif
  280. # ---------------------------------------------------------------------------------------------------------------------
  281. # Set PyQt tools
  282. PYRCC5 ?= $(shell which pyrcc5 2>/dev/null)
  283. PYUIC5 ?= $(shell which pyuic5 2>/dev/null)
  284. ifneq ($(PYUIC5),)
  285. ifneq ($(PYRCC5),)
  286. HAVE_PYQT = true
  287. ifneq (,$(findstring true,$(HAVE_QT5)$(HAVE_QT5PKG)))
  288. HAVE_FRONTEND = true
  289. endif
  290. endif
  291. endif
  292. # ---------------------------------------------------------------------------------------------------------------------
  293. # Set PyQt tools, part2
  294. PYRCC ?= $(PYRCC5)
  295. PYUIC ?= $(PYUIC5)
  296. # ---------------------------------------------------------------------------------------------------------------------
  297. # Set USING_JUCE
  298. ifeq ($(MACOS_OR_WINDOWS),true)
  299. USING_JUCE = true
  300. USING_JUCE_AUDIO_DEVICES = true
  301. else ifeq ($(HAVE_JUCE_LINUX_DEPS),true)
  302. USING_JUCE = true
  303. endif
  304. # ---------------------------------------------------------------------------------------------------------------------
  305. # Set USING_RTAUDIO
  306. ifneq ($(HAIKU),true)
  307. ifneq ($(WASM),true)
  308. ifneq ($(USING_JUCE_AUDIO_DEVICES),true)
  309. USING_RTAUDIO = true
  310. endif
  311. endif
  312. endif
  313. # ---------------------------------------------------------------------------------------------------------------------
  314. # Disable features for static plugin target
  315. ifeq ($(STATIC_PLUGIN_TARGET),true)
  316. HAVE_ALSA = false
  317. HAVE_JACK = false
  318. HAVE_JACKLIB = false
  319. HAVE_FRONTEND = false
  320. HAVE_HYLIA = false
  321. HAVE_LIBLO = false
  322. HAVE_PULSEAUDIO = false
  323. HAVE_PYQT = false
  324. HAVE_QT4 = false
  325. HAVE_QT5 = false
  326. HAVE_QT5PKG = false
  327. HAVE_SDL = false
  328. HAVE_SDL1 = false
  329. HAVE_SDL2 = false
  330. USING_JUCE = false
  331. USING_JUCE_AUDIO_DEVICES = false
  332. USING_RTAUDIO = false
  333. endif
  334. # ---------------------------------------------------------------------------------------------------------------------
  335. # Set libs stuff (part 1)
  336. ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true)
  337. LIBDL_LIBS = -ldl
  338. endif
  339. ifeq ($(HAVE_LIBLO),true)
  340. LIBLO_FLAGS = $(shell $(PKG_CONFIG) --cflags liblo)
  341. LIBLO_LIBS = $(shell $(PKG_CONFIG) --libs liblo)
  342. endif
  343. ifeq ($(HAVE_FFMPEG),true)
  344. FFMPEG_FLAGS = $(shell $(PKG_CONFIG) --cflags libavcodec libavformat libavutil)
  345. FFMPEG_LIBS = $(shell $(PKG_CONFIG) --libs libavcodec libavformat libavutil)
  346. endif
  347. ifeq ($(HAVE_FLUIDSYNTH),true)
  348. FLUIDSYNTH_FLAGS = $(shell $(PKG_CONFIG) --cflags fluidsynth)
  349. FLUIDSYNTH_LIBS = $(shell $(PKG_CONFIG) --libs fluidsynth)
  350. endif
  351. ifeq ($(HAVE_JACKLIB),true)
  352. JACK_FLAGS = $(shell $(PKG_CONFIG) --cflags jack)
  353. JACK_LIBS = $(shell $(PKG_CONFIG) --libs jack)
  354. JACK_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir jack)/jack
  355. endif
  356. ifeq ($(HAVE_QT5),true)
  357. QT5_FLAGS = $(shell $(PKG_CONFIG) --cflags Qt5Core Qt5Gui Qt5Widgets)
  358. QT5_LIBS = $(shell $(PKG_CONFIG) --libs Qt5Core Qt5Gui Qt5Widgets)
  359. endif
  360. ifeq ($(WASM),true)
  361. HAVE_SDL = true
  362. SDL_FLAGS = -sUSE_SDL=2
  363. SDL_LIBS = -sUSE_SDL=2
  364. else ifeq ($(HAVE_SDL2),true)
  365. HAVE_SDL = true
  366. SDL_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags sdl2)
  367. SDL_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs sdl2)
  368. else ifeq ($(HAVE_SDL1),true)
  369. HAVE_SDL = true
  370. SDL_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags sdl)
  371. SDL_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs sdl)
  372. endif
  373. ifeq ($(HAVE_SNDFILE),true)
  374. SNDFILE_FLAGS = $(shell $(PKG_CONFIG) --cflags sndfile)
  375. SNDFILE_LIBS = $(shell $(PKG_CONFIG) --libs sndfile)
  376. endif
  377. # ifeq ($(HAVE_YSFXGUI),true)
  378. # ifeq ($(MACOS),true)
  379. # YSFX_LIBS = -framework Cocoa -framework Carbon -framework Metal -framework Foundation
  380. # else ifeq ($(WASM),true)
  381. # # TODO
  382. # YSFX_LIBS =
  383. # else
  384. # YSFX_FLAGS = $(shell $(PKG_CONFIG) --cflags freetype2 fontconfig)
  385. # YSFX_LIBS = $(shell $(PKG_CONFIG) --libs freetype2 fontconfig gl x11)
  386. # endif
  387. # endif
  388. ifeq ($(HAVE_X11),true)
  389. X11_FLAGS = $(shell $(PKG_CONFIG) --cflags x11)
  390. X11_LIBS = $(shell $(PKG_CONFIG) --libs x11)
  391. endif
  392. # ---------------------------------------------------------------------------------------------------------------------
  393. # Set libs stuff (dgl)
  394. ifeq ($(HAVE_DGL),true)
  395. ifeq ($(HAIKU),true)
  396. DGL_FLAGS = $(shell $(PKG_CONFIG) --cflags gl)
  397. DGL_LIBS = $(shell $(PKG_CONFIG) --libs gl) -lbe
  398. else ifeq ($(MACOS),true)
  399. DGL_FLAGS = -DGL_SILENCE_DEPRECATION=1 -Wno-deprecated-declarations
  400. DGL_LIBS = -framework OpenGL -framework Cocoa -framework CoreVideo
  401. else ifeq ($(WASM),true)
  402. ifneq ($(USE_GLES2)$(USE_GLES3),true)
  403. DGL_LIBS = -sLEGACY_GL_EMULATION -sGL_UNSAFE_OPTS=0
  404. endif
  405. else ifeq ($(WINDOWS),true)
  406. DGL_LIBS = -lopengl32 -lgdi32
  407. else
  408. DGL_FLAGS = -DHAVE_XCURSOR -DHAVE_XEXT -DHAVE_XSYNC -DHAVE_XRANDR
  409. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags gl x11 xcursor xext xrandr)
  410. DGL_LIBS = $(shell $(PKG_CONFIG) --libs gl x11 xcursor xext xrandr)
  411. ifeq ($(HAVE_DBUS)$(STATIC_PLUGIN_TARGET)$(USING_CUSTOM_DPF),truetruetrue)
  412. DGL_FLAGS += -DHAVE_DBUS
  413. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags dbus-1)
  414. DGL_LIBS += $(shell $(PKG_CONFIG) --libs dbus-1)
  415. endif
  416. endif
  417. endif
  418. # ---------------------------------------------------------------------------------------------------------------------
  419. # Set libs stuff (libmagic)
  420. ifeq ($(HAVE_LIBMAGICPKG),true)
  421. MAGIC_FLAGS = $(shell $(PKG_CONFIG) --cflags libmagic)
  422. # this is missing in upstream pkg-config
  423. MAGIC_FLAGS += -I$(shell $(PKG_CONFIG) --variable=includedir libmagic)
  424. MAGIC_LIBS = $(shell $(PKG_CONFIG) --libs libmagic)
  425. else ifeq ($(HAVE_LIBMAGIC),true)
  426. MAGIC_LIBS += -lmagic
  427. ifeq ($(LINUX_OR_MACOS),true)
  428. MAGIC_LIBS += -lz
  429. endif
  430. endif
  431. # ---------------------------------------------------------------------------------------------------------------------
  432. # Set libs stuff (juce)
  433. ifeq ($(USING_JUCE),true)
  434. ifeq ($(LINUX),true)
  435. JUCE_AUDIO_BASICS_LIBS =
  436. JUCE_AUDIO_DEVICES_LIBS = $(shell $(PKG_CONFIG) --libs alsa)
  437. JUCE_AUDIO_FORMATS_LIBS =
  438. JUCE_AUDIO_PROCESSORS_LIBS =
  439. JUCE_CORE_LIBS = -ldl -pthread -lrt
  440. JUCE_EVENTS_LIBS =
  441. JUCE_GRAPHICS_LIBS = $(shell $(PKG_CONFIG) --libs freetype2)
  442. JUCE_GUI_BASICS_LIBS =
  443. JUCE_GUI_EXTRA_LIBS =
  444. else ifeq ($(MACOS),true)
  445. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  446. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  447. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  448. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa
  449. JUCE_CORE_LIBS = -framework AppKit
  450. JUCE_EVENTS_LIBS = -framework AppKit
  451. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  452. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  453. JUCE_GUI_EXTRA_LIBS = -framework IOKit
  454. else ifeq ($(WINDOWS),true)
  455. JUCE_AUDIO_BASICS_LIBS =
  456. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  457. JUCE_AUDIO_FORMATS_LIBS =
  458. JUCE_AUDIO_PROCESSORS_LIBS =
  459. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  460. JUCE_EVENTS_LIBS = -lole32
  461. JUCE_GRAPHICS_LIBS = -lgdi32
  462. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  463. JUCE_GUI_EXTRA_LIBS =
  464. endif
  465. endif
  466. # ---------------------------------------------------------------------------------------------------------------------
  467. # Set libs stuff (rtaudio)
  468. ifeq ($(USING_RTAUDIO),true)
  469. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY
  470. RTMIDI_FLAGS =
  471. ifeq ($(DEBUG),true)
  472. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  473. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  474. endif
  475. ifeq ($(HAVE_ALSA),true)
  476. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) --cflags alsa) -D__LINUX_ALSA__
  477. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) --libs alsa) -pthread
  478. RTMIDI_FLAGS += $(shell $(PKG_CONFIG) --cflags alsa) -D__LINUX_ALSA__
  479. RTMIDI_LIBS += $(shell $(PKG_CONFIG) --libs alsa)
  480. endif
  481. ifeq ($(HAVE_JACK),true)
  482. ifeq ($(UNIX),true)
  483. RTAUDIO_FLAGS += -D__UNIX_JACK__
  484. endif
  485. endif
  486. ifeq ($(HAVE_PULSEAUDIO),true)
  487. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) --cflags libpulse-simple) -D__UNIX_PULSE__
  488. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) --libs libpulse-simple)
  489. endif
  490. ifeq ($(MACOS),true)
  491. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  492. RTAUDIO_LIBS += -framework CoreAudio
  493. RTMIDI_FLAGS += -D__MACOSX_CORE__
  494. RTMIDI_LIBS += -framework CoreMIDI
  495. else ifeq ($(WINDOWS),true)
  496. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__ -D__WINDOWS_WASAPI__
  497. RTAUDIO_LIBS += -ldsound -luuid -lksuser
  498. RTMIDI_FLAGS += -D__WINDOWS_MM__
  499. RTMIDI_LIBS += -lwinmm
  500. endif
  501. endif
  502. # ---------------------------------------------------------------------------------------------------------------------
  503. # Set libs stuff (extra)
  504. ifeq ($(BSD),true)
  505. HYLIA_FLAGS =
  506. HYLIA_LIBS =
  507. JACKBRIDGE_LIBS = -pthread -lrt
  508. LILV_LIBS = -lm -lrt
  509. RTMEMPOOL_LIBS = -pthread
  510. WATER_LIBS = -pthread -lrt
  511. else ifeq ($(HAIKU),true)
  512. HYLIA_FLAGS =
  513. HYLIA_LIBS =
  514. JACKBRIDGE_LIBS = -lpthread
  515. LILV_LIBS = -lm
  516. RTMEMPOOL_LIBS = -lpthread
  517. WATER_LIBS = -lpthread
  518. else ifeq ($(HURD),true)
  519. HYLIA_FLAGS =
  520. HYLIA_LIBS =
  521. JACKBRIDGE_LIBS = -ldl -pthread -lrt
  522. LILV_LIBS = -ldl -lm -lrt
  523. RTMEMPOOL_LIBS = -pthread -lrt
  524. WATER_LIBS = -ldl -pthread -lrt
  525. else ifeq ($(LINUX),true)
  526. HYLIA_FLAGS = -DLINK_PLATFORM_LINUX=1
  527. HYLIA_LIBS =
  528. JACKBRIDGE_LIBS = -ldl -pthread -lrt
  529. LILV_LIBS = -ldl -lm -lrt
  530. RTMEMPOOL_LIBS = -pthread -lrt
  531. WATER_LIBS = -ldl -pthread -lrt
  532. else ifeq ($(MACOS),true)
  533. HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1
  534. HYLIA_LIBS =
  535. JACKBRIDGE_LIBS = -ldl -pthread
  536. LILV_LIBS = -ldl -lm
  537. RTMEMPOOL_LIBS = -pthread
  538. WATER_LIBS = -framework AppKit
  539. else ifeq ($(WASM),true)
  540. HYLIA_FLAGS =
  541. HYLIA_LIBS =
  542. JACKBRIDGE_LIBS =
  543. LILV_LIBS = -ldl -lm
  544. RTMEMPOOL_LIBS =
  545. WATER_LIBS =
  546. else ifeq ($(WINDOWS),true)
  547. HYLIA_FLAGS = -DLINK_PLATFORM_WINDOWS=1
  548. HYLIA_LIBS = -liphlpapi
  549. JACKBRIDGE_LIBS = -pthread
  550. LILV_LIBS = -lm
  551. RTMEMPOOL_LIBS = -pthread
  552. WATER_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  553. endif
  554. # ---------------------------------------------------------------------------------------------------------------------
  555. AUDIO_DECODER_LIBS = $(FFMPEG_LIBS)
  556. AUDIO_DECODER_LIBS += $(SNDFILE_LIBS)
  557. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  558. NATIVE_PLUGINS_LIBS += $(FFMPEG_LIBS)
  559. NATIVE_PLUGINS_LIBS += $(SNDFILE_LIBS)
  560. STATIC_CARLA_PLUGIN_LIBS = $(AUDIO_DECODER_LIBS)
  561. STATIC_CARLA_PLUGIN_LIBS += $(NATIVE_PLUGINS_LIBS)
  562. STATIC_CARLA_PLUGIN_LIBS += $(FLUIDSYNTH_LIBS)
  563. STATIC_CARLA_PLUGIN_LIBS += $(HYLIA_LIBS)
  564. STATIC_CARLA_PLUGIN_LIBS += $(LIBLO_LIBS)
  565. STATIC_CARLA_PLUGIN_LIBS += $(LILV_LIBS)
  566. STATIC_CARLA_PLUGIN_LIBS += $(MAGIC_LIBS)
  567. STATIC_CARLA_PLUGIN_LIBS += $(RTMEMPOOL_LIBS)
  568. STATIC_CARLA_PLUGIN_LIBS += $(WATER_LIBS)
  569. STATIC_CARLA_PLUGIN_LIBS += $(YSFX_LIBS)
  570. ifeq ($(USING_JUCE),true)
  571. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_AUDIO_BASICS_LIBS)
  572. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_AUDIO_FORMATS_LIBS)
  573. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_AUDIO_PROCESSORS_LIBS)
  574. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_CORE_LIBS)
  575. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_EVENTS_LIBS)
  576. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_GRAPHICS_LIBS)
  577. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_GUI_BASICS_LIBS)
  578. STATIC_CARLA_PLUGIN_LIBS += $(JUCE_GUI_EXTRA_LIBS)
  579. endif
  580. ifeq ($(EXTERNAL_PLUGINS),true)
  581. ifneq ($(DEBUG),true)
  582. ifneq ($(TESTBUILD),true)
  583. ifeq ($(shell $(PKG_CONFIG) --exists liblo fftw3 mxml zlib && echo true),true)
  584. STATIC_CARLA_PLUGIN_LIBS += $(filter-out -lpthread,$(shell $(PKG_CONFIG) --libs liblo fftw3 mxml zlib))
  585. ifneq ($(WASM),true)
  586. STATIC_CARLA_PLUGIN_LIBS += -pthread
  587. endif
  588. endif
  589. endif
  590. endif
  591. endif
  592. # ---------------------------------------------------------------------------------------------------------------------