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.

239 lines
8.0KB

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