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.

Makefile.mk 10KB

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