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 11KB

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