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

11 years ago
9 years ago
11 years ago
9 years ago
11 years ago
11 years ago
10 years ago
11 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 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
11 years ago
10 years ago
10 years ago
11 years ago
11 years ago
7 years ago
10 years ago
10 years ago
10 years ago
11 years ago
7 years ago
10 years ago
11 years ago
11 years ago
10 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. #!/usr/bin/make -f
  2. # Makefile for Carla C++ code #
  3. # --------------------------- #
  4. # Created by falkTX
  5. #
  6. # --------------------------------------------------------------
  7. # Modify to enable/disable specific features
  8. # Use the free vestige header instead of the official VST SDK
  9. CARLA_VESTIGE_HEADER = true
  10. # Enable experimental plugins, don't complain if the build fails when using this!
  11. EXPERIMENTAL_PLUGINS = false
  12. # --------------------------------------------------------------
  13. # DO NOT MODIFY PAST THIS POINT!
  14. AR ?= ar
  15. CC ?= gcc
  16. CXX ?= g++
  17. # --------------------------------------------------------------
  18. # Fallback to Linux if no other OS defined
  19. ifneq ($(HAIKU),true)
  20. ifneq ($(MACOS),true)
  21. ifneq ($(WIN32),true)
  22. LINUX=true
  23. endif
  24. endif
  25. endif
  26. # --------------------------------------------------------------
  27. # Set MACOS_OR_WIN32
  28. ifeq ($(MACOS),true)
  29. MACOS_OR_WIN32=true
  30. endif
  31. ifeq ($(WIN32),true)
  32. MACOS_OR_WIN32=true
  33. endif
  34. # --------------------------------------------------------------
  35. # Set UNIX
  36. ifeq ($(LINUX),true)
  37. UNIX=true
  38. endif
  39. ifeq ($(MACOS),true)
  40. UNIX=true
  41. endif
  42. # --------------------------------------------------------------
  43. # Force some features on MacOS and Windows
  44. ifeq ($(MACOS_OR_WIN32),true)
  45. CARLA_VESTIGE_HEADER = false
  46. EXPERIMENTAL_PLUGINS = false
  47. endif
  48. # --------------------------------------------------------------
  49. # Set build and link flags
  50. BASE_FLAGS = -Wall -Wextra -pipe -DBUILDING_CARLA -DREAL_BUILD -MD -MP
  51. BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
  52. ifeq ($(MACOS),true)
  53. # MacOS linker flags
  54. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
  55. else
  56. # Common linker flags
  57. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed
  58. ifneq ($(SKIP_STRIPPING),true)
  59. LINK_OPTS += -Wl,--strip-all
  60. endif
  61. endif
  62. ifeq ($(RASPPI),true)
  63. # Raspberry-Pi optimization flags
  64. BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
  65. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  66. endif
  67. ifeq ($(NOOPT),true)
  68. # No optimization flags
  69. BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
  70. endif
  71. ifneq ($(WIN32),true)
  72. # Not needed for Windows
  73. BASE_FLAGS += -fPIC -DPIC
  74. endif
  75. ifeq ($(CLANG),true)
  76. BASE_FLAGS += -Wabsolute-value
  77. endif
  78. ifeq ($(STOAT),true)
  79. CC = clang
  80. CXX = clang++
  81. BASE_FLAGS += -emit-llvm
  82. BASE_OPTS += -O0
  83. endif
  84. ifeq ($(DEBUG),true)
  85. BASE_FLAGS += -DDEBUG -O0 -g
  86. ifeq ($(WIN32),true)
  87. BASE_FLAGS += -msse -msse2
  88. endif
  89. LINK_OPTS =
  90. else
  91. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  92. CXXFLAGS += -fvisibility-inlines-hidden
  93. endif
  94. 32BIT_FLAGS = -m32
  95. 64BIT_FLAGS = -m64
  96. BUILD_C_FLAGS = $(BASE_FLAGS) -std=gnu99 $(CFLAGS)
  97. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=gnu++0x $(CXXFLAGS)
  98. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  99. ifneq ($(MACOS),true)
  100. # Not available on MacOS
  101. LINK_FLAGS += -Wl,--no-undefined
  102. endif
  103. # --------------------------------------------------------------
  104. # Strict test build
  105. ifeq ($(TESTBUILD),true)
  106. BASE_FLAGS += -Werror -Wabi -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-declarations
  107. BASE_FLAGS += -Woverlength-strings -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wundef -Wuninitialized -Wunused
  108. BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing
  109. BASE_FLAGS += -Wstrict-overflow -fstrict-overflow
  110. CFLAGS += -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings
  111. CXXFLAGS += -Wc++0x-compat -Wc++11-compat -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wzero-as-null-pointer-constant
  112. ifeq ($(LINUX),true)
  113. BASE_FLAGS += -isystem /opt/kxstudio/include
  114. CXXFLAGS += -isystem /opt/kxstudio/include/ntk
  115. CXXFLAGS += -isystem /usr/include/glib-2.0
  116. CXXFLAGS += -isystem /usr/include/glib-2.0/glib
  117. CXXFLAGS += -isystem /usr/include/gtk-2.0
  118. CXXFLAGS += -isystem /usr/include/gtk-2.0/gio
  119. ifeq ($(DEFAULT_QT),4)
  120. CXXFLAGS += -isystem /usr/include/qt4
  121. else
  122. CXXFLAGS += -isystem /usr/include/qt5
  123. endif
  124. endif
  125. ifeq ($(MACOS),true)
  126. BASE_FLAGS += -isystem /opt/kxstudio/include
  127. CXXFLAGS += -isystem /System/Library/Frameworks
  128. endif
  129. ifeq ($(WIN64),true)
  130. BASE_FLAGS += -isystem /opt/mingw64/include
  131. else
  132. ifeq ($(WIN32),true)
  133. BASE_FLAGS += -isystem /opt/mingw32/include
  134. endif
  135. endif
  136. endif
  137. # --------------------------------------------------------------
  138. # Check for optional libs (required by backend or bridges)
  139. ifeq ($(MACOS_OR_WIN32),true)
  140. HAVE_DGL = true
  141. HAVE_HYLIA = true
  142. else
  143. HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
  144. HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
  145. ifeq ($(LINUX),true)
  146. HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
  147. HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
  148. HAVE_HYLIA = true
  149. HAVE_NTK = $(shell pkg-config --exists ntk ntk_images && echo true)
  150. HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
  151. HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
  152. endif
  153. endif
  154. HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true)
  155. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true)
  156. HAVE_LIBLO = $(shell pkg-config --exists liblo && echo true)
  157. HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
  158. HAVE_LINUXSAMPLER = $(shell pkg-config --atleast-version=1.0.0.svn41 linuxsampler && echo true)
  159. HAVE_PROJECTM = $(shell pkg-config --exists libprojectM && echo true)
  160. # --------------------------------------------------------------
  161. # Check for optional libs (special non-pkgconfig unix tests)
  162. ifeq ($(UNIX),true)
  163. # libmagic doesn't have a pkg-config file, so we need to call the compiler to test it
  164. HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS) -x c -w -c - -o .libmagic-tmp 2>/dev/null && echo true)
  165. # fltk doesn't have a pkg-config file but has fltk-config instead.
  166. # Also, don't try looking for it if we already have NTK.
  167. ifneq ($(HAVE_NTK),true)
  168. ifeq ($(shell which fltk-config 1>/dev/null 2>/dev/null && echo true),true)
  169. ifeq ($(shell which fluid 1>/dev/null 2>/dev/null && echo true),true)
  170. HAVE_FLTK = true
  171. endif
  172. endif
  173. endif
  174. endif
  175. # --------------------------------------------------------------
  176. # Set Qt tools
  177. ifeq ($(HAVE_QT4),true)
  178. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  179. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  180. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  181. ifeq (,$(wildcard $(MOC_QT4)))
  182. HAVE_QT4=false
  183. endif
  184. endif
  185. ifeq ($(HAVE_QT5),true)
  186. QT5_LIBDIR = $(shell pkg-config --variable=libdir Qt5Core)
  187. ifeq ($(MACOS),true)
  188. MOC_QT5 ?= $(QT5_LIBDIR)/../bin/moc
  189. RCC_QT5 ?= $(QT5_LIBDIR)/../bin/rcc
  190. UIC_QT5 ?= $(QT5_LIBDIR)/../bin/uic
  191. else # MACOS
  192. ifneq (,$(wildcard $(QT5_LIBDIR)/qt5/bin/moc))
  193. MOC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/moc
  194. RCC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/rcc
  195. UIC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/uic
  196. else
  197. MOC_QT5 ?= $(QT5_LIBDIR)/qt/bin/moc
  198. RCC_QT5 ?= $(QT5_LIBDIR)/qt/bin/rcc
  199. UIC_QT5 ?= $(QT5_LIBDIR)/qt/bin/uic
  200. endif
  201. endif # MACOS
  202. ifeq (,$(wildcard $(MOC_QT5)))
  203. HAVE_QT5=false
  204. endif
  205. endif
  206. ifeq ($(HAVE_QT4),true)
  207. HAVE_QT=true
  208. endif
  209. ifeq ($(HAVE_QT5),true)
  210. HAVE_QT=true
  211. endif
  212. ifeq ($(WIN32),true)
  213. HAVE_QT=true
  214. endif
  215. # --------------------------------------------------------------
  216. # Set PyQt tools
  217. PYUIC4 ?= /usr/bin/pyuic4
  218. PYUIC5 ?= /usr/bin/pyuic5
  219. ifneq (,$(wildcard $(PYUIC4)))
  220. HAVE_PYQT=true
  221. HAVE_PYQT4=true
  222. else
  223. HAVE_PYQT4=false
  224. endif
  225. ifneq (,$(wildcard $(PYUIC5)))
  226. HAVE_PYQT=true
  227. HAVE_PYQT5=true
  228. else
  229. HAVE_PYQT5=false
  230. endif
  231. # --------------------------------------------------------------
  232. # Set default Qt used in frontend
  233. ifeq ($(HAVE_PYQT4),true)
  234. DEFAULT_QT ?= 4
  235. else
  236. DEFAULT_QT ?= 5
  237. endif
  238. # --------------------------------------------------------------
  239. # Set base defines
  240. ifeq ($(HAVE_PYQT),true)
  241. BASE_FLAGS += -DHAVE_PYQT
  242. endif
  243. ifeq ($(HAVE_DGL),true)
  244. BASE_FLAGS += -DHAVE_DGL
  245. endif
  246. ifeq ($(HAVE_FLUIDSYNTH),true)
  247. BASE_FLAGS += -DHAVE_FLUIDSYNTH
  248. endif
  249. ifeq ($(HAVE_HYLIA),true)
  250. BASE_FLAGS += -DHAVE_HYLIA
  251. endif
  252. ifeq ($(HAVE_LIBLO),true)
  253. BASE_FLAGS += -DHAVE_LIBLO
  254. endif
  255. ifeq ($(HAVE_LIBMAGIC),true)
  256. BASE_FLAGS += -DHAVE_LIBMAGIC
  257. endif
  258. ifeq ($(HAVE_LINUXSAMPLER),true)
  259. BASE_FLAGS += -DHAVE_LINUXSAMPLER
  260. endif
  261. ifeq ($(HAVE_PROJECTM),true)
  262. BASE_FLAGS += -DHAVE_PROJECTM
  263. endif
  264. ifeq ($(HAVE_X11),true)
  265. BASE_FLAGS += -DHAVE_X11
  266. endif
  267. ifeq ($(CARLA_VESTIGE_HEADER),true)
  268. BASE_FLAGS += -DVESTIGE_HEADER
  269. endif
  270. # --------------------------------------------------------------
  271. # Set libs stuff (part 1)
  272. ifeq ($(HAVE_LIBLO),true)
  273. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  274. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  275. endif
  276. ifeq ($(HAVE_FLUIDSYNTH),true)
  277. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  278. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  279. endif
  280. ifeq ($(HAVE_LINUXSAMPLER),true)
  281. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -DIS_CPP11=1 -Wno-non-virtual-dtor -Wno-shadow -Wno-unused-parameter
  282. ifeq ($(LINUX),true)
  283. LINUXSAMPLER_LIBS = -Wl,-rpath=$(shell pkg-config --variable=libdir gig):$(shell pkg-config --variable=libdir linuxsampler)
  284. endif
  285. LINUXSAMPLER_LIBS += $(shell pkg-config --libs linuxsampler)
  286. endif
  287. ifeq ($(HAVE_PROJECTM),true)
  288. PROJECTM_FLAGS = $(shell pkg-config --cflags libprojectM)
  289. PROJECTM_LIBS = $(shell pkg-config --libs libprojectM)
  290. endif
  291. ifeq ($(HAVE_X11),true)
  292. X11_FLAGS = $(shell pkg-config --cflags x11)
  293. X11_LIBS = $(shell pkg-config --libs x11)
  294. endif
  295. ifeq ($(HAVE_LIBMAGIC),true)
  296. MAGIC_LIBS += -lmagic
  297. endif
  298. # --------------------------------------------------------------
  299. # Set libs stuff (part 2)
  300. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  301. ifeq ($(DEBUG),true)
  302. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  303. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  304. endif
  305. ifneq ($(HAIKU),true)
  306. RTMEMPOOL_LIBS = -lpthread
  307. endif
  308. ifeq ($(UNIX),true)
  309. HYLIA_FLAGS +=
  310. endif
  311. ifeq ($(LINUX),true)
  312. HYLIA_FLAGS = -DLINK_PLATFORM_LINUX=1
  313. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  314. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  315. LILV_LIBS = -ldl -lm -lrt
  316. ifeq ($(HAVE_DGL),true)
  317. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  318. DGL_LIBS = $(shell pkg-config --libs gl x11)
  319. endif
  320. ifeq ($(HAVE_ALSA),true)
  321. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  322. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  323. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  324. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  325. endif
  326. ifeq ($(HAVE_PULSEAUDIO),true)
  327. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  328. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  329. endif
  330. endif
  331. ifeq ($(MACOS),true)
  332. DGL_LIBS = -framework OpenGL -framework Cocoa
  333. HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1
  334. JACKBRIDGE_LIBS = -ldl -lpthread
  335. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  336. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  337. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  338. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  339. JUCE_CORE_LIBS = -framework AppKit
  340. JUCE_EVENTS_LIBS = -framework AppKit
  341. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  342. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  343. JUCE_GUI_EXTRA_LIBS = -framework Cocoa -framework IOKit
  344. LILV_LIBS = -ldl -lm
  345. endif
  346. ifeq ($(WIN32),true)
  347. DGL_LIBS = -lopengl32 -lgdi32
  348. HYLIA_FLAGS = -DLINK_PLATFORM_WINDOWS=1
  349. JACKBRIDGE_LIBS = -lpthread
  350. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  351. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  352. JUCE_GRAPHICS_LIBS = -lgdi32
  353. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  354. LILV_LIBS = -lm
  355. endif
  356. # --------------------------------------------------------------
  357. # Set libs stuff (part 3)
  358. HAVE_ZYN_DEPS = $(shell pkg-config --exists liblo fftw3 mxml zlib && echo true)
  359. ifeq ($(HAVE_FLTK),true)
  360. HAVE_ZYN_UI_DEPS = true
  361. endif
  362. ifeq ($(HAVE_NTK),true)
  363. HAVE_ZYN_UI_DEPS = true
  364. endif
  365. ifeq ($(HAVE_DGL),true)
  366. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  367. ifeq ($(HAVE_PROJECTM),true)
  368. NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS)
  369. endif
  370. endif
  371. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  372. BASE_FLAGS += -DHAVE_EXPERIMENTAL_PLUGINS
  373. NATIVE_PLUGINS_LIBS += -lclthreads -lzita-convolver -lzita-resampler
  374. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3f)
  375. endif
  376. ifeq ($(HAVE_ZYN_DEPS),true)
  377. BASE_FLAGS += -DHAVE_ZYN_DEPS
  378. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs liblo fftw3 mxml zlib)
  379. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  380. BASE_FLAGS += -DHAVE_ZYN_UI_DEPS
  381. endif
  382. endif
  383. # --------------------------------------------------------------
  384. # Set app extension
  385. ifeq ($(WIN32),true)
  386. APP_EXT = .exe
  387. endif
  388. # --------------------------------------------------------------
  389. # Set shared lib extension
  390. LIB_EXT = .so
  391. ifeq ($(MACOS),true)
  392. LIB_EXT = .dylib
  393. endif
  394. ifeq ($(WIN32),true)
  395. LIB_EXT = .dll
  396. endif
  397. BASE_FLAGS += -DCARLA_LIB_EXT=\"$(LIB_EXT)\"
  398. # --------------------------------------------------------------
  399. # Set static libs start & end
  400. ifneq ($(MACOS),true)
  401. LIBS_START = -Wl,--start-group
  402. LIBS_END = -Wl,--end-group
  403. endif
  404. # --------------------------------------------------------------
  405. # Set shared library CLI arg
  406. ifeq ($(MACOS),true)
  407. SHARED = -dynamiclib
  408. else
  409. SHARED = -shared
  410. endif
  411. # --------------------------------------------------------------