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.

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