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.

775 lines
22KB

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