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

11 years ago
9 years ago
11 years ago
9 years ago
11 years ago
11 years ago
10 years ago
11 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
9 years ago
11 years ago
8 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
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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. # Enable experimental plugins, don't complain if the build fails when using this!
  11. EXPERIMENTAL_PLUGINS = false
  12. # --------------------------------------------------------------
  13. # DO NOT MODIFY PAST THIS POINT!
  14. AR ?= ar
  15. CC ?= gcc
  16. CXX ?= g++
  17. # --------------------------------------------------------------
  18. # Fallback to Linux if no other OS defined
  19. ifneq ($(HAIKU),true)
  20. ifneq ($(MACOS),true)
  21. ifneq ($(WIN32),true)
  22. LINUX=true
  23. endif
  24. endif
  25. endif
  26. # --------------------------------------------------------------
  27. # Set MACOS_OR_WIN32
  28. ifeq ($(MACOS),true)
  29. MACOS_OR_WIN32=true
  30. endif
  31. ifeq ($(WIN32),true)
  32. MACOS_OR_WIN32=true
  33. endif
  34. # --------------------------------------------------------------
  35. # Set UNIX
  36. ifeq ($(LINUX),true)
  37. UNIX=true
  38. endif
  39. ifeq ($(MACOS),true)
  40. UNIX=true
  41. endif
  42. # --------------------------------------------------------------
  43. # Force some features on MacOS and Windows
  44. ifeq ($(MACOS_OR_WIN32),true)
  45. CARLA_VESTIGE_HEADER = false
  46. EXPERIMENTAL_PLUGINS = false
  47. endif
  48. # --------------------------------------------------------------
  49. # Set build and link flags
  50. BASE_FLAGS = -Wall -Wextra -pipe -DBUILDING_CARLA -DREAL_BUILD -MD -MP
  51. BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
  52. ifeq ($(MACOS),true)
  53. # MacOS linker flags
  54. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
  55. else
  56. # Common linker flags
  57. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
  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 ($(NOOPT),true)
  65. # No optimization flags
  66. BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
  67. endif
  68. ifneq ($(WIN32),true)
  69. # Not needed for Windows
  70. BASE_FLAGS += -fPIC -DPIC
  71. endif
  72. ifeq ($(CLANG),true)
  73. BASE_FLAGS += -Wabsolute-value
  74. endif
  75. ifeq ($(STOAT),true)
  76. CC = clang
  77. CXX = clang++
  78. BASE_FLAGS += -emit-llvm
  79. BASE_OPTS += -O0
  80. endif
  81. ifeq ($(DEBUG),true)
  82. BASE_FLAGS += -DDEBUG -O0 -g
  83. ifeq ($(WIN32),true)
  84. BASE_FLAGS += -msse -msse2
  85. endif
  86. LINK_OPTS =
  87. else
  88. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  89. CXXFLAGS += -fvisibility-inlines-hidden
  90. endif
  91. 32BIT_FLAGS = -m32
  92. 64BIT_FLAGS = -m64
  93. BUILD_C_FLAGS = $(BASE_FLAGS) -std=gnu99 $(CFLAGS)
  94. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=gnu++0x $(CXXFLAGS)
  95. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  96. ifneq ($(MACOS),true)
  97. # Not available on MacOS
  98. LINK_FLAGS += -Wl,--no-undefined
  99. endif
  100. # --------------------------------------------------------------
  101. # Strict test build
  102. ifeq ($(TESTBUILD),true)
  103. BASE_FLAGS += -Werror -Wabi -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-declarations
  104. BASE_FLAGS += -Woverlength-strings -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wundef -Wuninitialized -Wunused
  105. BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing
  106. BASE_FLAGS += -Wstrict-overflow -fstrict-overflow
  107. CFLAGS += -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings
  108. CXXFLAGS += -Wc++0x-compat -Wc++11-compat -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wzero-as-null-pointer-constant
  109. ifeq ($(LINUX),true)
  110. BASE_FLAGS += -isystem /opt/kxstudio/include
  111. CXXFLAGS += -isystem /opt/kxstudio/include/ntk
  112. CXXFLAGS += -isystem /usr/include/qt4
  113. endif
  114. ifeq ($(MACOS),true)
  115. BASE_FLAGS += -isystem /opt/kxstudio/include
  116. CXXFLAGS += -isystem /System/Library/Frameworks
  117. endif
  118. ifeq ($(WIN64),true)
  119. BASE_FLAGS += -isystem /opt/mingw64/include
  120. else
  121. ifeq ($(WIN32),true)
  122. BASE_FLAGS += -isystem /opt/mingw32/include
  123. endif
  124. endif
  125. endif
  126. # --------------------------------------------------------------
  127. # Check for optional libs (required by backend or bridges)
  128. ifeq ($(MACOS_OR_WIN32),true)
  129. HAVE_DGL = true
  130. else
  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_DGL = $(shell pkg-config --exists gl x11 && echo true)
  136. HAVE_NTK = $(shell pkg-config --exists ntk ntk_images && echo true)
  137. HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
  138. HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
  139. endif
  140. endif
  141. HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true)
  142. HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true)
  143. HAVE_LIBLO = $(shell pkg-config --exists liblo && echo true)
  144. HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
  145. HAVE_LINUXSAMPLER = $(shell pkg-config --atleast-version=1.0.0.svn41 linuxsampler && echo true)
  146. HAVE_PROJECTM = $(shell pkg-config --exists libprojectM && echo true)
  147. # --------------------------------------------------------------
  148. # Check for optional libs (special non-pkgconfig unix tests)
  149. ifeq ($(UNIX),true)
  150. # libmagic doesn't have a pkg-config file, so we need to call the compiler to test it
  151. HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS) -x c -w -c - -o .libmagic-tmp 2>/dev/null && echo true)
  152. # fltk doesn't have a pkg-config file but has fltk-config instead.
  153. # Also, don't try looking for it if we already have NTK.
  154. ifneq ($(HAVE_NTK),true)
  155. ifeq ($(shell which fltk-config 1>/dev/null 2>/dev/null && echo true),true)
  156. ifeq ($(shell which fluid 1>/dev/null 2>/dev/null && echo true),true)
  157. HAVE_FLTK = true
  158. endif
  159. endif
  160. endif
  161. endif
  162. # --------------------------------------------------------------
  163. # Set Qt tools
  164. ifeq ($(HAVE_QT4),true)
  165. MOC_QT4 ?= $(shell pkg-config --variable=moc_location QtCore)
  166. RCC_QT4 ?= $(shell pkg-config --variable=rcc_location QtCore)
  167. UIC_QT4 ?= $(shell pkg-config --variable=uic_location QtCore)
  168. ifeq (,$(wildcard $(MOC_QT4)))
  169. HAVE_QT4=false
  170. endif
  171. endif
  172. ifeq ($(HAVE_QT5),true)
  173. QT5_LIBDIR = $(shell pkg-config --variable=libdir Qt5Core)
  174. ifeq ($(MACOS),true)
  175. MOC_QT5 ?= $(QT5_LIBDIR)/../bin/moc
  176. RCC_QT5 ?= $(QT5_LIBDIR)/../bin/rcc
  177. UIC_QT5 ?= $(QT5_LIBDIR)/../bin/uic
  178. else # MACOS
  179. ifneq (,$(wildcard $(QT5_LIBDIR)/qt5/bin/moc))
  180. MOC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/moc
  181. RCC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/rcc
  182. UIC_QT5 ?= $(QT5_LIBDIR)/qt5/bin/uic
  183. else
  184. MOC_QT5 ?= $(QT5_LIBDIR)/qt/bin/moc
  185. RCC_QT5 ?= $(QT5_LIBDIR)/qt/bin/rcc
  186. UIC_QT5 ?= $(QT5_LIBDIR)/qt/bin/uic
  187. endif
  188. endif # MACOS
  189. ifeq (,$(wildcard $(MOC_QT5)))
  190. HAVE_QT5=false
  191. endif
  192. endif
  193. ifeq ($(HAVE_QT4),true)
  194. HAVE_QT=true
  195. endif
  196. ifeq ($(HAVE_QT5),true)
  197. HAVE_QT=true
  198. endif
  199. ifeq ($(WIN32),true)
  200. HAVE_QT=true
  201. endif
  202. # --------------------------------------------------------------
  203. # Set PyQt tools
  204. PYUIC4 ?= /usr/bin/pyuic4
  205. PYUIC5 ?= /usr/bin/pyuic5
  206. ifneq (,$(wildcard $(PYUIC4)))
  207. HAVE_PYQT=true
  208. HAVE_PYQT4=true
  209. else
  210. HAVE_PYQT4=false
  211. endif
  212. ifneq (,$(wildcard $(PYUIC5)))
  213. HAVE_PYQT=true
  214. HAVE_PYQT5=true
  215. else
  216. HAVE_PYQT5=false
  217. endif
  218. # --------------------------------------------------------------
  219. # Set default Qt used in frontend
  220. ifeq ($(HAVE_PYQT4),true)
  221. DEFAULT_QT ?= 4
  222. else
  223. DEFAULT_QT ?= 5
  224. endif
  225. # --------------------------------------------------------------
  226. # Set base defines
  227. ifeq ($(HAVE_DGL),true)
  228. BASE_FLAGS += -DHAVE_DGL
  229. endif
  230. ifeq ($(HAVE_LIBLO),true)
  231. BASE_FLAGS += -DHAVE_LIBLO
  232. endif
  233. ifeq ($(HAVE_LIBMAGIC),true)
  234. BASE_FLAGS += -DHAVE_LIBMAGIC
  235. endif
  236. ifeq ($(HAVE_FLUIDSYNTH),true)
  237. BASE_FLAGS += -DHAVE_FLUIDSYNTH
  238. endif
  239. ifeq ($(HAVE_LINUXSAMPLER),true)
  240. BASE_FLAGS += -DHAVE_LINUXSAMPLER
  241. endif
  242. ifeq ($(HAVE_PROJECTM),true)
  243. BASE_FLAGS += -DHAVE_PROJECTM
  244. endif
  245. ifeq ($(HAVE_X11),true)
  246. BASE_FLAGS += -DHAVE_X11
  247. endif
  248. ifeq ($(CARLA_VESTIGE_HEADER),true)
  249. BASE_FLAGS += -DVESTIGE_HEADER
  250. endif
  251. # --------------------------------------------------------------
  252. # Set libs stuff (part 1)
  253. ifeq ($(HAVE_LIBLO),true)
  254. LIBLO_FLAGS = $(shell pkg-config --cflags liblo)
  255. LIBLO_LIBS = $(shell pkg-config --libs liblo)
  256. endif
  257. ifeq ($(HAVE_FLUIDSYNTH),true)
  258. FLUIDSYNTH_FLAGS = $(shell pkg-config --cflags fluidsynth)
  259. FLUIDSYNTH_LIBS = $(shell pkg-config --libs fluidsynth)
  260. endif
  261. ifeq ($(HAVE_LINUXSAMPLER),true)
  262. LINUXSAMPLER_FLAGS = $(shell pkg-config --cflags linuxsampler) -DIS_CPP11=1 -Wno-non-virtual-dtor -Wno-shadow -Wno-unused-parameter
  263. ifeq ($(LINUX),true)
  264. LINUXSAMPLER_LIBS = -Wl,-rpath=$(shell pkg-config --variable=libdir gig):$(shell pkg-config --variable=libdir linuxsampler)
  265. endif
  266. LINUXSAMPLER_LIBS += $(shell pkg-config --libs linuxsampler)
  267. endif
  268. ifeq ($(HAVE_PROJECTM),true)
  269. PROJECTM_FLAGS = $(shell pkg-config --cflags libprojectM)
  270. PROJECTM_LIBS = $(shell pkg-config --libs libprojectM)
  271. endif
  272. ifeq ($(HAVE_X11),true)
  273. X11_FLAGS = $(shell pkg-config --cflags x11)
  274. X11_LIBS = $(shell pkg-config --libs x11)
  275. endif
  276. # --------------------------------------------------------------
  277. # Set libs stuff (part 2)
  278. RTAUDIO_FLAGS = -DHAVE_GETTIMEOFDAY -D__UNIX_JACK__
  279. ifeq ($(DEBUG),true)
  280. RTAUDIO_FLAGS += -D__RTAUDIO_DEBUG__
  281. RTMIDI_FLAGS += -D__RTMIDI_DEBUG__
  282. endif
  283. ifneq ($(HAIKU),true)
  284. RTMEMPOOL_LIBS = -lpthread
  285. endif
  286. ifeq ($(LINUX),true)
  287. JACKBRIDGE_LIBS = -ldl -lpthread -lrt
  288. JUCE_CORE_LIBS = -ldl -lpthread -lrt
  289. LILV_LIBS = -ldl -lm -lrt
  290. ifeq ($(HAVE_DGL),true)
  291. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  292. DGL_LIBS = $(shell pkg-config --libs gl x11)
  293. endif
  294. ifeq ($(HAVE_ALSA),true)
  295. RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  296. RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread
  297. RTMIDI_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
  298. RTMIDI_LIBS += $(shell pkg-config --libs alsa)
  299. endif
  300. ifeq ($(HAVE_PULSEAUDIO),true)
  301. RTAUDIO_FLAGS += $(shell pkg-config --cflags libpulse-simple) -D__LINUX_PULSE__
  302. RTAUDIO_LIBS += $(shell pkg-config --libs libpulse-simple)
  303. endif
  304. endif
  305. ifeq ($(MACOS),true)
  306. DGL_LIBS = -framework OpenGL -framework Cocoa
  307. JACKBRIDGE_LIBS = -ldl -lpthread
  308. JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
  309. JUCE_AUDIO_DEVICES_LIBS = -framework AppKit -framework AudioToolbox -framework CoreAudio -framework CoreMIDI
  310. JUCE_AUDIO_FORMATS_LIBS = -framework AudioToolbox -framework CoreFoundation
  311. JUCE_AUDIO_PROCESSORS_LIBS = -framework AudioToolbox -framework AudioUnit -framework CoreAudio -framework CoreAudioKit -framework Cocoa -framework Carbon
  312. JUCE_CORE_LIBS = -framework AppKit
  313. JUCE_EVENTS_LIBS = -framework AppKit
  314. JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
  315. JUCE_GUI_BASICS_LIBS = -framework Cocoa
  316. JUCE_GUI_EXTRA_LIBS = -framework Cocoa -framework IOKit
  317. LILV_LIBS = -ldl -lm
  318. endif
  319. ifeq ($(WIN32),true)
  320. DGL_LIBS = -lopengl32 -lgdi32
  321. JACKBRIDGE_LIBS = -lpthread
  322. JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
  323. JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
  324. JUCE_GRAPHICS_LIBS = -lgdi32
  325. JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
  326. LILV_LIBS = -lm
  327. endif
  328. # --------------------------------------------------------------
  329. # Set libs stuff (part 3)
  330. HAVE_ZYN_DEPS = $(shell pkg-config --exists liblo fftw3 mxml zlib && echo true)
  331. ifeq ($(HAVE_FLTK),true)
  332. HAVE_ZYN_UI_DEPS = true
  333. endif
  334. ifeq ($(HAVE_NTK),true)
  335. HAVE_ZYN_UI_DEPS = true
  336. endif
  337. ifeq ($(HAVE_DGL),true)
  338. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  339. ifeq ($(HAVE_PROJECTM),true)
  340. NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS)
  341. endif
  342. endif
  343. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  344. BASE_FLAGS += -DHAVE_EXPERIMENTAL_PLUGINS
  345. NATIVE_PLUGINS_LIBS += -lclthreads -lzita-convolver -lzita-resampler
  346. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3f)
  347. endif
  348. ifeq ($(HAVE_ZYN_DEPS),true)
  349. BASE_FLAGS += -DHAVE_ZYN_DEPS
  350. NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs liblo fftw3 mxml zlib)
  351. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  352. BASE_FLAGS += -DHAVE_ZYN_UI_DEPS
  353. endif
  354. endif
  355. # --------------------------------------------------------------
  356. # Set app extension
  357. ifeq ($(WIN32),true)
  358. APP_EXT = .exe
  359. endif
  360. # --------------------------------------------------------------
  361. # Set shared lib extension
  362. LIB_EXT = .so
  363. ifeq ($(MACOS),true)
  364. LIB_EXT = .dylib
  365. endif
  366. ifeq ($(WIN32),true)
  367. LIB_EXT = .dll
  368. endif
  369. # --------------------------------------------------------------
  370. # Set static libs start & end
  371. ifneq ($(MACOS),true)
  372. LIBS_START = -Wl,--start-group
  373. LIBS_END = -Wl,--end-group
  374. endif
  375. # --------------------------------------------------------------
  376. # Set shared library CLI arg
  377. ifeq ($(MACOS),true)
  378. SHARED = -dynamiclib
  379. else
  380. SHARED = -shared
  381. endif
  382. # --------------------------------------------------------------