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.

285 lines
9.4KB

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