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