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.

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