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.

656 lines
18KB

  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
  41. endif
  42. endif
  43. endif
  44. endif
  45. endif
  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
  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 -Wabi=98 -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization
  139. BASE_FLAGS += -Wdouble-promotion -Wfloat-equal -Wlogical-op -Wpointer-arith -Wsign-conversion
  140. BASE_FLAGS += -Wformat=2 -Woverlength-strings
  141. BASE_FLAGS += -Wformat-truncation=2 -Wformat-overflow=2
  142. BASE_FLAGS += -Wstringop-overflow=4 -Wstringop-truncation
  143. BASE_FLAGS += -Wmissing-declarations -Wredundant-decls
  144. BASE_FLAGS += -Wshadow -Wundef -Wuninitialized -Wunused
  145. BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing
  146. BASE_FLAGS += -Wstrict-overflow -fstrict-overflow
  147. BASE_FLAGS += -Wduplicated-branches -Wduplicated-cond -Wnull-dereference
  148. CFLAGS += -Winit-self -Wjump-misses-init -Wmissing-prototypes -Wnested-externs -Wstrict-prototypes -Wwrite-strings
  149. CXXFLAGS += -Wc++0x-compat -Wc++11-compat
  150. CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual
  151. # CXXFLAGS += -Wold-style-cast -Wuseless-cast
  152. CXXFLAGS += -Wzero-as-null-pointer-constant
  153. ifneq ($(DEBUG),true)
  154. CXXFLAGS += -Weffc++
  155. endif
  156. ifeq ($(LINUX),true)
  157. BASE_FLAGS += -isystem /opt/kxstudio/include
  158. endif
  159. ifeq ($(MACOS),true)
  160. CXXFLAGS += -isystem /System/Library/Frameworks
  161. endif
  162. ifeq ($(WIN32),true)
  163. BASE_FLAGS += -isystem /opt/mingw32/include
  164. endif
  165. ifeq ($(WIN64),true)
  166. BASE_FLAGS += -isystem /opt/mingw64/include
  167. endif
  168. endif
  169. # ---------------------------------------------------------------------------------------------------------------------
  170. # Check for optional libs (required by backend or bridges)
  171. ifeq ($(LINUX),true)
  172. HAVE_ALSA = $(shell $(PKG_CONFIG) --exists alsa && echo true)
  173. HAVE_HYLIA = true
  174. endif
  175. ifeq ($(MACOS),true)
  176. ifneq ($(MACOS_OLD),true)
  177. HAVE_HYLIA = true
  178. endif
  179. endif
  180. ifeq ($(WIN32),true)
  181. HAVE_HYLIA = true
  182. endif
  183. ifeq ($(MACOS_OR_WIN32),true)
  184. HAVE_DGL = true
  185. else
  186. HAVE_DGL = $(shell $(PKG_CONFIG) --exists gl x11 && echo true)
  187. HAVE_GTK2 = $(shell $(PKG_CONFIG) --exists gtk+-2.0 && echo true)
  188. HAVE_GTK3 = $(shell $(PKG_CONFIG) --exists gtk+-3.0 && echo true)
  189. HAVE_X11 = $(shell $(PKG_CONFIG) --exists x11 && echo true)
  190. endif
  191. ifeq ($(UNIX),true)
  192. ifneq ($(MACOS),true)
  193. HAVE_PULSEAUDIO = $(shell $(PKG_CONFIG) --exists libpulse-simple && echo true)
  194. endif
  195. endif
  196. # ffmpeg values taken from https://ffmpeg.org/download.html (v2.8.15 maximum)
  197. HAVE_FFMPEG = $(shell $(PKG_CONFIG) --max-version=56.60.100 libavcodec && \
  198. $(PKG_CONFIG) --max-version=56.40.101 libavformat && \
  199. $(PKG_CONFIG) --max-version=54.31.100 libavutil && echo true)
  200. HAVE_FLUIDSYNTH = $(shell $(PKG_CONFIG) --atleast-version=1.1.7 fluidsynth && echo true)
  201. HAVE_JACK = $(shell $(PKG_CONFIG) --exists jack && echo true)
  202. HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true)
  203. HAVE_QT4 = $(shell $(PKG_CONFIG) --exists QtCore QtGui && echo true)
  204. HAVE_QT5 = $(shell $(PKG_CONFIG) --exists Qt5Core Qt5Gui Qt5Widgets && \
  205. $(PKG_CONFIG) --variable=qt_config Qt5Core | grep -q -v "static" && echo true)
  206. HAVE_SNDFILE = $(shell $(PKG_CONFIG) --exists sndfile && echo true)
  207. ifeq ($(LINUX),true)
  208. HAVE_JUCE_LINUX_DEPS = $(shell $(PKG_CONFIG) --exists x11 xext freetype2 && echo true)
  209. endif
  210. # ---------------------------------------------------------------------------------------------------------------------
  211. # Check for optional libs (special non-pkgconfig tests)
  212. ifneq ($(WIN32),true)
  213. # libmagic doesn't have a pkg-config file, so we need to call the compiler to test it
  214. HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS) -x c -w -c - -o .libmagic-tmp 2>/dev/null && echo true)
  215. endif
  216. # ---------------------------------------------------------------------------------------------------------------------
  217. # Set Qt tools
  218. ifeq ($(HAVE_QT4),true)
  219. MOC_QT4 ?= $(shell $(PKG_CONFIG) --variable=moc_location QtCore)
  220. RCC_QT4 ?= $(shell $(PKG_CONFIG) --variable=rcc_location QtCore)
  221. UIC_QT4 ?= $(shell $(PKG_CONFIG) --variable=uic_location QtCore)
  222. ifeq (,$(wildcard $(MOC_QT4)))
  223. HAVE_QT4=false
  224. endif
  225. ifeq (,$(wildcard $(RCC_QT4)))
  226. HAVE_QT4=false
  227. endif
  228. endif
  229. ifeq ($(HAVE_QT5),true)
  230. QT5_HOSTBINS = $(shell $(PKG_CONFIG) --variable=host_bins Qt5Core)
  231. MOC_QT5 ?= $(QT5_HOSTBINS)/moc
  232. RCC_QT5 ?= $(QT5_HOSTBINS)/rcc
  233. UIC_QT5 ?= $(QT5_HOSTBINS)/uic
  234. ifeq (,$(wildcard $(MOC_QT5)))
  235. HAVE_QT5=false
  236. endif
  237. ifeq (,$(wildcard $(RCC_QT5)))
  238. HAVE_QT5=false
  239. endif
  240. endif
  241. ifeq ($(HAVE_QT4),true)
  242. HAVE_QT=true
  243. endif
  244. ifeq ($(HAVE_QT5),true)
  245. HAVE_QT=true
  246. endif
  247. ifeq ($(WIN32),true)
  248. HAVE_QT=true
  249. endif
  250. # ---------------------------------------------------------------------------------------------------------------------
  251. # Set PyQt tools
  252. PYRCC5 ?= $(shell which pyrcc5 2>/dev/null)
  253. PYUIC5 ?= $(shell which pyuic5 2>/dev/null)
  254. ifneq ($(PYUIC5),)
  255. ifneq ($(PYRCC5),)
  256. HAVE_PYQT = true
  257. endif
  258. endif
  259. # ---------------------------------------------------------------------------------------------------------------------
  260. # Set PyQt tools, part2
  261. PYRCC ?= $(PYRCC5)
  262. PYUIC ?= $(PYUIC5)
  263. ifeq ($(HAVE_QT5),true)
  264. HAVE_THEME = true
  265. else
  266. ifeq ($(MACOS),true)
  267. ifeq ($(HAVE_PYQT),true)
  268. HAVE_THEME = true
  269. endif
  270. endif
  271. endif
  272. # ---------------------------------------------------------------------------------------------------------------------
  273. # Set USING_JUCE
  274. ifeq ($(MACOS_OR_WIN32),true)
  275. ifneq ($(MACOS_OLD),true)
  276. USING_JUCE = true
  277. USING_JUCE_AUDIO_DEVICES = true
  278. endif
  279. endif
  280. ifeq ($(HAVE_JUCE_LINUX_DEPS),true)
  281. USING_JUCE = true
  282. endif
  283. ifeq ($(LINUX_OR_MACOS),true)
  284. USING_JUCE_GUI_EXTRA = true
  285. endif
  286. # ---------------------------------------------------------------------------------------------------------------------
  287. # Set base defines
  288. ifeq ($(JACKBRIDGE_DIRECT),true)
  289. ifeq ($(HAVE_JACK),true)
  290. BASE_FLAGS += -DJACKBRIDGE_DIRECT
  291. else
  292. $(error jackbridge direct mode requested, but jack not available)
  293. endif
  294. endif
  295. ifeq ($(HAVE_DGL),true)
  296. BASE_FLAGS += -DHAVE_DGL
  297. BASE_FLAGS += -DDGL_NAMESPACE=CarlaDGL -DDGL_FILE_BROWSER_DISABLED -DDGL_NO_SHARED_RESOURCES
  298. endif
  299. ifeq ($(HAVE_FLUIDSYNTH),true)
  300. BASE_FLAGS += -DHAVE_FLUIDSYNTH
  301. endif
  302. ifeq ($(HAVE_FFMPEG),true)
  303. BASE_FLAGS += -DHAVE_FFMPEG
  304. endif
  305. ifeq ($(HAVE_HYLIA),true)
  306. BASE_FLAGS += -DHAVE_HYLIA
  307. endif
  308. ifeq ($(HAVE_LIBLO),true)
  309. BASE_FLAGS += -DHAVE_LIBLO
  310. endif
  311. ifeq ($(HAVE_LIBMAGIC),true)
  312. BASE_FLAGS += -DHAVE_LIBMAGIC
  313. endif
  314. ifeq ($(HAVE_PYQT),true)
  315. BASE_FLAGS += -DHAVE_PYQT
  316. endif
  317. ifeq ($(HAVE_SNDFILE),true)
  318. BASE_FLAGS += -DHAVE_SNDFILE
  319. endif
  320. ifeq ($(HAVE_X11),true)
  321. BASE_FLAGS += -DHAVE_X11
  322. endif
  323. ifeq ($(USING_JUCE),true)
  324. BASE_FLAGS += -DUSING_JUCE
  325. endif
  326. ifeq ($(USING_JUCE_AUDIO_DEVICES),true)
  327. BASE_FLAGS += -DUSING_JUCE_AUDIO_DEVICES
  328. endif
  329. ifeq ($(USING_JUCE_GUI_EXTRA),true)
  330. BASE_FLAGS += -DUSING_JUCE_GUI_EXTRA
  331. endif
  332. # ---------------------------------------------------------------------------------------------------------------------
  333. # Set libs stuff (part 1)
  334. ifeq ($(LINUX_OR_MACOS),true)
  335. LIBDL_LIBS = -ldl
  336. endif
  337. ifeq ($(WIN32),true)
  338. PKG_CONFIG_FLAGS = --static
  339. endif
  340. ifeq ($(HAVE_DGL),true)
  341. ifeq ($(MACOS),true)
  342. DGL_LIBS = -framework OpenGL -framework Cocoa
  343. endif
  344. ifeq ($(WIN32),true)
  345. DGL_LIBS = -lopengl32 -lgdi32
  346. endif
  347. ifneq ($(MACOS_OR_WIN32),true)
  348. DGL_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags gl x11)
  349. DGL_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs gl x11)
  350. endif
  351. endif
  352. ifeq ($(HAVE_LIBLO),true)
  353. LIBLO_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags liblo)
  354. LIBLO_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs liblo)
  355. endif
  356. ifeq ($(HAVE_LIBMAGIC),true)
  357. MAGIC_LIBS += -lmagic
  358. ifeq ($(LINUX_OR_MACOS),true)
  359. MAGIC_LIBS += -lz
  360. endif
  361. endif
  362. ifeq ($(HAVE_FFMPEG),true)
  363. FFMPEG_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags libavcodec libavformat libavutil)
  364. FFMPEG_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs libavcodec libavformat libavutil)
  365. endif
  366. ifeq ($(HAVE_FLUIDSYNTH),true)
  367. FLUIDSYNTH_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags fluidsynth)
  368. FLUIDSYNTH_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs fluidsynth)
  369. endif
  370. ifeq ($(HAVE_JACK),true)
  371. JACK_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags jack)
  372. JACK_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs jack)
  373. JACK_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir jack)/jack
  374. endif
  375. ifeq ($(HAVE_QT5),true)
  376. QT5_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags Qt5Core Qt5Gui Qt5Widgets)
  377. QT5_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs Qt5Core Qt5Gui Qt5Widgets)
  378. endif
  379. ifeq ($(HAVE_SNDFILE),true)
  380. SNDFILE_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags sndfile)
  381. SNDFILE_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs sndfile)
  382. endif
  383. ifeq ($(HAVE_X11),true)
  384. X11_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags x11)
  385. X11_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11)
  386. endif
  387. # ---------------------------------------------------------------------------------------------------------------------
  388. # Set libs stuff (part 2)
  389. ifneq ($(USING_JUCE_AUDIO_DEVICES),true)
  390. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY
  391. RTMIDI_FLAGS =
  392. ifeq ($(DEBUG),true)
  393. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  394. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  395. endif
  396. ifeq ($(UNIX),true)
  397. RTAUDIO_FLAGS += -D__UNIX_JACK__
  398. ifeq ($(HAVE_PULSEAUDIO),true)
  399. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags libpulse-simple) -D__UNIX_PULSE__
  400. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs libpulse-simple)
  401. endif
  402. endif
  403. endif # USING_JUCE_AUDIO_DEVICES
  404. ifeq ($(BSD),true)
  405. JACKBRIDGE_LIBS = -lpthread -lrt
  406. LILV_LIBS = -lm -lrt
  407. RTMEMPOOL_LIBS = -lpthread
  408. WATER_LIBS = -lpthread -lrt
  409. endif
  410. ifeq ($(HAIKU),true)
  411. JACKBRIDGE_LIBS = -lpthread
  412. LILV_LIBS = -lm
  413. RTMEMPOOL_LIBS = -lpthread
  414. WATER_LIBS = -lpthread
  415. endif
  416. ifeq ($(HURD),true)
  417. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  418. LILV_LIBS = -ldl -lm -lrt
  419. RTMEMPOOL_LIBS = -lpthread -lrt
  420. WATER_LIBS = -ldl -lpthread -lrt
  421. endif
  422. ifeq ($(LINUX),true)
  423. HYLIA_FLAGS = -DLINK_PLATFORM_LINUX=1
  424. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  425. LILV_LIBS = -ldl -lm -lrt
  426. RTMEMPOOL_LIBS = -lpthread -lrt
  427. WATER_LIBS = -ldl -lpthread -lrt
  428. ifeq ($(USING_JUCE),true)
  429. JUCE_AUDIO_DEVICES_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa)
  430. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  431. JUCE_EVENTS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11)
  432. JUCE_GRAPHICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs freetype2)
  433. JUCE_GUI_BASICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11 xext)
  434. else
  435. ifeq ($(HAVE_ALSA),true)
  436. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__
  437. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa) -lpthread
  438. RTMIDI_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__
  439. RTMIDI_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa)
  440. endif
  441. endif
  442. endif
  443. ifeq ($(MACOS),true)
  444. HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1
  445. JACKBRIDGE_LIBS = -ldl -lpthread
  446. LILV_LIBS = -ldl -lm
  447. RTMEMPOOL_LIBS = -lpthread
  448. WATER_LIBS = -framework AppKit
  449. ifeq ($(USING_JUCE),true)
  450. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  451. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  452. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  453. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  454. JUCE_CORE_LIBS = -framework AppKit
  455. JUCE_EVENTS_LIBS = -framework AppKit
  456. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  457. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  458. JUCE_GUI_EXTRA_LIBS = -framework IOKit
  459. else
  460. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  461. RTAUDIO_LIBS += -framework CoreAudio
  462. RTMIDI_FLAGS += -D__MACOSX_CORE__
  463. RTMIDI_LIBS += -framework CoreMIDI
  464. endif
  465. endif
  466. ifeq ($(WIN32),true)
  467. HYLIA_FLAGS = -DLINK_PLATFORM_WINDOWS=1
  468. HYLIA_LIBS = -liphlpapi
  469. JACKBRIDGE_LIBS = -lpthread
  470. LILV_LIBS = -lm
  471. RTMEMPOOL_LIBS = -lpthread
  472. WATER_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  473. ifeq ($(USING_JUCE),true)
  474. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  475. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  476. JUCE_GRAPHICS_LIBS = -lgdi32
  477. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  478. else
  479. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__ -D__WINDOWS_WASAPI__
  480. RTAUDIO_LIBS += -ldsound -luuid -lksuser -lwinmm
  481. RTMIDI_FLAGS += -D__WINDOWS_MM__
  482. endif
  483. endif
  484. # ---------------------------------------------------------------------------------------------------------------------
  485. AUDIO_DECODER_LIBS = $(FFMPEG_LIBS)
  486. AUDIO_DECODER_LIBS += $(SNDFILE_LIBS)
  487. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  488. NATIVE_PLUGINS_LIBS += $(FFMPEG_LIBS)
  489. NATIVE_PLUGINS_LIBS += $(SNDFILE_LIBS)
  490. # ---------------------------------------------------------------------------------------------------------------------
  491. # Set app extension
  492. ifeq ($(WIN32),true)
  493. APP_EXT = .exe
  494. endif
  495. # ---------------------------------------------------------------------------------------------------------------------
  496. # Set shared lib extension
  497. LIB_EXT = .so
  498. ifeq ($(MACOS),true)
  499. LIB_EXT = .dylib
  500. endif
  501. ifeq ($(WIN32),true)
  502. LIB_EXT = .dll
  503. endif
  504. BASE_FLAGS += -DCARLA_LIB_EXT=\"$(LIB_EXT)\"
  505. # ---------------------------------------------------------------------------------------------------------------------
  506. # Set static libs start & end
  507. ifneq ($(MACOS),true)
  508. LIBS_START = -Wl,--start-group
  509. LIBS_END = -Wl,--end-group
  510. endif
  511. # ---------------------------------------------------------------------------------------------------------------------
  512. # Set shared library CLI arg
  513. ifeq ($(MACOS),true)
  514. SHARED = -dynamiclib
  515. else
  516. SHARED = -shared
  517. endif
  518. # ---------------------------------------------------------------------------------------------------------------------
  519. # Set arguments used for inline 'sed'
  520. ifeq ($(BSD),true)
  521. SED_ARGS=-i '' -e
  522. else
  523. SED_ARGS=-i -e
  524. endif
  525. # ---------------------------------------------------------------------------------------------------------------------
  526. # Set command used for file symlinking
  527. LINK := ln -sf
  528. # ---------------------------------------------------------------------------------------------------------------------
  529. ifneq ($(DEBUG),true)
  530. ifneq ($(TESTBUILD),true)
  531. ifneq (,$(wildcard $(CWD)/native-plugins/external/Makefile.mk))
  532. EXTERNAL_PLUGINS = true
  533. BASE_FLAGS += -DHAVE_EXTERNAL_PLUGINS
  534. include $(CWD)/native-plugins/external/Makefile.mk
  535. endif
  536. endif
  537. endif
  538. # ---------------------------------------------------------------------------------------------------------------------