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

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 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
10 years ago
10 years ago
11 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
10 years ago
10 years ago
11 years ago
11 years ago
11 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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. # Support for LADSPA, DSSI, LV2, VST and AU plugins
  9. CARLA_PLUGIN_SUPPORT = true
  10. # Support for csound files (version 6, not ready yet)
  11. CARLA_CSOUND_SUPPORT = false
  12. # Support for GIG, SF2 and SFZ sample banks (through fluidsynth and linuxsampler)
  13. CARLA_SAMPLERS_SUPPORT = true
  14. # Use the free vestige header instead of the official VST SDK
  15. CARLA_VESTIGE_HEADER = true
  16. # --------------------------------------------------------------
  17. # DO NOT MODIFY PAST THIS POINT!
  18. AR ?= ar
  19. RM ?= rm -f
  20. CC ?= gcc
  21. CXX ?= g++
  22. # --------------------------------------------------------------
  23. # Fallback to Linux if no other OS defined
  24. ifneq ($(HAIKU),true)
  25. ifneq ($(MACOS),true)
  26. ifneq ($(WIN32),true)
  27. LINUX=true
  28. endif
  29. endif
  30. endif
  31. # --------------------------------------------------------------
  32. # Set MACOS_OR_WIN32
  33. ifeq ($(MACOS),true)
  34. MACOS_OR_WIN32=true
  35. endif
  36. ifeq ($(WIN32),true)
  37. MACOS_OR_WIN32=true
  38. endif
  39. # --------------------------------------------------------------
  40. # Common build and link flags
  41. BASE_FLAGS = -Wall -Wextra -pipe -DREAL_BUILD
  42. BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
  43. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections
  44. # -Wl,--strip-all
  45. ifeq ($(MACOS),true)
  46. # MacOS linker flags
  47. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
  48. endif
  49. ifeq ($(RASPPI),true)
  50. # Raspberry-Pi optimization flags
  51. BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
  52. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  53. endif
  54. ifneq ($(WIN32),true)
  55. # not needed for Windows
  56. BASE_FLAGS += -fPIC -DPIC
  57. endif
  58. ifeq ($(DEBUG),true)
  59. BASE_FLAGS += -DDEBUG -O0 -g
  60. LINK_OPTS =
  61. else
  62. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  63. CXXFLAGS += -fvisibility-inlines-hidden
  64. endif
  65. 32BIT_FLAGS = -m32
  66. 64BIT_FLAGS = -m64
  67. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  68. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
  69. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  70. ifeq ($(MACOS),true)
  71. # No C++11 support
  72. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
  73. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  74. endif
  75. # --------------------------------------------------------------
  76. # Strict test build
  77. ifeq ($(TESTBUILD),true)
  78. BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
  79. ifneq ($(CC),clang)
  80. BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
  81. endif
  82. ifneq ($(MACOS),true)
  83. BASE_FLAGS += -Wmissing-declarations -Wsign-conversion
  84. ifneq ($(CC),clang)
  85. BASE_FLAGS += -Wlogical-op
  86. endif
  87. endif
  88. CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
  89. CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual
  90. ifeq ($(LINUX),true)
  91. CFLAGS += -isystem /opt/kxstudio/include
  92. CXXFLAGS += -isystem /opt/kxstudio/include -isystem /usr/include/qt4
  93. endif
  94. ifeq ($(MACOS),true)
  95. CFLAGS += -isystem /opt/local/include/
  96. CXXFLAGS += -isystem /opt/local/include/
  97. endif
  98. ifeq ($(WIN32),true)
  99. CFLAGS += -isystem /opt/mingw32/include
  100. CXXFLAGS += -isystem /opt/mingw32/include -isystem /opt/mingw32/include/qt4
  101. endif
  102. endif
  103. # --------------------------------------------------------------
  104. # Check for qt, set default version (prefer qt4)
  105. ifneq ($(MACOS),true)
  106. HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui QtXml && echo true)
  107. endif
  108. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Xml Qt5Widgets && echo true)
  109. ifeq ($(HAVE_QT5),true)
  110. DEFAULT_QT=5
  111. endif
  112. ifeq ($(HAVE_QT4),true)
  113. DEFAULT_QT=4
  114. endif
  115. # --------------------------------------------------------------
  116. # Check for required libs
  117. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  118. $(error liblo missing, cannot continue)
  119. endif
  120. ifneq ($(HAVE_QT4),true)
  121. ifneq ($(HAVE_QT5),true)
  122. $(error Qt missing, cannot continue)
  123. endif
  124. endif
  125. # --------------------------------------------------------------
  126. # Check for dgl support
  127. ifeq ($(HAIKU),true)
  128. HAVE_DGL = false
  129. endif
  130. ifeq ($(LINUX),true)
  131. HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
  132. endif
  133. ifeq ($(MACOS),true)
  134. HAVE_DGL = true
  135. endif
  136. ifeq ($(WIN32),true)
  137. HAVE_DGL = true
  138. endif
  139. # --------------------------------------------------------------
  140. # Check for juce support
  141. ifeq ($(HAIKU),true)
  142. HAVE_JUCE = false
  143. endif
  144. ifeq ($(LINUX),true)
  145. HAVE_JUCE = $(shell pkg-config --exists x11 xinerama xext xcursor freetype2 && echo true)
  146. endif
  147. ifeq ($(MACOS),true)
  148. HAVE_JUCE = true
  149. endif
  150. ifeq ($(WIN32),true)
  151. HAVE_JUCE = true
  152. endif
  153. # --------------------------------------------------------------
  154. # Check for optional libs (required by backend or bridges)
  155. HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && echo true)
  156. HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
  157. HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
  158. HAVE_WAYLAND = $(shell pkg-config --exists wayland-client && echo true)
  159. HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
  160. ifeq ($(LINUX),true)
  161. HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
  162. HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
  163. endif
  164. ifeq ($(CARLA_CSOUND_SUPPORT),true)
  165. ifeq ($(HAVE_JUCE),true)
  166. HAVE_CSOUND = $(shell pkg-config --exists sndfile && echo true)
  167. endif
  168. endif
  169. ifeq ($(CARLA_SAMPLERS_SUPPORT),true)
  170. HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
  171. HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true)
  172. endif
  173. # --------------------------------------------------------------
  174. # Check for optional libs (required by internal plugins)
  175. HAVE_AF_DEPS = $(shell pkg-config --exists sndfile && echo true)
  176. HAVE_MF_DEPS = $(shell pkg-config --exists smf && echo true)
  177. HAVE_PM_DEPS = $(shell pkg-config --exists libprojectM && echo true)
  178. HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
  179. HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk_images ntk && echo true)
  180. # --------------------------------------------------------------
  181. # Force some features on MacOS and Windows
  182. ifeq ($(MACOS_OR_WIN32),true)
  183. CARLA_VESTIGE_HEADER = false
  184. HAVE_WAYLAND = false
  185. HAVE_X11 = false
  186. endif
  187. # --------------------------------------------------------------
  188. # Set base defines
  189. ifeq ($(HAVE_DGL),true)
  190. BASE_FLAGS += -DHAVE_DGL
  191. endif
  192. ifeq ($(HAVE_FFMPEG),true)
  193. BASE_FLAGS += -DHAVE_FFMPEG
  194. endif
  195. ifeq ($(HAVE_JUCE),true)
  196. BASE_FLAGS += -DHAVE_JUCE
  197. endif
  198. ifeq ($(HAVE_WAYLAND),true)
  199. BASE_FLAGS += -DHAVE_WAYLAND
  200. endif
  201. ifeq ($(HAVE_X11),true)
  202. BASE_FLAGS += -DHAVE_X11
  203. endif
  204. # --------------------------------------------------------------
  205. # Set libs stuff (part 1)
  206. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  207. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  208. ifeq ($(DEFAULT_QT),5)
  209. QTCORE_FLAGS = $(shell pkg-config --cflags Qt5Core)
  210. QTCORE_LIBS = $(shell pkg-config --libs Qt5Core)
  211. QTXML_FLAGS = $(shell pkg-config --cflags Qt5Xml)
  212. QTXML_LIBS = $(shell pkg-config --libs Qt5Xml)
  213. else
  214. QTCORE_FLAGS = $(shell pkg-config --cflags QtCore)
  215. QTCORE_LIBS = $(shell pkg-config --libs QtCore)
  216. QTXML_FLAGS = $(shell pkg-config --cflags QtXml)
  217. QTXML_LIBS = $(shell pkg-config --libs QtXml)
  218. endif
  219. ifeq ($(HAVE_CSOUND),true)
  220. CSOUND_FLAGS = -DUSE_DOUBLE=1
  221. CSOUND_LIBS = $(shell pkg-config --libs sndfile) -lcsound64
  222. endif
  223. ifeq ($(HAVE_FLUIDSYNTH),true)
  224. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  225. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  226. endif
  227. ifeq ($(HAVE_LINUXSAMPLER),true)
  228. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -Wno-unused-parameter
  229. LINUXSAMPLER_LIBS = $(shell pkg-config --libs linuxsampler)
  230. endif
  231. ifeq ($(HAVE_WAYLAND),true)
  232. WAYLAND_FLAGS = $(shell pkg-config --cflags wayland-client)
  233. WAYLAND_LIBS = $(shell pkg-config --libs wayland-client)
  234. endif
  235. ifeq ($(HAVE_X11),true)
  236. X11_FLAGS = $(shell pkg-config --cflags x11)
  237. X11_LIBS = $(shell pkg-config --libs x11)
  238. endif
  239. # --------------------------------------------------------------
  240. # Set libs stuff (part 2)
  241. ifeq ($(HAVE_AF_DEPS),true)
  242. AUDIO_DECODER_FLAGS = $(shell pkg-config --cflags sndfile)
  243. AUDIO_DECODER_LIBS = $(shell pkg-config --libs sndfile)
  244. ifeq ($(HAVE_FFMPEG),true)
  245. AUDIO_DECODER_FLAGS += $(shell pkg-config --cflags libavcodec libavformat libavutil)
  246. AUDIO_DECODER_LIBS += $(shell pkg-config --libs libavcodec libavformat libavutil)
  247. endif
  248. endif
  249. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  250. ifeq ($(DEBUG),true)
  251. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  252. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  253. endif
  254. ifneq ($(HAIKU),true)
  255. RTMEMPOOL_LIBS = -lpthread
  256. endif
  257. ifeq ($(LINUX),true)
  258. ifeq ($(HAVE_DGL),true)
  259. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  260. DGL_LIBS = $(shell pkg-config --libs gl x11)
  261. endif
  262. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  263. ifeq ($(HAVE_JUCE),true)
  264. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  265. JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
  266. JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
  267. JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
  268. JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
  269. JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
  270. JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
  271. endif
  272. LILV_LIBS = -ldl -lm -lrt
  273. ifeq ($(HAVE_ALSA),true)
  274. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  275. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  276. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  277. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  278. endif
  279. ifeq ($(HAVE_PULSEAUDIO),true)
  280. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  281. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  282. endif
  283. endif
  284. ifeq ($(MACOS),true)
  285. DGL_LIBS = -framework OpenGL -framework Cocoa
  286. JACKBRIDGE_LIBS = -ldl -lpthread
  287. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  288. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  289. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  290. JUCE_AUDIO_PROCESSORS_LIBS = -framework Cocoa -framework Carbon
  291. JUCE_CORE_LIBS = -framework AppKit
  292. JUCE_EVENTS_LIBS = -framework AppKit
  293. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  294. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  295. JUCE_GUI_EXTRA_LIBS = -framework Cocoa -framework IOKit
  296. LILV_LIBS = -ldl -lm
  297. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  298. RTAUDIO_LIBS += -framework CoreAudio -framework CoreFoundation -lpthread
  299. RTMIDI_FLAGS += -D__MACOSX_CORE__
  300. RTMIDI_LIBS += -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
  301. endif
  302. ifeq ($(WIN32),true)
  303. DGL_LIBS = -lopengl32 -lgdi32
  304. JACKBRIDGE_LIBS = -lpthread
  305. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  306. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  307. # JUCE_EVENTS_LIBS = -lole32
  308. JUCE_GRAPHICS_LIBS = -lgdi32
  309. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  310. LILV_LIBS = -lm
  311. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__
  312. RTAUDIO_LIBS += -ldsound -lpthread
  313. RTMIDI_FLAGS += -D__WINDOWS_MM__
  314. endif
  315. # --------------------------------------------------------------
  316. # Set libs stuff (part 3)
  317. ifeq ($(HAVE_DGL),true)
  318. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  319. endif
  320. ifeq ($(HAVE_AF_DEPS),true)
  321. NATIVE_PLUGINS_FLAGS += -DWANT_AUDIOFILE
  322. NATIVE_PLUGINS_LIBS += $(AUDIO_DECODER_LIBS)
  323. endif
  324. ifeq ($(HAVE_MF_DEPS),true)
  325. NATIVE_PLUGINS_FLAGS += -DWANT_MIDIFILE
  326. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs smf)
  327. endif
  328. ifeq ($(HAVE_PM_DEPS),true)
  329. NATIVE_PLUGINS_FLAGS += -DWANT_PROJECTM
  330. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs libprojectM)
  331. endif
  332. ifeq ($(HAVE_ZYN_DEPS),true)
  333. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX
  334. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3 mxml zlib)
  335. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  336. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX_UI
  337. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs ntk_images ntk)
  338. endif
  339. endif
  340. # --------------------------------------------------------------
  341. # Set Qt tools
  342. ifeq ($(HAVE_QT4),true)
  343. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  344. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  345. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  346. endif
  347. ifeq ($(HAVE_QT5),true)
  348. QT5_LIBDIR = $(shell pkg-config --variable=libdir Qt5Core)
  349. ifneq (,$(wildcard $(QT5_LIBDIR)/qt5/bin/moc))
  350. MOC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/moc
  351. RCC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/rcc
  352. UIC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/uic
  353. else
  354. ifeq ($(MACOS),true)
  355. MOC_QT5 ?= $(QT5_LIBDIR)/../bin/moc
  356. RCC_QT5 ?= $(QT5_LIBDIR)/../bin/rcc
  357. UIC_QT5 ?= $(QT5_LIBDIR)/../bin/uic
  358. else
  359. MOC_QT5 ?= $(QT5_LIBDIR)/qt/bin/moc
  360. RCC_QT5 ?= $(QT5_LIBDIR)/qt/bin/rcc
  361. UIC_QT5 ?= $(QT5_LIBDIR)/qt/bin/uic
  362. endif
  363. endif
  364. endif
  365. # --------------------------------------------------------------