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.

702 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. PKG_CONFIG ?= pkg-config
  12. WINECC ?= winegcc
  13. # ---------------------------------------------------------------------------------------------------------------------
  14. # Auto-detect OS if not defined
  15. ifneq ($(BSD),true)
  16. ifneq ($(HAIKU),true)
  17. ifneq ($(HURD),true)
  18. ifneq ($(LINUX),true)
  19. ifneq ($(MACOS),true)
  20. ifneq ($(WIN32),true)
  21. TARGET_MACHINE := $(shell $(CC) -dumpmachine)
  22. ifneq (,$(findstring bsd,$(TARGET_MACHINE)))
  23. BSD=true
  24. endif
  25. ifneq (,$(findstring haiku,$(TARGET_MACHINE)))
  26. HAIKU=true
  27. endif
  28. ifneq (,$(findstring gnu,$(TARGET_MACHINE)))
  29. HURD=true
  30. endif
  31. ifneq (,$(findstring linux,$(TARGET_MACHINE)))
  32. LINUX=true
  33. endif
  34. ifneq (,$(findstring apple,$(TARGET_MACHINE)))
  35. MACOS=true
  36. endif
  37. ifneq (,$(findstring mingw,$(TARGET_MACHINE)))
  38. WIN32=true
  39. endif
  40. endif # WIN32
  41. endif # MACOS
  42. endif # LINUX
  43. endif # HURD
  44. endif # HAIKU
  45. endif # BSD
  46. # ---------------------------------------------------------------------------------------------------------------------
  47. # Set LINUX_OR_MACOS
  48. ifeq ($(LINUX),true)
  49. LINUX_OR_MACOS=true
  50. endif
  51. ifeq ($(MACOS),true)
  52. LINUX_OR_MACOS=true
  53. endif
  54. # ---------------------------------------------------------------------------------------------------------------------
  55. # Set MACOS_OR_WIN32
  56. ifeq ($(MACOS),true)
  57. MACOS_OR_WIN32=true
  58. endif
  59. ifeq ($(WIN32),true)
  60. MACOS_OR_WIN32=true
  61. endif
  62. # ---------------------------------------------------------------------------------------------------------------------
  63. # Set UNIX
  64. ifeq ($(BSD),true)
  65. UNIX=true
  66. endif
  67. ifeq ($(HURD),true)
  68. UNIX=true
  69. endif
  70. ifeq ($(LINUX),true)
  71. UNIX=true
  72. endif
  73. ifeq ($(MACOS),true)
  74. UNIX=true
  75. endif
  76. # ---------------------------------------------------------------------------------------------------------------------
  77. # Set build and link flags
  78. BASE_FLAGS = -Wall -Wextra -pipe -DBUILDING_CARLA -DREAL_BUILD -MD -MP -fno-common
  79. BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
  80. ifeq ($(MACOS),true)
  81. # MacOS linker flags
  82. BASE_FLAGS += -Wno-deprecated-declarations
  83. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
  84. else
  85. # Common linker flags
  86. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed
  87. ifneq ($(SKIP_STRIPPING),true)
  88. LINK_OPTS += -Wl,--strip-all
  89. endif
  90. endif
  91. ifeq ($(NOOPT),true)
  92. # No CPU-specific optimization flags
  93. BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections -DBUILDING_CARLA_NOOPT
  94. endif
  95. ifeq ($(WIN32),true)
  96. # mingw has issues with this specific optimization
  97. # See https://github.com/falkTX/Carla/issues/696
  98. BASE_OPTS += -fno-rerun-cse-after-loop
  99. # See https://github.com/falkTX/Carla/issues/855
  100. BASE_OPTS += -mstackrealign
  101. ifeq ($(BUILDING_FOR_WINDOWS),true)
  102. BASE_FLAGS += -DBUILDING_CARLA_FOR_WINDOWS
  103. endif
  104. else
  105. # Not needed for Windows
  106. BASE_FLAGS += -fPIC -DPIC
  107. endif
  108. ifeq ($(CLANG),true)
  109. BASE_FLAGS += -Wabsolute-value
  110. endif
  111. ifeq ($(DEBUG),true)
  112. BASE_FLAGS += -DDEBUG -O0 -g
  113. LINK_OPTS =
  114. else
  115. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  116. CXXFLAGS += -fvisibility-inlines-hidden
  117. endif
  118. 32BIT_FLAGS = -m32
  119. 64BIT_FLAGS = -m64
  120. ARM32_FLAGS = -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mvectorize-with-neon-quad
  121. BUILD_C_FLAGS = $(BASE_FLAGS) -std=gnu99 $(CFLAGS)
  122. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=gnu++0x $(CXXFLAGS)
  123. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  124. ifneq ($(MACOS),true)
  125. # Not available on MacOS
  126. LINK_FLAGS += -Wl,--no-undefined
  127. endif
  128. ifeq ($(MACOS_OLD),true)
  129. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) -DHAVE_CPP11_SUPPORT=0
  130. endif
  131. ifeq ($(WIN32),true)
  132. # Always build statically on windows
  133. LINK_FLAGS += -static
  134. endif
  135. # ---------------------------------------------------------------------------------------------------------------------
  136. # Strict test build
  137. ifeq ($(TESTBUILD),true)
  138. BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wdisabled-optimization
  139. BASE_FLAGS += -Wdouble-promotion -Wfloat-equal -Wpointer-arith -Wsign-conversion
  140. BASE_FLAGS += -Wformat=2 -Woverlength-strings
  141. BASE_FLAGS += -Wmissing-declarations -Wredundant-decls
  142. BASE_FLAGS += -Wshadow -Wundef -Wuninitialized -Wunused
  143. BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing
  144. BASE_FLAGS += -Wstrict-overflow -fstrict-overflow
  145. BASE_FLAGS += -Wnull-dereference
  146. ifneq ($(CLANG),true)
  147. BASE_FLAGS += -Wabi=98 -Wclobbered -Wlogical-op
  148. BASE_FLAGS += -Wformat-truncation=2 -Wformat-overflow=2
  149. BASE_FLAGS += -Wstringop-overflow=4 -Wstringop-truncation
  150. BASE_FLAGS += -Wduplicated-branches -Wduplicated-cond
  151. endif
  152. CFLAGS += -Winit-self -Wmissing-prototypes -Wnested-externs -Wstrict-prototypes -Wwrite-strings
  153. ifneq ($(CLANG),true)
  154. CFLAGS += -Wjump-misses-init
  155. endif
  156. CXXFLAGS += -Wc++0x-compat -Wc++11-compat
  157. CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual
  158. # CXXFLAGS += -Wold-style-cast -Wuseless-cast
  159. CXXFLAGS += -Wzero-as-null-pointer-constant
  160. ifneq ($(DEBUG),true)
  161. CXXFLAGS += -Weffc++
  162. endif
  163. ifeq ($(LINUX),true)
  164. BASE_FLAGS += -isystem /opt/kxstudio/include
  165. endif
  166. ifeq ($(MACOS),true)
  167. CXXFLAGS += -isystem /System/Library/Frameworks
  168. endif
  169. ifeq ($(WIN32),true)
  170. BASE_FLAGS += -isystem /opt/mingw32/include
  171. endif
  172. ifeq ($(WIN64),true)
  173. BASE_FLAGS += -isystem /opt/mingw64/include
  174. endif
  175. # TODO
  176. ifeq ($(CLANG),true)
  177. BASE_FLAGS += -Wno-double-promotion
  178. BASE_FLAGS += -Wno-format-nonliteral
  179. BASE_FLAGS += -Wno-tautological-pointer-compare
  180. endif
  181. endif
  182. # ---------------------------------------------------------------------------------------------------------------------
  183. # Check for optional libs (required by backend or bridges)
  184. ifeq ($(LINUX),true)
  185. HAVE_ALSA = $(shell $(PKG_CONFIG) --exists alsa && echo true)
  186. HAVE_HYLIA = true
  187. endif
  188. ifeq ($(MACOS),true)
  189. ifneq ($(MACOS_OLD),true)
  190. HAVE_HYLIA = true
  191. endif
  192. endif
  193. ifeq ($(WIN32),true)
  194. HAVE_HYLIA = true
  195. endif
  196. ifeq ($(MACOS_OR_WIN32),true)
  197. HAVE_DGL = true
  198. else
  199. HAVE_DGL = $(shell $(PKG_CONFIG) --exists gl x11 && echo true)
  200. HAVE_GTK2 = $(shell $(PKG_CONFIG) --exists gtk+-2.0 && echo true)
  201. HAVE_GTK3 = $(shell $(PKG_CONFIG) --exists gtk+-3.0 && echo true)
  202. HAVE_X11 = $(shell $(PKG_CONFIG) --exists x11 && echo true)
  203. endif
  204. ifeq ($(UNIX),true)
  205. ifneq ($(MACOS),true)
  206. HAVE_PULSEAUDIO = $(shell $(PKG_CONFIG) --exists libpulse-simple && echo true)
  207. endif
  208. endif
  209. # ffmpeg values taken from https://ffmpeg.org/download.html (v2.8.15 maximum)
  210. HAVE_FFMPEG = $(shell $(PKG_CONFIG) --max-version=56.60.100 libavcodec && \
  211. $(PKG_CONFIG) --max-version=56.40.101 libavformat && \
  212. $(PKG_CONFIG) --max-version=54.31.100 libavutil && echo true)
  213. HAVE_FLUIDSYNTH = $(shell $(PKG_CONFIG) --atleast-version=1.1.7 fluidsynth && echo true)
  214. HAVE_JACK = $(shell $(PKG_CONFIG) --exists jack && echo true)
  215. HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true)
  216. HAVE_QT4 = $(shell $(PKG_CONFIG) --exists QtCore QtGui && echo true)
  217. HAVE_QT5 = $(shell $(PKG_CONFIG) --exists Qt5Core Qt5Gui Qt5Widgets && \
  218. $(PKG_CONFIG) --variable=qt_config Qt5Core | grep -q -v "static" && echo true)
  219. HAVE_SNDFILE = $(shell $(PKG_CONFIG) --exists sndfile && echo true)
  220. ifeq ($(HAVE_FLUIDSYNTH),true)
  221. HAVE_FLUIDSYNTH_INSTPATCH = $(shell $(PKG_CONFIG) --atleast-version=2.1.0 fluidsynth && \
  222. $(PKG_CONFIG) --atleast-version=1.1.4 libinstpatch-1.0 && echo true)
  223. endif
  224. ifeq ($(LINUX),true)
  225. # juce only supports the most common architectures
  226. ifneq (,$(findstring arm,$(TARGET_MACHINE)))
  227. HACE_JUCE_SUPPORTED_ARCH = true
  228. endif
  229. ifneq (,$(findstring aarch64,$(TARGET_MACHINE)))
  230. HACE_JUCE_SUPPORTED_ARCH = true
  231. endif
  232. ifneq (,$(findstring i686,$(TARGET_MACHINE)))
  233. HACE_JUCE_SUPPORTED_ARCH = true
  234. endif
  235. ifneq (,$(findstring x86_64,$(TARGET_MACHINE)))
  236. HACE_JUCE_SUPPORTED_ARCH = true
  237. endif
  238. ifeq ($(HACE_JUCE_SUPPORTED_ARCH),true)
  239. HAVE_JUCE_LINUX_DEPS = $(shell $(PKG_CONFIG) --exists x11 xcursor xext freetype2 && echo true)
  240. endif
  241. endif
  242. # ---------------------------------------------------------------------------------------------------------------------
  243. # Check for optional libs (special non-pkgconfig tests)
  244. ifneq ($(WIN32),true)
  245. # libmagic doesn't have a pkg-config file, so we need to call the compiler to test it
  246. HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS) -x c -w -c - -o .libmagic-tmp 2>/dev/null && echo true)
  247. endif
  248. # ---------------------------------------------------------------------------------------------------------------------
  249. # Set Qt tools
  250. ifeq ($(HAVE_QT4),true)
  251. MOC_QT4 ?= $(shell $(PKG_CONFIG) --variable=moc_location QtCore)
  252. RCC_QT4 ?= $(shell $(PKG_CONFIG) --variable=rcc_location QtCore)
  253. UIC_QT4 ?= $(shell $(PKG_CONFIG) --variable=uic_location QtCore)
  254. ifeq (,$(wildcard $(MOC_QT4)))
  255. HAVE_QT4=false
  256. endif
  257. ifeq (,$(wildcard $(RCC_QT4)))
  258. HAVE_QT4=false
  259. endif
  260. endif
  261. ifeq ($(HAVE_QT5),true)
  262. QT5_HOSTBINS = $(shell $(PKG_CONFIG) --variable=host_bins Qt5Core)
  263. MOC_QT5 ?= $(QT5_HOSTBINS)/moc
  264. RCC_QT5 ?= $(QT5_HOSTBINS)/rcc
  265. UIC_QT5 ?= $(QT5_HOSTBINS)/uic
  266. ifeq (,$(wildcard $(MOC_QT5)))
  267. HAVE_QT5=false
  268. endif
  269. ifeq (,$(wildcard $(RCC_QT5)))
  270. HAVE_QT5=false
  271. endif
  272. endif
  273. ifeq ($(HAVE_QT4),true)
  274. HAVE_QT=true
  275. endif
  276. ifeq ($(HAVE_QT5),true)
  277. HAVE_QT=true
  278. endif
  279. ifeq ($(WIN32),true)
  280. HAVE_QT=true
  281. endif
  282. # ---------------------------------------------------------------------------------------------------------------------
  283. # Set PyQt tools
  284. PYRCC5 ?= $(shell which pyrcc5 2>/dev/null)
  285. PYUIC5 ?= $(shell which pyuic5 2>/dev/null)
  286. ifneq ($(PYUIC5),)
  287. ifneq ($(PYRCC5),)
  288. HAVE_PYQT = true
  289. endif
  290. endif
  291. # ---------------------------------------------------------------------------------------------------------------------
  292. # Set PyQt tools, part2
  293. PYRCC ?= $(PYRCC5)
  294. PYUIC ?= $(PYUIC5)
  295. ifeq ($(HAVE_QT5),true)
  296. HAVE_THEME = true
  297. else
  298. ifeq ($(MACOS),true)
  299. ifeq ($(HAVE_PYQT),true)
  300. HAVE_THEME = true
  301. endif
  302. endif
  303. endif
  304. # ---------------------------------------------------------------------------------------------------------------------
  305. # Set USING_JUCE
  306. ifeq ($(MACOS_OR_WIN32),true)
  307. ifneq ($(MACOS_OLD),true)
  308. USING_JUCE = true
  309. USING_JUCE_AUDIO_DEVICES = true
  310. endif
  311. endif
  312. ifeq ($(HAVE_JUCE_LINUX_DEPS),true)
  313. USING_JUCE = true
  314. endif
  315. ifeq ($(USING_JUCE),true)
  316. ifeq ($(LINUX_OR_MACOS),true)
  317. USING_JUCE_GUI_EXTRA = true
  318. endif
  319. endif
  320. # ---------------------------------------------------------------------------------------------------------------------
  321. # Set base defines
  322. ifeq ($(JACKBRIDGE_DIRECT),true)
  323. ifeq ($(HAVE_JACK),true)
  324. BASE_FLAGS += -DJACKBRIDGE_DIRECT
  325. else
  326. $(error jackbridge direct mode requested, but jack not available)
  327. endif
  328. endif
  329. ifeq ($(HAVE_DGL),true)
  330. BASE_FLAGS += -DHAVE_DGL
  331. BASE_FLAGS += -DDGL_NAMESPACE=CarlaDGL -DDGL_FILE_BROWSER_DISABLED -DDGL_NO_SHARED_RESOURCES
  332. endif
  333. ifeq ($(HAVE_FLUIDSYNTH),true)
  334. BASE_FLAGS += -DHAVE_FLUIDSYNTH
  335. ifeq ($(HAVE_FLUIDSYNTH_INSTPATCH),true)
  336. BASE_FLAGS += -DHAVE_FLUIDSYNTH_INSTPATCH
  337. endif
  338. endif
  339. ifeq ($(HAVE_FFMPEG),true)
  340. BASE_FLAGS += -DHAVE_FFMPEG
  341. endif
  342. ifeq ($(HAVE_HYLIA),true)
  343. BASE_FLAGS += -DHAVE_HYLIA
  344. endif
  345. ifeq ($(HAVE_LIBLO),true)
  346. BASE_FLAGS += -DHAVE_LIBLO
  347. endif
  348. ifeq ($(HAVE_LIBMAGIC),true)
  349. BASE_FLAGS += -DHAVE_LIBMAGIC
  350. endif
  351. ifeq ($(HAVE_PYQT),true)
  352. BASE_FLAGS += -DHAVE_PYQT
  353. endif
  354. ifeq ($(HAVE_SNDFILE),true)
  355. BASE_FLAGS += -DHAVE_SNDFILE
  356. endif
  357. ifeq ($(HAVE_X11),true)
  358. BASE_FLAGS += -DHAVE_X11
  359. endif
  360. ifeq ($(USING_JUCE),true)
  361. BASE_FLAGS += -DUSING_JUCE
  362. endif
  363. ifeq ($(USING_JUCE_AUDIO_DEVICES),true)
  364. BASE_FLAGS += -DUSING_JUCE_AUDIO_DEVICES
  365. endif
  366. ifeq ($(USING_JUCE_GUI_EXTRA),true)
  367. BASE_FLAGS += -DUSING_JUCE_GUI_EXTRA
  368. endif
  369. # ---------------------------------------------------------------------------------------------------------------------
  370. # Set libs stuff (part 1)
  371. ifeq ($(LINUX_OR_MACOS),true)
  372. LIBDL_LIBS = -ldl
  373. endif
  374. ifeq ($(WIN32),true)
  375. PKG_CONFIG_FLAGS = --static
  376. endif
  377. ifeq ($(HAVE_DGL),true)
  378. ifeq ($(MACOS),true)
  379. DGL_LIBS = -framework OpenGL -framework Cocoa
  380. endif
  381. ifeq ($(WIN32),true)
  382. DGL_LIBS = -lopengl32 -lgdi32
  383. endif
  384. ifneq ($(MACOS_OR_WIN32),true)
  385. DGL_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags gl x11)
  386. DGL_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs gl x11)
  387. endif
  388. endif
  389. ifeq ($(HAVE_LIBLO),true)
  390. LIBLO_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags liblo)
  391. LIBLO_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs liblo)
  392. endif
  393. ifeq ($(HAVE_LIBMAGIC),true)
  394. MAGIC_LIBS += -lmagic
  395. ifeq ($(LINUX_OR_MACOS),true)
  396. MAGIC_LIBS += -lz
  397. endif
  398. endif
  399. ifeq ($(HAVE_FFMPEG),true)
  400. FFMPEG_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags libavcodec libavformat libavutil)
  401. FFMPEG_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs libavcodec libavformat libavutil)
  402. endif
  403. ifeq ($(HAVE_FLUIDSYNTH),true)
  404. FLUIDSYNTH_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags fluidsynth)
  405. FLUIDSYNTH_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs fluidsynth)
  406. endif
  407. ifeq ($(HAVE_JACK),true)
  408. JACK_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags jack)
  409. JACK_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs jack)
  410. JACK_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir jack)/jack
  411. endif
  412. ifeq ($(HAVE_QT5),true)
  413. QT5_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags Qt5Core Qt5Gui Qt5Widgets)
  414. QT5_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs Qt5Core Qt5Gui Qt5Widgets)
  415. endif
  416. ifeq ($(HAVE_SNDFILE),true)
  417. SNDFILE_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags sndfile)
  418. SNDFILE_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs sndfile)
  419. endif
  420. ifeq ($(HAVE_X11),true)
  421. X11_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags x11)
  422. X11_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11)
  423. endif
  424. # ---------------------------------------------------------------------------------------------------------------------
  425. # Set libs stuff (part 2)
  426. ifneq ($(USING_JUCE_AUDIO_DEVICES),true)
  427. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY
  428. RTMIDI_FLAGS =
  429. ifeq ($(DEBUG),true)
  430. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  431. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  432. endif
  433. ifeq ($(LINUX),true)
  434. ifeq ($(HAVE_ALSA),true)
  435. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__
  436. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa) -lpthread
  437. RTMIDI_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__
  438. RTMIDI_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa)
  439. endif
  440. endif
  441. ifeq ($(MACOS),true)
  442. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  443. RTAUDIO_LIBS += -framework CoreAudio
  444. RTMIDI_FLAGS += -D__MACOSX_CORE__
  445. RTMIDI_LIBS += -framework CoreMIDI
  446. endif
  447. ifeq ($(UNIX),true)
  448. RTAUDIO_FLAGS += -D__UNIX_JACK__
  449. ifeq ($(HAVE_PULSEAUDIO),true)
  450. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags libpulse-simple) -D__UNIX_PULSE__
  451. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs libpulse-simple)
  452. endif
  453. endif
  454. ifeq ($(WIN32),true)
  455. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__ -D__WINDOWS_WASAPI__
  456. RTAUDIO_LIBS += -ldsound -luuid -lksuser -lwinmm
  457. RTMIDI_FLAGS += -D__WINDOWS_MM__
  458. endif
  459. endif # USING_JUCE_AUDIO_DEVICES
  460. ifeq ($(BSD),true)
  461. JACKBRIDGE_LIBS = -lpthread -lrt
  462. LILV_LIBS = -lm -lrt
  463. RTMEMPOOL_LIBS = -lpthread
  464. WATER_LIBS = -lpthread -lrt
  465. endif
  466. ifeq ($(HAIKU),true)
  467. JACKBRIDGE_LIBS = -lpthread
  468. LILV_LIBS = -lm
  469. RTMEMPOOL_LIBS = -lpthread
  470. WATER_LIBS = -lpthread
  471. endif
  472. ifeq ($(HURD),true)
  473. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  474. LILV_LIBS = -ldl -lm -lrt
  475. RTMEMPOOL_LIBS = -lpthread -lrt
  476. WATER_LIBS = -ldl -lpthread -lrt
  477. endif
  478. ifeq ($(LINUX),true)
  479. HYLIA_FLAGS = -DLINK_PLATFORM_LINUX=1
  480. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  481. LILV_LIBS = -ldl -lm -lrt
  482. RTMEMPOOL_LIBS = -lpthread -lrt
  483. WATER_LIBS = -ldl -lpthread -lrt
  484. ifeq ($(USING_JUCE),true)
  485. JUCE_AUDIO_DEVICES_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa)
  486. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  487. JUCE_EVENTS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11)
  488. JUCE_GRAPHICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs freetype2)
  489. JUCE_GUI_BASICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11 xext)
  490. endif # USING_JUCE
  491. endif # LINUX
  492. ifeq ($(MACOS),true)
  493. HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1
  494. JACKBRIDGE_LIBS = -ldl -lpthread
  495. LILV_LIBS = -ldl -lm
  496. RTMEMPOOL_LIBS = -lpthread
  497. WATER_LIBS = -framework AppKit
  498. ifeq ($(USING_JUCE),true)
  499. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  500. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  501. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  502. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  503. JUCE_CORE_LIBS = -framework AppKit
  504. JUCE_EVENTS_LIBS = -framework AppKit
  505. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  506. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  507. JUCE_GUI_EXTRA_LIBS = -framework IOKit
  508. endif # USING_JUCE
  509. endif # MACOS
  510. ifeq ($(WIN32),true)
  511. HYLIA_FLAGS = -DLINK_PLATFORM_WINDOWS=1
  512. HYLIA_LIBS = -liphlpapi
  513. JACKBRIDGE_LIBS = -lpthread
  514. LILV_LIBS = -lm
  515. RTMEMPOOL_LIBS = -lpthread
  516. WATER_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  517. ifeq ($(USING_JUCE),true)
  518. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  519. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  520. JUCE_GRAPHICS_LIBS = -lgdi32
  521. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  522. endif # USING_JUCE
  523. endif # WIN32
  524. # ---------------------------------------------------------------------------------------------------------------------
  525. AUDIO_DECODER_LIBS = $(FFMPEG_LIBS)
  526. AUDIO_DECODER_LIBS += $(SNDFILE_LIBS)
  527. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  528. NATIVE_PLUGINS_LIBS += $(FFMPEG_LIBS)
  529. NATIVE_PLUGINS_LIBS += $(SNDFILE_LIBS)
  530. # ---------------------------------------------------------------------------------------------------------------------
  531. # Set app extension
  532. ifeq ($(WIN32),true)
  533. APP_EXT = .exe
  534. endif
  535. # ---------------------------------------------------------------------------------------------------------------------
  536. # Set shared lib extension
  537. LIB_EXT = .so
  538. ifeq ($(MACOS),true)
  539. LIB_EXT = .dylib
  540. endif
  541. ifeq ($(WIN32),true)
  542. LIB_EXT = .dll
  543. endif
  544. BASE_FLAGS += -DCARLA_LIB_EXT=\"$(LIB_EXT)\"
  545. # ---------------------------------------------------------------------------------------------------------------------
  546. # Set static libs start & end
  547. ifneq ($(MACOS),true)
  548. LIBS_START = -Wl,--start-group
  549. LIBS_END = -Wl,--end-group
  550. endif
  551. # ---------------------------------------------------------------------------------------------------------------------
  552. # Set shared library CLI arg
  553. ifeq ($(MACOS),true)
  554. SHARED = -dynamiclib
  555. else
  556. SHARED = -shared
  557. endif
  558. # ---------------------------------------------------------------------------------------------------------------------
  559. # Set arguments used for inline 'sed'
  560. ifeq ($(BSD),true)
  561. SED_ARGS=-i '' -e
  562. else
  563. SED_ARGS=-i -e
  564. endif
  565. # ---------------------------------------------------------------------------------------------------------------------
  566. # Set command used for file symlinking
  567. LINK := ln -sf
  568. # ---------------------------------------------------------------------------------------------------------------------
  569. ifneq ($(DEBUG),true)
  570. ifneq ($(TESTBUILD),true)
  571. ifneq (,$(wildcard $(CWD)/native-plugins/external/Makefile.mk))
  572. EXTERNAL_PLUGINS = true
  573. ifeq ($(EXTERNAL_PLUGINS),true)
  574. BASE_FLAGS += -DHAVE_EXTERNAL_PLUGINS
  575. include $(CWD)/native-plugins/external/Makefile.mk
  576. endif
  577. endif
  578. endif
  579. endif
  580. # ---------------------------------------------------------------------------------------------------------------------