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
11 years ago
11 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
10 years ago
10 years ago
11 years ago
11 years ago
10 years ago
10 years ago
11 years ago
10 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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/kxstudio/include
  96. CXXFLAGS += -isystem /opt/kxstudio/include -isystem /opt/kxstudio/include/qt5
  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. HAVE_QT4 = $(shell pkg-config --exists QtCore QtXml && echo true)
  106. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Xml && echo true)
  107. ifeq ($(HAVE_QT5),true)
  108. DEFAULT_QT=5
  109. endif
  110. ifeq ($(HAVE_QT4),true)
  111. DEFAULT_QT=4
  112. endif
  113. # --------------------------------------------------------------
  114. # Check for required libs
  115. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  116. $(error liblo missing, cannot continue)
  117. endif
  118. ifneq ($(HAVE_QT4),true)
  119. ifneq ($(HAVE_QT5),true)
  120. $(error Qt missing, cannot continue)
  121. endif
  122. endif
  123. # --------------------------------------------------------------
  124. # Check for dgl support
  125. ifeq ($(HAIKU),true)
  126. HAVE_DGL = false
  127. endif
  128. ifeq ($(LINUX),true)
  129. HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
  130. endif
  131. ifeq ($(MACOS),true)
  132. HAVE_DGL = true
  133. endif
  134. ifeq ($(WIN32),true)
  135. HAVE_DGL = true
  136. endif
  137. # --------------------------------------------------------------
  138. # Check for juce support
  139. ifeq ($(HAIKU),true)
  140. HAVE_JUCE = false
  141. endif
  142. ifeq ($(LINUX),true)
  143. HAVE_JUCE = $(shell pkg-config --exists x11 xinerama xext xcursor freetype2 && echo true)
  144. endif
  145. ifeq ($(MACOS),true)
  146. HAVE_JUCE = true
  147. endif
  148. ifeq ($(WIN32),true)
  149. HAVE_JUCE = true
  150. endif
  151. # --------------------------------------------------------------
  152. # Check for optional libs (required by backend or bridges)
  153. ifneq ($(MACOS_OR_WIN32),true)
  154. HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && echo true)
  155. HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
  156. HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
  157. HAVE_WAYLAND = $(shell pkg-config --exists wayland-client && echo true)
  158. HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
  159. endif
  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. endif
  185. # --------------------------------------------------------------
  186. # Set base defines
  187. ifeq ($(HAVE_DGL),true)
  188. BASE_FLAGS += -DHAVE_DGL
  189. endif
  190. ifeq ($(HAVE_FFMPEG),true)
  191. BASE_FLAGS += -DHAVE_FFMPEG
  192. endif
  193. ifeq ($(HAVE_JUCE),true)
  194. BASE_FLAGS += -DHAVE_JUCE
  195. endif
  196. ifeq ($(HAVE_WAYLAND),true)
  197. BASE_FLAGS += -DHAVE_WAYLAND
  198. endif
  199. ifeq ($(HAVE_X11),true)
  200. BASE_FLAGS += -DHAVE_X11
  201. endif
  202. # --------------------------------------------------------------
  203. # Set libs stuff (part 1)
  204. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  205. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  206. ifeq ($(DEFAULT_QT),5)
  207. QTCORE_FLAGS = $(shell pkg-config --cflags Qt5Core)
  208. QTCORE_LIBS = $(shell pkg-config --libs Qt5Core)
  209. QTXML_FLAGS = $(shell pkg-config --cflags Qt5Xml)
  210. QTXML_LIBS = $(shell pkg-config --libs Qt5Xml)
  211. else
  212. QTCORE_FLAGS = $(shell pkg-config --cflags QtCore)
  213. QTCORE_LIBS = $(shell pkg-config --libs QtCore)
  214. QTXML_FLAGS = $(shell pkg-config --cflags QtXml)
  215. QTXML_LIBS = $(shell pkg-config --libs QtXml)
  216. endif
  217. ifeq ($(HAVE_CSOUND),true)
  218. CSOUND_FLAGS = -DUSE_DOUBLE=1
  219. CSOUND_LIBS = $(shell pkg-config --libs sndfile) -lcsound64
  220. endif
  221. ifeq ($(HAVE_FLUIDSYNTH),true)
  222. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  223. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  224. endif
  225. ifeq ($(HAVE_LINUXSAMPLER),true)
  226. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -Wno-unused-parameter
  227. LINUXSAMPLER_LIBS = $(shell pkg-config --libs linuxsampler)
  228. endif
  229. ifeq ($(HAVE_WAYLAND),true)
  230. WAYLAND_FLAGS = $(shell pkg-config --cflags wayland-client)
  231. WAYLAND_LIBS = $(shell pkg-config --libs wayland-client)
  232. endif
  233. ifeq ($(HAVE_X11),true)
  234. X11_FLAGS = $(shell pkg-config --cflags x11)
  235. X11_LIBS = $(shell pkg-config --libs x11)
  236. endif
  237. # --------------------------------------------------------------
  238. # Set libs stuff (part 2)
  239. ifeq ($(HAVE_AF_DEPS),true)
  240. AUDIO_DECODER_FLAGS = $(shell pkg-config --cflags sndfile)
  241. AUDIO_DECODER_LIBS = $(shell pkg-config --libs sndfile)
  242. ifeq ($(HAVE_FFMPEG),true)
  243. AUDIO_DECODER_FLAGS += $(shell pkg-config --cflags libavcodec libavformat libavutil)
  244. AUDIO_DECODER_LIBS += $(shell pkg-config --libs libavcodec libavformat libavutil)
  245. endif
  246. endif
  247. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  248. ifeq ($(DEBUG),true)
  249. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  250. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  251. endif
  252. ifneq ($(HAIKU),true)
  253. RTMEMPOOL_LIBS = -lpthread
  254. endif
  255. ifeq ($(LINUX),true)
  256. ifeq ($(HAVE_DGL),true)
  257. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  258. DGL_LIBS = $(shell pkg-config --libs gl x11)
  259. endif
  260. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  261. ifeq ($(HAVE_JUCE),true)
  262. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  263. JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
  264. JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
  265. JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
  266. JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
  267. JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
  268. JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
  269. endif
  270. LILV_LIBS = -ldl -lm -lrt
  271. ifeq ($(HAVE_ALSA),true)
  272. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  273. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  274. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  275. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  276. endif
  277. ifeq ($(HAVE_PULSEAUDIO),true)
  278. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  279. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  280. endif
  281. endif
  282. ifeq ($(MACOS),true)
  283. DGL_LIBS = -framework OpenGL -framework Cocoa
  284. JACKBRIDGE_LIBS = -ldl -lpthread
  285. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  286. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  287. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  288. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  289. JUCE_CORE_LIBS = -framework AppKit
  290. JUCE_EVENTS_LIBS = -framework AppKit
  291. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  292. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  293. JUCE_GUI_EXTRA_LIBS = -framework Cocoa -framework IOKit
  294. LILV_LIBS = -ldl -lm
  295. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  296. RTAUDIO_LIBS += -framework CoreAudio -framework CoreFoundation -lpthread
  297. RTMIDI_FLAGS += -D__MACOSX_CORE__
  298. RTMIDI_LIBS += -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
  299. endif
  300. ifeq ($(WIN32),true)
  301. DGL_LIBS = -lopengl32 -lgdi32
  302. JACKBRIDGE_LIBS = -lpthread
  303. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  304. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  305. # JUCE_EVENTS_LIBS = -lole32
  306. JUCE_GRAPHICS_LIBS = -lgdi32
  307. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  308. LILV_LIBS = -lm
  309. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__
  310. RTAUDIO_LIBS += -ldsound -lpthread
  311. RTMIDI_FLAGS += -D__WINDOWS_MM__
  312. endif
  313. # --------------------------------------------------------------
  314. # Set libs stuff (part 3)
  315. ifeq ($(HAVE_DGL),true)
  316. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  317. endif
  318. ifeq ($(HAVE_AF_DEPS),true)
  319. NATIVE_PLUGINS_FLAGS += -DWANT_AUDIOFILE
  320. NATIVE_PLUGINS_LIBS += $(AUDIO_DECODER_LIBS)
  321. endif
  322. ifeq ($(HAVE_MF_DEPS),true)
  323. NATIVE_PLUGINS_FLAGS += -DWANT_MIDIFILE
  324. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs smf)
  325. endif
  326. ifeq ($(HAVE_PM_DEPS),true)
  327. NATIVE_PLUGINS_FLAGS += -DWANT_PROJECTM
  328. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs libprojectM)
  329. endif
  330. ifeq ($(HAVE_ZYN_DEPS),true)
  331. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX
  332. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3 mxml zlib)
  333. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  334. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX_UI
  335. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs ntk_images ntk)
  336. endif
  337. endif
  338. # --------------------------------------------------------------
  339. # Set Qt tools
  340. ifeq ($(HAVE_QT4),true)
  341. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  342. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  343. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  344. endif
  345. ifeq ($(HAVE_QT5),true)
  346. QT5_LIBDIR = $(shell pkg-config --variable=libdir Qt5Core)
  347. ifneq (,$(wildcard $(QT5_LIBDIR)/qt5/bin/moc))
  348. MOC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/moc
  349. RCC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/rcc
  350. UIC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/uic
  351. else
  352. ifeq ($(MACOS),true)
  353. MOC_QT5 ?= $(QT5_LIBDIR)/../bin/moc
  354. RCC_QT5 ?= $(QT5_LIBDIR)/../bin/rcc
  355. UIC_QT5 ?= $(QT5_LIBDIR)/../bin/uic
  356. else
  357. MOC_QT5 ?= $(QT5_LIBDIR)/qt/bin/moc
  358. RCC_QT5 ?= $(QT5_LIBDIR)/qt/bin/rcc
  359. UIC_QT5 ?= $(QT5_LIBDIR)/qt/bin/uic
  360. endif
  361. endif
  362. endif
  363. # --------------------------------------------------------------