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.

689 lines
19KB

  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 -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 ($(HAVE_FLUIDSYNTH),true)
  208. HAVE_FLUIDSYNTH_INSTPATCH = $(shell $(PKG_CONFIG) --atleast-version=2.1.0 fluidsynth && \
  209. $(PKG_CONFIG) --atleast-version=1.1.4 libinstpatch-1.0 && echo true)
  210. endif
  211. ifeq ($(LINUX),true)
  212. # juce only supports the most common architectures
  213. ifneq (,$(findstring arm,$(TARGET_MACHINE)))
  214. HACE_JUCE_SUPPORTED_ARCH = true
  215. endif
  216. ifneq (,$(findstring aarch64,$(TARGET_MACHINE)))
  217. HACE_JUCE_SUPPORTED_ARCH = true
  218. endif
  219. ifneq (,$(findstring i686,$(TARGET_MACHINE)))
  220. HACE_JUCE_SUPPORTED_ARCH = true
  221. endif
  222. ifneq (,$(findstring x86_64,$(TARGET_MACHINE)))
  223. HACE_JUCE_SUPPORTED_ARCH = true
  224. endif
  225. ifeq ($(HACE_JUCE_SUPPORTED_ARCH),true)
  226. HAVE_JUCE_LINUX_DEPS = $(shell $(PKG_CONFIG) --exists x11 xcursor xext freetype2 && echo true)
  227. endif
  228. endif
  229. # ---------------------------------------------------------------------------------------------------------------------
  230. # Check for optional libs (special non-pkgconfig tests)
  231. ifneq ($(WIN32),true)
  232. # libmagic doesn't have a pkg-config file, so we need to call the compiler to test it
  233. HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS) -x c -w -c - -o .libmagic-tmp 2>/dev/null && echo true)
  234. endif
  235. # ---------------------------------------------------------------------------------------------------------------------
  236. # Set Qt tools
  237. ifeq ($(HAVE_QT4),true)
  238. MOC_QT4 ?= $(shell $(PKG_CONFIG) --variable=moc_location QtCore)
  239. RCC_QT4 ?= $(shell $(PKG_CONFIG) --variable=rcc_location QtCore)
  240. UIC_QT4 ?= $(shell $(PKG_CONFIG) --variable=uic_location QtCore)
  241. ifeq (,$(wildcard $(MOC_QT4)))
  242. HAVE_QT4=false
  243. endif
  244. ifeq (,$(wildcard $(RCC_QT4)))
  245. HAVE_QT4=false
  246. endif
  247. endif
  248. ifeq ($(HAVE_QT5),true)
  249. QT5_HOSTBINS = $(shell $(PKG_CONFIG) --variable=host_bins Qt5Core)
  250. MOC_QT5 ?= $(QT5_HOSTBINS)/moc
  251. RCC_QT5 ?= $(QT5_HOSTBINS)/rcc
  252. UIC_QT5 ?= $(QT5_HOSTBINS)/uic
  253. ifeq (,$(wildcard $(MOC_QT5)))
  254. HAVE_QT5=false
  255. endif
  256. ifeq (,$(wildcard $(RCC_QT5)))
  257. HAVE_QT5=false
  258. endif
  259. endif
  260. ifeq ($(HAVE_QT4),true)
  261. HAVE_QT=true
  262. endif
  263. ifeq ($(HAVE_QT5),true)
  264. HAVE_QT=true
  265. endif
  266. ifeq ($(WIN32),true)
  267. HAVE_QT=true
  268. endif
  269. # ---------------------------------------------------------------------------------------------------------------------
  270. # Set PyQt tools
  271. PYRCC5 ?= $(shell which pyrcc5 2>/dev/null)
  272. PYUIC5 ?= $(shell which pyuic5 2>/dev/null)
  273. ifneq ($(PYUIC5),)
  274. ifneq ($(PYRCC5),)
  275. HAVE_PYQT = true
  276. endif
  277. endif
  278. # ---------------------------------------------------------------------------------------------------------------------
  279. # Set PyQt tools, part2
  280. PYRCC ?= $(PYRCC5)
  281. PYUIC ?= $(PYUIC5)
  282. ifeq ($(HAVE_QT5),true)
  283. HAVE_THEME = true
  284. else
  285. ifeq ($(MACOS),true)
  286. ifeq ($(HAVE_PYQT),true)
  287. HAVE_THEME = true
  288. endif
  289. endif
  290. endif
  291. # ---------------------------------------------------------------------------------------------------------------------
  292. # Set USING_JUCE
  293. ifeq ($(MACOS_OR_WIN32),true)
  294. ifneq ($(MACOS_OLD),true)
  295. USING_JUCE = true
  296. USING_JUCE_AUDIO_DEVICES = true
  297. endif
  298. endif
  299. ifeq ($(HAVE_JUCE_LINUX_DEPS),true)
  300. USING_JUCE = true
  301. endif
  302. ifeq ($(USING_JUCE),true)
  303. ifeq ($(LINUX_OR_MACOS),true)
  304. USING_JUCE_GUI_EXTRA = true
  305. endif
  306. endif
  307. # ---------------------------------------------------------------------------------------------------------------------
  308. # Set base defines
  309. ifeq ($(JACKBRIDGE_DIRECT),true)
  310. ifeq ($(HAVE_JACK),true)
  311. BASE_FLAGS += -DJACKBRIDGE_DIRECT
  312. else
  313. $(error jackbridge direct mode requested, but jack not available)
  314. endif
  315. endif
  316. ifeq ($(HAVE_DGL),true)
  317. BASE_FLAGS += -DHAVE_DGL
  318. BASE_FLAGS += -DDGL_NAMESPACE=CarlaDGL -DDGL_FILE_BROWSER_DISABLED -DDGL_NO_SHARED_RESOURCES
  319. endif
  320. ifeq ($(HAVE_FLUIDSYNTH),true)
  321. BASE_FLAGS += -DHAVE_FLUIDSYNTH
  322. ifeq ($(HAVE_FLUIDSYNTH_INSTPATCH),true)
  323. BASE_FLAGS += -DHAVE_FLUIDSYNTH_INSTPATCH
  324. endif
  325. endif
  326. ifeq ($(HAVE_FFMPEG),true)
  327. BASE_FLAGS += -DHAVE_FFMPEG
  328. endif
  329. ifeq ($(HAVE_HYLIA),true)
  330. BASE_FLAGS += -DHAVE_HYLIA
  331. endif
  332. ifeq ($(HAVE_LIBLO),true)
  333. BASE_FLAGS += -DHAVE_LIBLO
  334. endif
  335. ifeq ($(HAVE_LIBMAGIC),true)
  336. BASE_FLAGS += -DHAVE_LIBMAGIC
  337. endif
  338. ifeq ($(HAVE_PYQT),true)
  339. BASE_FLAGS += -DHAVE_PYQT
  340. endif
  341. ifeq ($(HAVE_SNDFILE),true)
  342. BASE_FLAGS += -DHAVE_SNDFILE
  343. endif
  344. ifeq ($(HAVE_X11),true)
  345. BASE_FLAGS += -DHAVE_X11
  346. endif
  347. ifeq ($(USING_JUCE),true)
  348. BASE_FLAGS += -DUSING_JUCE
  349. endif
  350. ifeq ($(USING_JUCE_AUDIO_DEVICES),true)
  351. BASE_FLAGS += -DUSING_JUCE_AUDIO_DEVICES
  352. endif
  353. ifeq ($(USING_JUCE_GUI_EXTRA),true)
  354. BASE_FLAGS += -DUSING_JUCE_GUI_EXTRA
  355. endif
  356. # ---------------------------------------------------------------------------------------------------------------------
  357. # Set libs stuff (part 1)
  358. ifeq ($(LINUX_OR_MACOS),true)
  359. LIBDL_LIBS = -ldl
  360. endif
  361. ifeq ($(WIN32),true)
  362. PKG_CONFIG_FLAGS = --static
  363. endif
  364. ifeq ($(HAVE_DGL),true)
  365. ifeq ($(MACOS),true)
  366. DGL_LIBS = -framework OpenGL -framework Cocoa
  367. endif
  368. ifeq ($(WIN32),true)
  369. DGL_LIBS = -lopengl32 -lgdi32
  370. endif
  371. ifneq ($(MACOS_OR_WIN32),true)
  372. DGL_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags gl x11)
  373. DGL_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs gl x11)
  374. endif
  375. endif
  376. ifeq ($(HAVE_LIBLO),true)
  377. LIBLO_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags liblo)
  378. LIBLO_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs liblo)
  379. endif
  380. ifeq ($(HAVE_LIBMAGIC),true)
  381. MAGIC_LIBS += -lmagic
  382. ifeq ($(LINUX_OR_MACOS),true)
  383. MAGIC_LIBS += -lz
  384. endif
  385. endif
  386. ifeq ($(HAVE_FFMPEG),true)
  387. FFMPEG_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags libavcodec libavformat libavutil)
  388. FFMPEG_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs libavcodec libavformat libavutil)
  389. endif
  390. ifeq ($(HAVE_FLUIDSYNTH),true)
  391. FLUIDSYNTH_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags fluidsynth)
  392. FLUIDSYNTH_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs fluidsynth)
  393. endif
  394. ifeq ($(HAVE_JACK),true)
  395. JACK_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags jack)
  396. JACK_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs jack)
  397. JACK_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir jack)/jack
  398. endif
  399. ifeq ($(HAVE_QT5),true)
  400. QT5_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags Qt5Core Qt5Gui Qt5Widgets)
  401. QT5_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs Qt5Core Qt5Gui Qt5Widgets)
  402. endif
  403. ifeq ($(HAVE_SNDFILE),true)
  404. SNDFILE_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags sndfile)
  405. SNDFILE_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs sndfile)
  406. endif
  407. ifeq ($(HAVE_X11),true)
  408. X11_FLAGS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags x11)
  409. X11_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11)
  410. endif
  411. # ---------------------------------------------------------------------------------------------------------------------
  412. # Set libs stuff (part 2)
  413. ifneq ($(USING_JUCE_AUDIO_DEVICES),true)
  414. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY
  415. RTMIDI_FLAGS =
  416. ifeq ($(DEBUG),true)
  417. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  418. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  419. endif
  420. ifeq ($(LINUX),true)
  421. ifeq ($(HAVE_ALSA),true)
  422. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__
  423. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa) -lpthread
  424. RTMIDI_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__
  425. RTMIDI_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa)
  426. endif
  427. endif
  428. ifeq ($(MACOS),true)
  429. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  430. RTAUDIO_LIBS += -framework CoreAudio
  431. RTMIDI_FLAGS += -D__MACOSX_CORE__
  432. RTMIDI_LIBS += -framework CoreMIDI
  433. endif
  434. ifeq ($(UNIX),true)
  435. RTAUDIO_FLAGS += -D__UNIX_JACK__
  436. ifeq ($(HAVE_PULSEAUDIO),true)
  437. RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags libpulse-simple) -D__UNIX_PULSE__
  438. RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs libpulse-simple)
  439. endif
  440. endif
  441. ifeq ($(WIN32),true)
  442. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__ -D__WINDOWS_WASAPI__
  443. RTAUDIO_LIBS += -ldsound -luuid -lksuser -lwinmm
  444. RTMIDI_FLAGS += -D__WINDOWS_MM__
  445. endif
  446. endif # USING_JUCE_AUDIO_DEVICES
  447. ifeq ($(BSD),true)
  448. JACKBRIDGE_LIBS = -lpthread -lrt
  449. LILV_LIBS = -lm -lrt
  450. RTMEMPOOL_LIBS = -lpthread
  451. WATER_LIBS = -lpthread -lrt
  452. endif
  453. ifeq ($(HAIKU),true)
  454. JACKBRIDGE_LIBS = -lpthread
  455. LILV_LIBS = -lm
  456. RTMEMPOOL_LIBS = -lpthread
  457. WATER_LIBS = -lpthread
  458. endif
  459. ifeq ($(HURD),true)
  460. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  461. LILV_LIBS = -ldl -lm -lrt
  462. RTMEMPOOL_LIBS = -lpthread -lrt
  463. WATER_LIBS = -ldl -lpthread -lrt
  464. endif
  465. ifeq ($(LINUX),true)
  466. HYLIA_FLAGS = -DLINK_PLATFORM_LINUX=1
  467. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  468. LILV_LIBS = -ldl -lm -lrt
  469. RTMEMPOOL_LIBS = -lpthread -lrt
  470. WATER_LIBS = -ldl -lpthread -lrt
  471. ifeq ($(USING_JUCE),true)
  472. JUCE_AUDIO_DEVICES_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa)
  473. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  474. JUCE_EVENTS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11)
  475. JUCE_GRAPHICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs freetype2)
  476. JUCE_GUI_BASICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11 xext)
  477. endif # USING_JUCE
  478. endif # LINUX
  479. ifeq ($(MACOS),true)
  480. HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1
  481. JACKBRIDGE_LIBS = -ldl -lpthread
  482. LILV_LIBS = -ldl -lm
  483. RTMEMPOOL_LIBS = -lpthread
  484. WATER_LIBS = -framework AppKit
  485. ifeq ($(USING_JUCE),true)
  486. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  487. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  488. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  489. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  490. JUCE_CORE_LIBS = -framework AppKit
  491. JUCE_EVENTS_LIBS = -framework AppKit
  492. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  493. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  494. JUCE_GUI_EXTRA_LIBS = -framework IOKit
  495. endif # USING_JUCE
  496. endif # MACOS
  497. ifeq ($(WIN32),true)
  498. HYLIA_FLAGS = -DLINK_PLATFORM_WINDOWS=1
  499. HYLIA_LIBS = -liphlpapi
  500. JACKBRIDGE_LIBS = -lpthread
  501. LILV_LIBS = -lm
  502. RTMEMPOOL_LIBS = -lpthread
  503. WATER_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  504. ifeq ($(USING_JUCE),true)
  505. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  506. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  507. JUCE_GRAPHICS_LIBS = -lgdi32
  508. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  509. endif # USING_JUCE
  510. endif # WIN32
  511. # ---------------------------------------------------------------------------------------------------------------------
  512. AUDIO_DECODER_LIBS = $(FFMPEG_LIBS)
  513. AUDIO_DECODER_LIBS += $(SNDFILE_LIBS)
  514. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  515. NATIVE_PLUGINS_LIBS += $(FFMPEG_LIBS)
  516. NATIVE_PLUGINS_LIBS += $(SNDFILE_LIBS)
  517. # ---------------------------------------------------------------------------------------------------------------------
  518. # Set app extension
  519. ifeq ($(WIN32),true)
  520. APP_EXT = .exe
  521. endif
  522. # ---------------------------------------------------------------------------------------------------------------------
  523. # Set shared lib extension
  524. LIB_EXT = .so
  525. ifeq ($(MACOS),true)
  526. LIB_EXT = .dylib
  527. endif
  528. ifeq ($(WIN32),true)
  529. LIB_EXT = .dll
  530. endif
  531. BASE_FLAGS += -DCARLA_LIB_EXT=\"$(LIB_EXT)\"
  532. # ---------------------------------------------------------------------------------------------------------------------
  533. # Set static libs start & end
  534. ifneq ($(MACOS),true)
  535. LIBS_START = -Wl,--start-group
  536. LIBS_END = -Wl,--end-group
  537. endif
  538. # ---------------------------------------------------------------------------------------------------------------------
  539. # Set shared library CLI arg
  540. ifeq ($(MACOS),true)
  541. SHARED = -dynamiclib
  542. else
  543. SHARED = -shared
  544. endif
  545. # ---------------------------------------------------------------------------------------------------------------------
  546. # Set arguments used for inline 'sed'
  547. ifeq ($(BSD),true)
  548. SED_ARGS=-i '' -e
  549. else
  550. SED_ARGS=-i -e
  551. endif
  552. # ---------------------------------------------------------------------------------------------------------------------
  553. # Set command used for file symlinking
  554. LINK := ln -sf
  555. # ---------------------------------------------------------------------------------------------------------------------
  556. ifneq ($(DEBUG),true)
  557. ifneq ($(TESTBUILD),true)
  558. ifneq (,$(wildcard $(CWD)/native-plugins/external/Makefile.mk))
  559. EXTERNAL_PLUGINS = true
  560. ifeq ($(EXTERNAL_PLUGINS),true)
  561. BASE_FLAGS += -DHAVE_EXTERNAL_PLUGINS
  562. include $(CWD)/native-plugins/external/Makefile.mk
  563. endif
  564. endif
  565. endif
  566. endif
  567. # ---------------------------------------------------------------------------------------------------------------------