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
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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  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. ifeq ($(WIN32),true)
  68. BASE_FLAGS += -msse -msse2
  69. endif
  70. LINK_OPTS =
  71. else
  72. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  73. CXXFLAGS += -fvisibility-inlines-hidden
  74. endif
  75. 32BIT_FLAGS = -m32
  76. 64BIT_FLAGS = -m64
  77. BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
  78. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
  79. LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
  80. ifeq ($(MACOS),true)
  81. # No C++11 support
  82. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
  83. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  84. endif
  85. # --------------------------------------------------------------
  86. # Strict test build
  87. ifeq ($(TESTBUILD),true)
  88. BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
  89. BASE_FLAGS += -Wfloat-equal -Wpointer-arith -Wabi -Winit-self -Wuninitialized -Wunused-parameter #-Wstrict-overflow=5
  90. ifeq ($(CC),clang)
  91. # BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
  92. # BASE_FLAGS += -Weverything
  93. else
  94. BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
  95. endif
  96. ifneq ($(MACOS),true)
  97. BASE_FLAGS += -Wmissing-declarations -Wsign-conversion
  98. ifneq ($(CC),clang)
  99. BASE_FLAGS += -Wlogical-op
  100. endif
  101. endif
  102. CFLAGS += -Wold-style-definition -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
  103. CXXFLAGS += -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual
  104. ifeq ($(LINUX),true)
  105. CFLAGS += -isystem /opt/kxstudio/include
  106. CXXFLAGS += -isystem /opt/kxstudio/include
  107. CXXFLAGS += -isystem /opt/kxstudio/include/ntk
  108. CXXFLAGS += -isystem /opt/kxstudio-trusty/include/ntk
  109. CXXFLAGS += -isystem /usr/include/qt4
  110. endif
  111. ifeq ($(MACOS),true)
  112. CFLAGS += -isystem /opt/kxstudio/include
  113. CXXFLAGS += -isystem /opt/kxstudio/include
  114. CXXFLAGS += -isystem /System/Library/Frameworks
  115. endif
  116. ifeq ($(WIN64),true)
  117. CFLAGS += -isystem /opt/mingw64/include
  118. CXXFLAGS += -isystem /opt/mingw64/include
  119. else
  120. ifeq ($(WIN32),true)
  121. CFLAGS += -isystem /opt/mingw32/include
  122. CXXFLAGS += -isystem /opt/mingw32/include
  123. endif
  124. endif
  125. endif
  126. # --------------------------------------------------------------
  127. # Check for required libs
  128. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  129. $(error liblo missing, cannot continue)
  130. endif
  131. ifeq ($(LINUX),true)
  132. ifeq (,$(wildcard /usr/include/magic.h))
  133. $(error libmagic missing, cannot continue)
  134. endif
  135. endif
  136. # --------------------------------------------------------------
  137. # Check for optional libs (required by backend or bridges)
  138. ifneq ($(MACOS_OR_WIN32),true)
  139. HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
  140. HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
  141. ifeq ($(LINUX),true)
  142. HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
  143. HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
  144. HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
  145. endif
  146. endif
  147. HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true)
  148. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true)
  149. HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
  150. HAVE_LINUXSAMPLER = $(shell pkg-config --atleast-version=1.0.0.svn41 linuxsampler && echo true)
  151. # --------------------------------------------------------------
  152. # Set Qt tools
  153. ifeq ($(HAVE_QT4),true)
  154. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  155. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  156. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  157. ifeq (,$(wildcard $(MOC_QT4)))
  158. HAVE_QT4=false
  159. endif
  160. endif
  161. ifeq ($(HAVE_QT5),true)
  162. QT5_LIBDIR = $(shell pkg-config --variable=libdir Qt5Core)
  163. ifeq ($(MACOS),true)
  164. MOC_QT5 ?= $(QT5_LIBDIR)/../bin/moc
  165. RCC_QT5 ?= $(QT5_LIBDIR)/../bin/rcc
  166. UIC_QT5 ?= $(QT5_LIBDIR)/../bin/uic
  167. else # MACOS
  168. ifneq (,$(wildcard $(QT5_LIBDIR)/qt5/bin/moc))
  169. MOC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/moc
  170. RCC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/rcc
  171. UIC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/uic
  172. else
  173. MOC_QT5 ?= $(QT5_LIBDIR)/qt/bin/moc
  174. RCC_QT5 ?= $(QT5_LIBDIR)/qt/bin/rcc
  175. UIC_QT5 ?= $(QT5_LIBDIR)/qt/bin/uic
  176. endif
  177. endif # MACOS
  178. ifeq (,$(wildcard $(MOC_QT5)))
  179. HAVE_QT5=false
  180. endif
  181. endif
  182. ifeq ($(HAVE_QT4),true)
  183. HAVE_QT=true
  184. endif
  185. ifeq ($(HAVE_QT5),true)
  186. HAVE_QT=true
  187. endif
  188. ifeq ($(WIN32),true)
  189. HAVE_QT=true
  190. endif
  191. # --------------------------------------------------------------
  192. # Set PyQt tools
  193. PYUIC4 ?= /usr/bin/pyuic4
  194. PYUIC5 ?= /usr/bin/pyuic5
  195. ifneq (,$(wildcard $(PYUIC4)))
  196. HAVE_PYQT=true
  197. HAVE_PYQT4=true
  198. else
  199. HAVE_PYQT4=false
  200. endif
  201. ifneq (,$(wildcard $(PYUIC5)))
  202. HAVE_PYQT=true
  203. HAVE_PYQT5=true
  204. else
  205. HAVE_PYQT5=false
  206. endif
  207. # --------------------------------------------------------------
  208. # Set default Qt used in frontend
  209. ifeq ($(HAVE_PYQT4),true)
  210. DEFAULT_QT ?= 4
  211. else
  212. DEFAULT_QT ?= 5
  213. endif
  214. # --------------------------------------------------------------
  215. # Check for optional libs (required by internal plugins)
  216. HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
  217. HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk_images ntk && echo true)
  218. # --------------------------------------------------------------
  219. # Set base defines
  220. ifeq ($(HAVE_FLUIDSYNTH),true)
  221. BASE_FLAGS += -DHAVE_FLUIDSYNTH
  222. endif
  223. ifeq ($(HAVE_LINUXSAMPLER),true)
  224. BASE_FLAGS += -DHAVE_LINUXSAMPLER
  225. endif
  226. ifeq ($(HAVE_X11),true)
  227. BASE_FLAGS += -DHAVE_X11
  228. endif
  229. ifeq ($(CARLA_VESTIGE_HEADER),true)
  230. BASE_FLAGS += -DVESTIGE_HEADER
  231. endif
  232. # --------------------------------------------------------------
  233. # Set libs stuff (part 1)
  234. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  235. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  236. ifeq ($(HAVE_FLUIDSYNTH),true)
  237. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  238. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  239. endif
  240. ifeq ($(HAVE_LINUXSAMPLER),true)
  241. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -DIS_CPP11=1 -Wno-non-virtual-dtor -Wno-shadow -Wno-unused-parameter
  242. LINUXSAMPLER_LIBS = $(shell pkg-config --libs linuxsampler)
  243. endif
  244. ifeq ($(HAVE_X11),true)
  245. X11_FLAGS = $(shell pkg-config --cflags x11)
  246. X11_LIBS = $(shell pkg-config --libs x11)
  247. endif
  248. # --------------------------------------------------------------
  249. # Set libs stuff (part 2)
  250. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  251. ifeq ($(DEBUG),true)
  252. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  253. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  254. endif
  255. ifneq ($(HAIKU),true)
  256. RTMEMPOOL_LIBS = -lpthread
  257. endif
  258. ifeq ($(LINUX),true)
  259. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  260. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  261. LILV_LIBS = -ldl -lm -lrt
  262. ifeq ($(HAVE_ALSA),true)
  263. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  264. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  265. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  266. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  267. endif
  268. ifeq ($(HAVE_PULSEAUDIO),true)
  269. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  270. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  271. endif
  272. endif
  273. ifeq ($(MACOS),true)
  274. JACKBRIDGE_LIBS = -ldl -lpthread
  275. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  276. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  277. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  278. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  279. JUCE_CORE_LIBS = -framework AppKit
  280. JUCE_EVENTS_LIBS = -framework AppKit
  281. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  282. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  283. JUCE_GUI_EXTRA_LIBS = -framework Cocoa -framework IOKit
  284. LILV_LIBS = -ldl -lm
  285. endif
  286. ifeq ($(WIN32),true)
  287. JACKBRIDGE_LIBS = -lpthread
  288. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  289. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  290. # JUCE_EVENTS_LIBS = -lole32
  291. JUCE_GRAPHICS_LIBS = -lgdi32
  292. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  293. LILV_LIBS = -lm
  294. endif
  295. # --------------------------------------------------------------
  296. # Set libs stuff (part 3)
  297. ifeq ($(HAVE_ZYN_DEPS),true)
  298. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX
  299. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3 mxml zlib)
  300. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  301. NATIVE_PLUGINS_FLAGS += -DWANT_ZYNADDSUBFX_UI
  302. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs ntk_images ntk)
  303. endif
  304. endif
  305. # --------------------------------------------------------------
  306. # Set app extension
  307. ifeq ($(WIN32),true)
  308. APP_EXT = .exe
  309. endif
  310. # --------------------------------------------------------------
  311. # Set shared lib extension
  312. LIB_EXT = .so
  313. ifeq ($(MACOS),true)
  314. LIB_EXT = .dylib
  315. endif
  316. ifeq ($(WIN32),true)
  317. LIB_EXT = .dll
  318. endif
  319. # --------------------------------------------------------------
  320. # Set static libs start & end
  321. ifneq ($(MACOS),true)
  322. LIBS_START = -Wl,--start-group
  323. LIBS_END = -Wl,--end-group
  324. endif
  325. # --------------------------------------------------------------
  326. # Set shared library CLI arg
  327. ifeq ($(MACOS),true)
  328. SHARED = -dynamiclib
  329. else
  330. SHARED = -shared
  331. endif
  332. # --------------------------------------------------------------