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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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 -Wformat-security -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 && 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. ifeq ($(HAVE_X11),true)
  165. BASE_FLAGS += -DHAVE_X11
  166. endif
  167. # --------------------------------------------------------------
  168. # Set libs stuff (part 1)
  169. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  170. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  171. QTCORE_FLAGS = $(shell pkg-config --cflags QtCore)
  172. QTCORE_LIBS = $(shell pkg-config --libs QtCore)
  173. QTXML_FLAGS = $(shell pkg-config --cflags QtXml)
  174. QTXML_LIBS = $(shell pkg-config --libs QtXml)
  175. ifeq ($(HAVE_CSOUND),true)
  176. CSOUND_FLAGS = $(shell pkg-config --cflags sndfile) -DUSE_DOUBLE=1
  177. CSOUND_LIBS = $(shell pkg-config --libs sndfile) -lcsound64
  178. endif
  179. ifeq ($(HAVE_FLUIDSYNTH),true)
  180. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  181. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  182. endif
  183. ifeq ($(HAVE_LINUXSAMPLER),true)
  184. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -Wno-unused-parameter
  185. LINUXSAMPLER_LIBS = $(shell pkg-config --libs linuxsampler)
  186. endif
  187. ifneq ($(HAIKU),true)
  188. RTMEMPOOL_LIBS = -lpthread
  189. endif
  190. # --------------------------------------------------------------
  191. # Set libs stuff (part 2)
  192. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  193. ifeq ($(DEBUG),true)
  194. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  195. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  196. endif
  197. ifeq ($(LINUX),true)
  198. ifeq ($(HAVE_DGL),true)
  199. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  200. DGL_LIBS = $(shell pkg-config --libs gl x11)
  201. endif
  202. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  203. ifeq ($(HAVE_JUCE),true)
  204. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  205. JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
  206. JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
  207. JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
  208. JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
  209. JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
  210. JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
  211. endif
  212. LILV_LIBS = -ldl -lm -lrt
  213. ifeq ($(HAVE_ALSA),true)
  214. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  215. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  216. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSASEQ__
  217. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  218. endif
  219. ifeq ($(HAVE_PULSEAUDIO),true)
  220. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  221. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  222. endif
  223. endif
  224. ifeq ($(MACOS),true)
  225. DGL_LIBS = -framework OpenGL -framework Cocoa
  226. JACKBRIDGE_LIBS = -ldl -lpthread
  227. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  228. JUCE_AUDIO_DEVICES_LIBS = -framework AudioToolbox -framework CoreAudio -framework CoreMIDI -framework DiscRecording
  229. JUCE_AUDIO_FORMATS_LIBS = -framework CoreAudio -framework CoreMIDI -framework QuartzCore -framework AudioToolbox
  230. JUCE_CORE_LIBS = -framework Cocoa -framework IOKit
  231. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  232. JUCE_GUI_BASICS_LIBS = -framework Cocoa -framework Carbon -framework QuartzCore
  233. LILV_LIBS = -ldl -lm
  234. RTAUDIO_FLAGS += -D__MACOSX_CORE__
  235. RTAUDIO_LIBS += -lpthread
  236. RTMIDI_FLAGS += -D__MACOSX_CORE__
  237. endif
  238. ifeq ($(WIN32),true)
  239. DGL_LIBS = -lopengl32 -lgdi32
  240. JACKBRIDGE_LIBS = -lpthread
  241. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  242. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  243. JUCE_EVENTS_LIBS = -lole32
  244. JUCE_GRAPHICS_LIBS = -lgdi32
  245. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  246. LILV_LIBS = -lm
  247. RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__
  248. RTAUDIO_LIBS += -ldsound -lpthread
  249. RTMIDI_FLAGS += -D__WINDOWS_MM__
  250. endif
  251. # --------------------------------------------------------------
  252. # Set Qt tools
  253. ifeq ($(HAVE_QT4),true)
  254. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  255. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  256. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  257. endif
  258. ifeq ($(HAVE_QT5),true)
  259. MOC_QT5 ?= $(shell pkg-config --variable=libdir Qt5Core)/qt5/bin/moc
  260. RCC_QT5 ?= $(shell pkg-config --variable=libdir Qt5Core)/qt5/bin/rcc
  261. UIC_QT5 ?= $(shell pkg-config --variable=libdir Qt5Core)/qt5/bin/uic
  262. endif
  263. # --------------------------------------------------------------