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.

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