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.

Makefile.mk 19KB

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