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.

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