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.

212 lines
7.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 -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. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  66. $(error liblo missing, cannot continue)
  67. endif
  68. ifeq ($(LINUX),true)
  69. ifneq ($(shell pkg-config --exists x11 && echo true),true)
  70. $(error X11 missing, cannot continue)
  71. endif
  72. ifneq ($(shell pkg-config --exists xinerama && echo true),true)
  73. $(error Xinerama missing, cannot continue)
  74. endif
  75. ifneq ($(shell pkg-config --exists xext && echo true),true)
  76. $(error Xext missing, cannot continue)
  77. endif
  78. ifneq ($(shell pkg-config --exists xcursor && echo true),true)
  79. $(error Xcursor missing, cannot continue)
  80. endif
  81. ifneq ($(shell pkg-config --exists freetype2 && echo true),true)
  82. $(error FreeType2 missing, cannot continue)
  83. endif
  84. endif
  85. # --------------------------------------------------------------
  86. # Check for optional libs (required by backend or bridges)
  87. HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && pkg-config --max-version=1.9 libavcodec && echo true)
  88. ifeq ($(LINUX),true)
  89. HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
  90. HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
  91. HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
  92. HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
  93. HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true)
  94. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true)
  95. HAVE_OPENGL = $(shell pkg-config --exists gl && echo true)
  96. else
  97. HAVE_OPENGL = true
  98. endif
  99. ifeq ($(CARLA_SAMPLERS_SUPPORT),true)
  100. HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
  101. HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true)
  102. endif
  103. # --------------------------------------------------------------
  104. # Check for optional libs (needed by internal plugins)
  105. HAVE_AF_DEPS = $(shell pkg-config --exists sndfile && echo true)
  106. HAVE_MF_DEPS = $(shell pkg-config --exists smf && echo true)
  107. HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
  108. HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk ntk_images && echo true)
  109. # --------------------------------------------------------------
  110. # Set libs stuff
  111. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  112. ifeq ($(DEBUG),true)
  113. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  114. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  115. endif
  116. RTMEMPOOL_LIBS = -lpthread
  117. ifeq ($(LINUX),true)
  118. ifeq ($(HAVE_OPENGL),true)
  119. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  120. DGL_LIBS = $(shell pkg-config --libs gl x11)
  121. endif
  122. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  123. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  124. JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
  125. JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
  126. JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
  127. JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
  128. JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
  129. JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
  130. LILV_LIBS = -ldl -lm -lrt
  131. ifeq ($(HAVE_ALSA),true)
  132. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  133. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  134. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSASEQ__
  135. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  136. endif
  137. ifeq ($(HAVE_PULSEAUDIO),true)
  138. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  139. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  140. endif
  141. endif
  142. ifeq ($(MACOS),true)
  143. DGL_LIBS = -framework OpenGL -framework Cocoa
  144. JACKBRIDGE_LIBS = -ldl -lpthread
  145. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  146. JUCE_AUDIO_DEVICES_LIBS = -framework CoreAudio -framework CoreMIDI -framework DiscRecording
  147. JUCE_AUDIO_FORMATS_LIBS = -framework CoreAudio -framework CoreMIDI -framework QuartzCore -framework AudioToolbox
  148. JUCE_CORE_LIBS = -framework Cocoa -framework IOKit
  149. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  150. JUCE_GUI_BASICS_LIBS = -framework Cocoa -framework Carbon -framework QuartzCore
  151. LILV_LIBS = -ldl -lm
  152. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  153. RTAUDIO_LIBS += -lpthread
  154. RTMIDI_FLAGS += -D__MACOSX_CORE__
  155. endif
  156. ifeq ($(WIN32),true)
  157. DGL_LIBS = -lopengl32 -lgdi32
  158. JACKBRIDGE_LIBS = -lpthread
  159. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  160. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  161. JUCE_EVENTS_LIBS = -lole32
  162. JUCE_GRAPHICS_LIBS = -lgdi32
  163. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  164. LILV_LIBS = -lm
  165. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__
  166. RTAUDIO_LIBS += -lpthread
  167. RTMIDI_FLAGS += -D__WINDOWS_MM__
  168. endif
  169. # --------------------------------------------------------------
  170. # Set Qt4 tools
  171. ifeq ($(HAVE_QT4),true)
  172. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  173. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  174. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  175. endif
  176. # --------------------------------------------------------------