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 20KB

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