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.

250 lines
8.3KB

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