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