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.

686 lines
20KB

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