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.

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