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.

317 lines
10KB

  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. # Common build and link flags
  33. BASE_FLAGS = -Wall -Wextra -Wcast-qual -Wconversion -pipe -DREAL_BUILD
  34. BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
  35. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections
  36. ifeq ($(TESTBUILD),true)
  37. # TODO: check which ones are valid on OSX
  38. BASE_FLAGS += -Wcast-align -Wredundant-decls -Wshadow
  39. BASE_FLAGS += -Wmissing-declarations -Wstrict-overflow -Wundef -Wwrite-strings -fstrict-overflow -Wsuggest-attribute=noreturn -Wunsafe-loop-optimizations
  40. BASE_FLAGS += -Werror
  41. CFLAGS += -isystem /opt/kxstudio/include
  42. CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
  43. CXXFLAGS += -isystem /opt/kxstudio/include
  44. CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual
  45. endif
  46. # -Wcast-align -Wredundant-decls -Wshadow -Wstrict-prototypes -Wmissing-prototypes
  47. # -Wmissing-declarations -Wstrict-overflow -Wundef -Wwrite-strings -fstrict-overflow -Wsuggest-attribute=noreturn -Wunsafe-loop-optimizations
  48. # -Wnon-virtual-dtor -Woverloaded-virtual
  49. # -Werror
  50. # -Waggregate-return -Wsign-conversion
  51. ifneq ($(MACOS),true)
  52. BASE_FLAGS += -Wlogical-op
  53. endif
  54. ifneq ($(WIN32),true)
  55. BASE_FLAGS += -fPIC -DPIC
  56. endif
  57. ifeq ($(RASPPI),true)
  58. # Raspberry-Pi optimization flags
  59. BASE_OPTS = -O3 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
  60. LINK_OPTS =
  61. endif
  62. ifeq ($(DEBUG),true)
  63. BASE_FLAGS += -DDEBUG -O0 -g
  64. LINK_OPTS =
  65. else
  66. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  67. CXXFLAGS += -fvisibility-inlines-hidden
  68. LINK_OPTS += -Wl,-O1 -Wl,--strip-all
  69. endif
  70. 32BIT_FLAGS = -m32
  71. 64BIT_FLAGS = -m64
  72. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  73. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
  74. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  75. ifeq ($(MACOS),true)
  76. # No C++11 support; force 32bit per default
  77. BUILD_C_FLAGS += $(32BIT_FLAGS)
  78. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(32BIT_FLAGS) $(CXXFLAGS)
  79. LINK_FLAGS = $(32BIT_FLAGS) $(LDFLAGS)
  80. endif
  81. # --------------------------------------------------------------
  82. # Check for required libs
  83. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  84. $(error liblo missing, cannot continue)
  85. endif
  86. ifneq ($(shell pkg-config --exists QtCore && echo true),true)
  87. $(error QtCore missing, cannot continue)
  88. endif
  89. ifneq ($(shell pkg-config --exists QtXml && echo true),true)
  90. $(error QtXml missing, cannot continue)
  91. endif
  92. # --------------------------------------------------------------
  93. # Check for optional libs (required by backend or bridges)
  94. HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && pkg-config --max-version=1.9 libavcodec && echo true)
  95. HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
  96. HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
  97. HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true)
  98. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true)
  99. HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
  100. ifeq ($(LINUX),true)
  101. HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
  102. HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
  103. endif
  104. ifeq ($(CARLA_CSOUND_SUPPORT),true)
  105. # FIXME ?
  106. HAVE_CSOUND = $(shell pkg-config --exists sndfile && echo true)
  107. endif
  108. ifeq ($(CARLA_SAMPLERS_SUPPORT),true)
  109. HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
  110. HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true)
  111. endif
  112. # --------------------------------------------------------------
  113. # Check for optional libs (needed by internal plugins)
  114. HAVE_AF_DEPS = $(shell pkg-config --exists sndfile && echo true)
  115. HAVE_MF_DEPS = $(shell pkg-config --exists smf && echo true)
  116. HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
  117. HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk_images ntk && echo true)
  118. # --------------------------------------------------------------
  119. # Check for dgl support
  120. ifeq ($(HAIKU),true)
  121. HAVE_DGL = false
  122. endif
  123. ifeq ($(LINUX),true)
  124. HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
  125. endif
  126. ifeq ($(MACOS),true)
  127. HAVE_DGL = true
  128. endif
  129. ifeq ($(WIN32),true)
  130. HAVE_DGL = true
  131. endif
  132. # --------------------------------------------------------------
  133. # Check for juce support
  134. ifeq ($(HAIKU),true)
  135. HAVE_JUCE = false
  136. endif
  137. ifeq ($(LINUX),true)
  138. HAVE_JUCE = $(shell pkg-config --exists x11 xinerama xext xcursor freetype2 && echo true)
  139. endif
  140. ifeq ($(MACOS),true)
  141. HAVE_JUCE = true
  142. endif
  143. ifeq ($(WIN32),true)
  144. HAVE_JUCE = true
  145. endif
  146. # --------------------------------------------------------------
  147. # Set base stuff
  148. ifeq ($(HAVE_DGL),true)
  149. BASE_FLAGS += -DHAVE_DGL
  150. endif
  151. ifeq ($(HAVE_FFMPEG),true)
  152. BASE_FLAGS += -DHAVE_FFMPEG
  153. endif
  154. ifeq ($(HAVE_JUCE),true)
  155. BASE_FLAGS += -DHAVE_JUCE
  156. endif
  157. # --------------------------------------------------------------
  158. # Set libs stuff (part 1)
  159. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  160. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  161. QTCORE_FLAGS = $(shell pkg-config --cflags QtCore)
  162. QTCORE_LIBS = $(shell pkg-config --libs QtCore)
  163. QTXML_FLAGS = $(shell pkg-config --cflags QtXml)
  164. QTXML_LIBS = $(shell pkg-config --libs QtXml)
  165. ifeq ($(HAVE_CSOUND),true)
  166. CSOUND_FLAGS = $(shell pkg-config --cflags sndfile) -DUSE_DOUBLE=1
  167. CSOUND_LIBS = $(shell pkg-config --libs sndfile) -lcsound64
  168. endif
  169. ifeq ($(HAVE_FLUIDSYNTH),true)
  170. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  171. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  172. endif
  173. ifeq ($(HAVE_LINUXSAMPLER),true)
  174. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -Wno-unused-parameter
  175. LINUXSAMPLER_LIBS = $(shell pkg-config --libs linuxsampler)
  176. endif
  177. ifneq ($(HAIKU),true)
  178. RTMEMPOOL_LIBS = -lpthread
  179. endif
  180. # --------------------------------------------------------------
  181. # Set libs stuff (part 2)
  182. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  183. ifeq ($(DEBUG),true)
  184. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  185. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  186. endif
  187. ifeq ($(LINUX),true)
  188. ifeq ($(HAVE_DGL),true)
  189. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  190. DGL_LIBS = $(shell pkg-config --libs gl x11)
  191. endif
  192. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  193. ifeq ($(HAVE_JUCE),true)
  194. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  195. JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
  196. JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
  197. JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
  198. JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
  199. JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
  200. JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
  201. endif
  202. LILV_LIBS = -ldl -lm -lrt
  203. ifeq ($(HAVE_ALSA),true)
  204. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  205. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  206. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSASEQ__
  207. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  208. endif
  209. ifeq ($(HAVE_PULSEAUDIO),true)
  210. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  211. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  212. endif
  213. endif
  214. ifeq ($(MACOS),true)
  215. DGL_LIBS = -framework OpenGL -framework Cocoa
  216. JACKBRIDGE_LIBS = -ldl -lpthread
  217. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  218. JUCE_AUDIO_DEVICES_LIBS = -framework AudioToolbox -framework CoreAudio -framework CoreMIDI -framework DiscRecording
  219. JUCE_AUDIO_FORMATS_LIBS = -framework CoreAudio -framework CoreMIDI -framework QuartzCore -framework AudioToolbox
  220. JUCE_CORE_LIBS = -framework Cocoa -framework IOKit
  221. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  222. JUCE_GUI_BASICS_LIBS = -framework Cocoa -framework Carbon -framework QuartzCore
  223. LILV_LIBS = -ldl -lm
  224. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  225. RTAUDIO_LIBS += -lpthread
  226. RTMIDI_FLAGS += -D__MACOSX_CORE__
  227. endif
  228. ifeq ($(WIN32),true)
  229. DGL_LIBS = -lopengl32 -lgdi32
  230. JACKBRIDGE_LIBS = -lpthread
  231. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  232. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  233. JUCE_EVENTS_LIBS = -lole32
  234. JUCE_GRAPHICS_LIBS = -lgdi32
  235. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  236. LILV_LIBS = -lm
  237. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__
  238. RTAUDIO_LIBS += -ldsound -lpthread
  239. RTMIDI_FLAGS += -D__WINDOWS_MM__
  240. endif
  241. # --------------------------------------------------------------
  242. # Set Qt tools
  243. ifeq ($(HAVE_QT4),true)
  244. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  245. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  246. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  247. endif
  248. ifeq ($(HAVE_QT5),true)
  249. MOC_QT5 ?= $(shell pkg-config --variable=libdir Qt5Core)/qt5/bin/moc
  250. RCC_QT5 ?= $(shell pkg-config --variable=libdir Qt5Core)/qt5/bin/rcc
  251. UIC_QT5 ?= $(shell pkg-config --variable=libdir Qt5Core)/qt5/bin/uic
  252. endif
  253. # --------------------------------------------------------------