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
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 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
11 years ago
10 years ago
10 years ago
11 years ago
11 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
11 years ago
11 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. # Use the free vestige header instead of the official VST SDK
  9. CARLA_VESTIGE_HEADER = true
  10. # --------------------------------------------------------------
  11. # DO NOT MODIFY PAST THIS POINT!
  12. AR ?= ar
  13. RM ?= rm -f
  14. CC ?= gcc
  15. CXX ?= g++
  16. # --------------------------------------------------------------
  17. # Fallback to Linux if no other OS defined
  18. ifneq ($(HAIKU),true)
  19. ifneq ($(MACOS),true)
  20. ifneq ($(WIN32),true)
  21. LINUX=true
  22. endif
  23. endif
  24. endif
  25. # --------------------------------------------------------------
  26. # Set MACOS_OR_WIN32
  27. ifeq ($(MACOS),true)
  28. MACOS_OR_WIN32=true
  29. endif
  30. ifeq ($(WIN32),true)
  31. MACOS_OR_WIN32=true
  32. endif
  33. # --------------------------------------------------------------
  34. # Force some features on MacOS and Windows
  35. ifeq ($(MACOS_OR_WIN32),true)
  36. CARLA_VESTIGE_HEADER = false
  37. endif
  38. # --------------------------------------------------------------
  39. # Common build and link flags
  40. BASE_FLAGS = -Wall -Wextra -pipe -DREAL_BUILD
  41. BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections
  42. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections
  43. # LINK_OPTS += -Wl,--strip-all
  44. ifneq ($(MACOS),true)
  45. # MacOS doesn't support this
  46. BASE_OPTS += -mfpmath=sse
  47. else
  48. # MacOS linker flags
  49. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
  50. endif
  51. ifeq ($(RASPPI),true)
  52. # Raspberry-Pi optimization flags
  53. BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
  54. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  55. endif
  56. ifeq ($(PANDORA),true)
  57. # OpenPandora flags
  58. BASE_OPTS = -O2 -ffast-math -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
  59. LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  60. endif
  61. ifneq ($(WIN32),true)
  62. # not needed for Windows
  63. BASE_FLAGS += -fPIC -DPIC
  64. endif
  65. ifeq ($(DEBUG),true)
  66. BASE_FLAGS += -DDEBUG -O0 -g
  67. LINK_OPTS =
  68. else
  69. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  70. CXXFLAGS += -fvisibility-inlines-hidden
  71. endif
  72. 32BIT_FLAGS = -m32
  73. 64BIT_FLAGS = -m64
  74. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  75. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
  76. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  77. ifeq ($(MACOS),true)
  78. # No C++11 support
  79. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
  80. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  81. endif
  82. # --------------------------------------------------------------
  83. # Strict test build
  84. ifeq ($(TESTBUILD),true)
  85. BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
  86. ifneq ($(CC),clang)
  87. BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
  88. endif
  89. ifneq ($(MACOS),true)
  90. BASE_FLAGS += -Wmissing-declarations -Wsign-conversion
  91. ifneq ($(CC),clang)
  92. BASE_FLAGS += -Wlogical-op
  93. endif
  94. endif
  95. CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
  96. CXXFLAGS += -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual
  97. ifeq ($(LINUX),true)
  98. CFLAGS += -isystem /opt/kxstudio/include
  99. CXXFLAGS += -isystem /opt/kxstudio/include
  100. endif
  101. ifeq ($(MACOS),true)
  102. CFLAGS += -isystem /opt/kxstudio/include
  103. CXXFLAGS += -isystem /opt/kxstudio/include
  104. endif
  105. ifeq ($(WIN32),true)
  106. CFLAGS += -isystem /opt/mingw32/include
  107. CXXFLAGS += -isystem /opt/mingw32/include
  108. endif
  109. endif
  110. # --------------------------------------------------------------
  111. # Check for required libs
  112. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  113. $(error liblo missing, cannot continue)
  114. endif
  115. ifeq ($(LINUX),true)
  116. ifeq (,$(wildcard /usr/include/magic.h))
  117. $(error libmagic missing, cannot continue)
  118. endif
  119. endif
  120. # --------------------------------------------------------------
  121. # Check for optional libs (required by backend or bridges)
  122. ifneq ($(MACOS_OR_WIN32),true)
  123. HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && echo true)
  124. HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
  125. HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
  126. ifeq ($(LINUX),true)
  127. HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
  128. HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
  129. HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
  130. endif
  131. endif
  132. HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true)
  133. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true)
  134. HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
  135. HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true)
  136. # --------------------------------------------------------------
  137. # Set Qt tools
  138. ifeq ($(HAVE_QT4),true)
  139. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  140. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  141. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  142. ifeq (,$(wildcard $(MOC_QT4)))
  143. HAVE_QT4=false
  144. endif
  145. endif
  146. ifeq ($(HAVE_QT5),true)
  147. QT5_LIBDIR = $(shell pkg-config --variable=libdir Qt5Core)
  148. ifeq ($(MACOS),true)
  149. MOC_QT5 ?= $(QT5_LIBDIR)/../bin/moc
  150. RCC_QT5 ?= $(QT5_LIBDIR)/../bin/rcc
  151. UIC_QT5 ?= $(QT5_LIBDIR)/../bin/uic
  152. else # MACOS
  153. ifneq (,$(wildcard $(QT5_LIBDIR)/qt5/bin/moc))
  154. MOC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/moc
  155. RCC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/rcc
  156. UIC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/uic
  157. else
  158. MOC_QT5 ?= $(QT5_LIBDIR)/qt/bin/moc
  159. RCC_QT5 ?= $(QT5_LIBDIR)/qt/bin/rcc
  160. UIC_QT5 ?= $(QT5_LIBDIR)/qt/bin/uic
  161. endif
  162. endif # MACOS
  163. ifeq (,$(wildcard $(MOC_QT5)))
  164. HAVE_QT5=false
  165. endif
  166. endif
  167. # --------------------------------------------------------------
  168. # Set default Qt used in frontend
  169. ifeq ($(HAVE_QT4),true)
  170. DEFAULT_QT ?= 4
  171. else
  172. DEFAULT_QT ?= 5
  173. endif
  174. # --------------------------------------------------------------
  175. # Check for optional libs (required by internal plugins)
  176. HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
  177. HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk_images ntk && echo true)
  178. # --------------------------------------------------------------
  179. # Set base defines
  180. ifeq ($(HAVE_FLUIDSYNTH),true)
  181. BASE_FLAGS += -DHAVE_FLUIDSYNTH
  182. endif
  183. ifeq ($(HAVE_LINUXSAMPLER),true)
  184. BASE_FLAGS += -DHAVE_LINUXSAMPLER
  185. endif
  186. ifeq ($(HAVE_X11),true)
  187. BASE_FLAGS += -DHAVE_X11
  188. endif
  189. ifeq ($(CARLA_VESTIGE_HEADER),true)
  190. BASE_FLAGS += -DVESTIGE_HEADER
  191. endif
  192. # --------------------------------------------------------------
  193. # Set libs stuff (part 1)
  194. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  195. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  196. ifeq ($(HAVE_FLUIDSYNTH),true)
  197. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  198. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  199. endif
  200. ifeq ($(HAVE_LINUXSAMPLER),true)
  201. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -Wno-unused-parameter
  202. LINUXSAMPLER_LIBS = $(shell pkg-config --libs linuxsampler)
  203. endif
  204. ifeq ($(HAVE_X11),true)
  205. X11_FLAGS = $(shell pkg-config --cflags x11)
  206. X11_LIBS = $(shell pkg-config --libs x11)
  207. endif
  208. # --------------------------------------------------------------
  209. # Set libs stuff (part 2)
  210. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  211. ifeq ($(DEBUG),true)
  212. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  213. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  214. endif
  215. ifneq ($(HAIKU),true)
  216. RTMEMPOOL_LIBS = -lpthread
  217. endif
  218. ifeq ($(LINUX),true)
  219. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  220. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  221. LILV_LIBS = -ldl -lm -lrt
  222. ifeq ($(HAVE_ALSA),true)
  223. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  224. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  225. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  226. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  227. endif
  228. ifeq ($(HAVE_PULSEAUDIO),true)
  229. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  230. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  231. endif
  232. endif
  233. ifeq ($(MACOS),true)
  234. JACKBRIDGE_LIBS = -ldl -lpthread
  235. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  236. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  237. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  238. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  239. JUCE_CORE_LIBS = -framework AppKit
  240. JUCE_EVENTS_LIBS = -framework AppKit
  241. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  242. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  243. JUCE_GUI_EXTRA_LIBS = -framework Cocoa -framework IOKit
  244. LILV_LIBS = -ldl -lm
  245. endif
  246. ifeq ($(WIN32),true)
  247. JACKBRIDGE_LIBS = -lpthread
  248. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  249. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  250. # JUCE_EVENTS_LIBS = -lole32
  251. JUCE_GRAPHICS_LIBS = -lgdi32
  252. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  253. LILV_LIBS = -lm
  254. endif
  255. # --------------------------------------------------------------
  256. # Set libs stuff (part 3)
  257. ifeq ($(HAVE_ZYN_DEPS),true)
  258. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX
  259. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3 mxml zlib)
  260. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  261. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX_UI
  262. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs ntk_images ntk)
  263. endif
  264. endif
  265. # --------------------------------------------------------------
  266. # Set app extension
  267. ifeq ($(WIN32),true)
  268. APP_EXT = .exe
  269. endif
  270. # --------------------------------------------------------------
  271. # Set shared lib extension
  272. LIB_EXT = .so
  273. ifeq ($(MACOS),true)
  274. LIB_EXT = .dylib
  275. endif
  276. ifeq ($(WIN32),true)
  277. LIB_EXT = .dll
  278. endif
  279. # --------------------------------------------------------------
  280. # Set static libs start & end
  281. ifneq ($(MACOS),true)
  282. LIBS_START = -Wl,--start-group
  283. LIBS_END = -Wl,--end-group
  284. endif
  285. # --------------------------------------------------------------
  286. # Set shared library CLI arg
  287. ifeq ($(MACOS),true)
  288. SHARED = -dynamiclib
  289. else
  290. SHARED = -shared
  291. endif
  292. # --------------------------------------------------------------