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.

275 lines
7.8KB

  1. #!/usr/bin/make -f
  2. # Makefile for native-plugins #
  3. # --------------------------- #
  4. # Created by falkTX
  5. #
  6. ifeq ($(TESTBUILD),true)
  7. ifeq ($(LINUX),true)
  8. CXXFLAGS += -isystem /opt/kxstudio/include/ntk
  9. endif
  10. endif
  11. ifeq ($(MACOS_OR_WIN32),true)
  12. HAVE_DGL = true
  13. else
  14. HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
  15. endif
  16. HAVE_NTK = $(shell pkg-config --exists ntk ntk_images && echo true)
  17. HAVE_PROJECTM = $(shell pkg-config --exists libprojectM && echo true)
  18. HAVE_ZYN_DEPS = $(shell pkg-config --exists liblo fftw3 mxml zlib && echo true)
  19. # ---------------------------------------------------------------------------------------------------------------------
  20. # Check for optional libs (special non-pkgconfig unix tests)
  21. ifeq ($(UNIX),true)
  22. # fltk doesn't have a pkg-config file but has fltk-config instead.
  23. # Also, don't try looking for it if we already have NTK.
  24. ifneq ($(HAVE_NTK),true)
  25. ifeq ($(shell which fltk-config 1>/dev/null 2>/dev/null && echo true),true)
  26. ifeq ($(shell which fluid 1>/dev/null 2>/dev/null && echo true),true)
  27. HAVE_FLTK = true
  28. endif
  29. endif
  30. endif
  31. endif
  32. # ---------------------------------------------------------------------------------------------------------------------
  33. ifeq ($(HAVE_FLTK),true)
  34. HAVE_ZYN_UI_DEPS = true
  35. endif
  36. ifeq ($(HAVE_NTK),true)
  37. HAVE_ZYN_UI_DEPS = true
  38. endif
  39. # ---------------------------------------------------------------------------------------------------------------------
  40. ifeq ($(HAVE_DGL),true)
  41. BASE_FLAGS += -DHAVE_DGL
  42. endif
  43. ifeq ($(HAVE_PROJECTM),true)
  44. BASE_FLAGS += -DHAVE_PROJECTM
  45. endif
  46. ifeq ($(HAVE_ZYN_DEPS),true)
  47. BASE_FLAGS += -DHAVE_ZYN_DEPS
  48. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  49. BASE_FLAGS += -DHAVE_ZYN_UI_DEPS
  50. endif
  51. endif
  52. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  53. BASE_FLAGS += -DHAVE_EXPERIMENTAL_PLUGINS
  54. endif
  55. # ---------------------------------------------------------------------------------------------------------------------
  56. ifeq ($(HAVE_DGL),true)
  57. ifeq ($(MACOS_OR_WIN32),true)
  58. ifeq ($(MACOS),true)
  59. DGL_LIBS = -framework OpenGL -framework Cocoa
  60. endif
  61. ifeq ($(WIN32),true)
  62. DGL_LIBS = -lopengl32 -lgdi32
  63. endif
  64. else
  65. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  66. DGL_LIBS = $(shell pkg-config --libs gl x11)
  67. endif
  68. endif
  69. # ---------------------------------------------------------------------------------------------------------------------
  70. ifeq ($(HAVE_PROJECTM),true)
  71. PROJECTM_FLAGS = $(shell pkg-config --cflags libprojectM)
  72. PROJECTM_LIBS = $(shell pkg-config --libs libprojectM)
  73. endif
  74. # ---------------------------------------------------------------------------------------------------------------------
  75. # Flags for DPF Plugins
  76. DPF_FLAGS = -I$(CWDE)/modules/distrho
  77. ifeq ($(HAVE_DGL),true)
  78. DPF_FLAGS += -I$(CWDE)/modules/dgl
  79. endif
  80. # ---------------------------------------------------------------------------------------------------------------------
  81. # Flags for ZynAddSubFX (DSP and UI separated)
  82. ifeq ($(HAVE_ZYN_DEPS),true)
  83. # Common flags
  84. ZYN_BASE_FLAGS = $(shell pkg-config --cflags liblo mxml)
  85. ZYN_BASE_FLAGS += -Izynaddsubfx -Izynaddsubfx/rtosc
  86. ifneq ($(WIN32),true)
  87. ZYN_BASE_FLAGS += -DHAVE_ASYNC
  88. endif
  89. ZYN_BASE_LIBS = $(shell pkg-config --libs liblo mxml) -lpthread
  90. ZYN_BASE_LIBS += $(LIBDL_LIBS)
  91. # DSP flags
  92. ZYN_DSP_FLAGS = $(ZYN_BASE_FLAGS)
  93. ZYN_DSP_FLAGS += $(shell pkg-config --cflags fftw3 zlib)
  94. ZYN_DSP_LIBS = $(ZYN_BASE_LIBS)
  95. ZYN_DSP_LIBS += $(shell pkg-config --libs fftw3 zlib)
  96. # UI flags
  97. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  98. # Common UI flags
  99. ZYN_UI_FLAGS = $(ZYN_BASE_FLAGS)
  100. ZYN_UI_LIBS = $(ZYN_BASE_LIBS)
  101. # NTK or FLTK UI flags
  102. ifeq ($(HAVE_NTK),true)
  103. FLUID = ntk-fluid
  104. ZYN_UI_FLAGS += $(shell pkg-config --cflags ntk_images ntk) -DNTK_GUI
  105. ZYN_UI_LIBS += $(shell pkg-config --libs ntk_images ntk)
  106. else # HAVE_NTK
  107. FLUID = fluid
  108. ZYN_UI_FLAGS += $(shell fltk-config --use-images --cxxflags) -DFLTK_GUI
  109. ZYN_UI_LIBS += $(shell fltk-config --use-images --ldflags)
  110. endif # HAVE_NTK
  111. # UI extra flags
  112. ifeq ($(HAVE_X11),true)
  113. ZYN_UI_FLAGS += $(shell pkg-config --cflags x11)
  114. ZYN_UI_LIBS += $(shell pkg-config --libs x11)
  115. endif
  116. ifeq ($(LINUX),true)
  117. ZYN_UI_LIBS += -lrt
  118. endif
  119. else # HAVE_ZYN_UI_DEPS
  120. ZYN_DSP_FLAGS += -DNO_UI
  121. endif # HAVE_ZYN_UI_DEPS
  122. endif # HAVE_ZYN_DEPS
  123. # ---------------------------------------------------------------------------------------------------------------------
  124. # Flags for Zita Plugins (DSP and UI separated)
  125. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  126. ZITA_DSP_FLAGS = $(shell pkg-config --cflags fftw3f)
  127. ZITA_DSP_FLAGS += -Wno-unused-parameter
  128. ZITA_DSP_LIBS = -lzita-convolver -lzita-resampler -lclthreads
  129. ZITA_DSP_LIBS += $(shell pkg-config --libs fftw3f)
  130. ZITA_DSP_LIBS += -lpthread -lrt
  131. ZITA_UI_FLAGS = $(shell pkg-config --cflags cairo libpng12 freetype2 x11 xft zlib)
  132. ZITA_UI_FLAGS += -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-unused-result
  133. ZITA_UI_LIBS = $(shell pkg-config --libs cairo libpng12 freetype2 zlib)
  134. ZITA_UI_LIBS += -lclxclient -lclthreads $(shell pkg-config --libs x11 xft)
  135. ZITA_UI_LIBS += $(LIBDL_LIBS) -lpthread -lrt
  136. endif
  137. # ---------------------------------------------------------------------------------------------------------------------
  138. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  139. NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS)
  140. NATIVE_PLUGINS_LIBS += $(ZYN_DSP_LIBS)
  141. NATIVE_PLUGINS_LIBS += $(ZITA_DSP_LIBS)
  142. # ---------------------------------------------------------------------------------------------------------------------
  143. ifeq ($(HAVE_DGL),true)
  144. ALL_LIBS += $(MODULEDIR)/dgl.a
  145. endif
  146. # ---------------------------------------------------------------------------------------------------------------------
  147. all:
  148. install_external_plugins:
  149. ifeq ($(HAVE_ZYN_DEPS),true)
  150. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  151. # Create directories (zynaddsubfx)
  152. install -d $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  153. # Install resources (zynaddsubfx)
  154. install -m 644 \
  155. bin/resources/zynaddsubfx/*.png \
  156. $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  157. install -m 755 \
  158. bin/resources/zynaddsubfx-ui \
  159. $(DESTDIR)$(DATADIR)/carla/resources
  160. endif
  161. endif
  162. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  163. # Create directories (experimental plugins)
  164. install -d $(DESTDIR)$(DATADIR)/carla/resources/at1
  165. install -d $(DESTDIR)$(DATADIR)/carla/resources/bls1
  166. install -d $(DESTDIR)$(DATADIR)/carla/resources/rev1
  167. # Install resources (experimental plugins)
  168. install -m 644 \
  169. bin/resources/at1/*.png \
  170. $(DESTDIR)$(DATADIR)/carla/resources/at1
  171. install -m 644 \
  172. bin/resources/bls1/*.png \
  173. $(DESTDIR)$(DATADIR)/carla/resources/bls1
  174. install -m 644 \
  175. bin/resources/rev1/*.png \
  176. $(DESTDIR)$(DATADIR)/carla/resources/rev1
  177. install -m 755 \
  178. bin/resources/zita-at1-ui \
  179. bin/resources/zita-bls1-ui \
  180. bin/resources/zita-rev1-ui \
  181. $(DESTDIR)$(DATADIR)/carla/resources
  182. endif
  183. features_print_external_plugins:
  184. @printf -- "\n"
  185. @printf -- "$(tS)---> External plugins: $(tE)\n"
  186. ifeq ($(HAVE_DGL),true)
  187. @printf -- "DPF Plugins: $(ANS_YES) (with UI)\n"
  188. ifeq ($(HAVE_PROJECTM),true)
  189. @printf -- "DPF ProM: $(ANS_YES)\n"
  190. else
  191. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing libprojectM$(mE)\n"
  192. endif
  193. else
  194. @printf -- "DPF Plugins: $(ANS_YES) (without UI)\n"
  195. ifeq ($(HAVE_PROJECTM),true)
  196. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL$(mE)\n"
  197. else
  198. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL and libprojectM$(mE)\n"
  199. endif
  200. endif
  201. ifeq ($(HAVE_ZYN_DEPS),true)
  202. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  203. ifeq ($(HAVE_NTK),true)
  204. @printf -- "ZynAddSubFX: $(ANS_YES) (with NTK UI)\n"
  205. else
  206. @printf -- "ZynAddSubFX: $(ANS_YES) (with FLTK UI)\n"
  207. endif
  208. else
  209. @printf -- "ZynAddSubFX: $(ANS_YES) (without UI) $(mS)FLTK or NTK missing$(mE)\n"
  210. endif
  211. else
  212. @printf -- "ZynAddSubFX: $(ANS_NO) $(mS)liblo, fftw3, mxml or zlib missing$(mE)\n"
  213. endif
  214. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  215. @printf -- "Experimental: YES\n"
  216. else
  217. @printf -- "Experimental: NO\n"
  218. endif
  219. # ---------------------------------------------------------------------------------------------------------------------