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.

681 lines
19KB

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