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.

260 lines
7.2KB

  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. ifneq ($(WIN32),true)
  91. ZYN_BASE_LIBS += -ldl
  92. endif
  93. # DSP flags
  94. ZYN_DSP_FLAGS = $(ZYN_BASE_FLAGS)
  95. ZYN_DSP_FLAGS += $(shell pkg-config --cflags fftw3 zlib)
  96. ZYN_DSP_FLAGS += -Wno-misleading-indentation -Wno-shift-negative-value
  97. ZYN_DSP_LIBS = $(ZYN_BASE_LIBS)
  98. ZYN_DSP_LIBS += $(shell pkg-config --libs fftw3 zlib)
  99. # UI flags
  100. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  101. # Common UI flags
  102. ZYN_UI_FLAGS = $(ZYN_BASE_FLAGS)
  103. ZYN_UI_LIBS = $(ZYN_BASE_LIBS)
  104. # NTK or FLTK UI flags
  105. ifeq ($(HAVE_NTK),true)
  106. FLUID = ntk-fluid
  107. ZYN_UI_FLAGS += $(shell pkg-config --cflags ntk_images ntk) -DNTK_GUI
  108. ZYN_UI_LIBS += $(shell pkg-config --libs ntk_images ntk)
  109. else # HAVE_NTK
  110. FLUID = fluid
  111. ZYN_UI_FLAGS += $(shell fltk-config --use-images --cxxflags) -DFLTK_GUI
  112. ZYN_UI_LIBS += $(shell fltk-config --use-images --ldflags)
  113. endif # HAVE_NTK
  114. # UI extra flags
  115. ifeq ($(HAVE_X11),true)
  116. ZYN_UI_FLAGS += $(shell pkg-config --cflags x11)
  117. ZYN_UI_LIBS += $(shell pkg-config --libs x11)
  118. endif
  119. ifeq ($(LINUX),true)
  120. ZYN_UI_LIBS += -lrt
  121. endif
  122. else # HAVE_ZYN_UI_DEPS
  123. ZYN_DSP_FLAGS += -DNO_UI
  124. endif # HAVE_ZYN_UI_DEPS
  125. endif # HAVE_ZYN_DEPS
  126. # ---------------------------------------------------------------------------------------------------------------------
  127. # Flags for Zita Plugins (DSP and UI separated)
  128. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  129. ZITA_DSP_FLAGS = $(shell pkg-config --cflags fftw3f)
  130. ZITA_DSP_FLAGS += -Wno-unused-parameter
  131. ZITA_DSP_LIBS = $(shell pkg-config --libs fftw3f)
  132. ZITA_UI_FLAGS = $(shell pkg-config --cflags cairo libpng12 freetype2 x11 xft zlib)
  133. ZITA_UI_FLAGS += -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-unused-result
  134. ZITA_UI_LIBS = $(shell pkg-config --libs cairo libpng12 freetype2 x11 xft zlib)
  135. ZITA_UI_LIBS += -lclxclient -lclthreads -ldl -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. # Install resources (zynaddsubfx)
  152. install -m 644 \
  153. bin/resources/zynaddsubfx/*.png \
  154. $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  155. install -m 755 \
  156. bin/resources/zynaddsubfx-ui \
  157. $(DESTDIR)$(DATADIR)/carla/resources
  158. endif
  159. endif
  160. ifeq ($(EXPERIMENTAL_PLUGINS),true)
  161. # Install resources (experimental plugins)
  162. install -m 644 \
  163. bin/resources/at1/*.png \
  164. $(DESTDIR)$(DATADIR)/carla/resources/at1
  165. install -m 644 \
  166. bin/resources/bls1/*.png \
  167. $(DESTDIR)$(DATADIR)/carla/resources/bls1
  168. install -m 644 \
  169. bin/resources/rev1/*.png \
  170. $(DESTDIR)$(DATADIR)/carla/resources/rev1
  171. install -m 755 \
  172. bin/resources/zita-at1-ui \
  173. bin/resources/zita-bls1-ui \
  174. bin/resources/zita-rev1-ui \
  175. $(DESTDIR)$(DATADIR)/carla/resources
  176. endif
  177. features_print_external_plugins:
  178. ifeq ($(HAVE_DGL),true)
  179. @echo "DPF Plugins: $(ANS_YES)(with UI)"
  180. ifeq ($(HAVE_PROJECTM),true)
  181. @echo "DPF ProM: $(ANS_YES)"
  182. else
  183. @echo "DPF ProM: $(ANS_NO) (missing libprojectM)"
  184. endif
  185. else
  186. @echo "DPF Plugins: $(ANS_YES)(without UI)"
  187. ifeq ($(HAVE_PROJECTM),true)
  188. @echo "DPF ProM: $(ANS_NO) $(mS)missing OpenGL$(mE)"
  189. else
  190. @echo "DPF ProM: $(ANS_NO) $(mS)missing OpenGL and libprojectM$(mE)"
  191. endif
  192. endif
  193. ifeq ($(HAVE_ZYN_DEPS),true)
  194. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  195. ifeq ($(HAVE_NTK),true)
  196. @echo "ZynAddSubFX: $(ANS_YES)(with NTK UI)"
  197. else
  198. @echo "ZynAddSubFX: $(ANS_YES)(with FLTK UI)"
  199. endif
  200. else
  201. @echo "ZynAddSubFX: $(ANS_YES)(without UI) $(mS)FLTK or NTK missing$(mE)"
  202. endif
  203. else
  204. @echo "ZynAddSubFX: $(ANS_NO) $(mS)liblo, fftw3, mxml or zlib missing$(mE)"
  205. endif
  206. # ---------------------------------------------------------------------------------------------------------------------