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.

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