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.

222 lines
6.1KB

  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. # ---------------------------------------------------------------------------------------------------------------------
  53. ifeq ($(HAVE_DGL),true)
  54. ifeq ($(MACOS_OR_WIN32),true)
  55. ifeq ($(MACOS),true)
  56. DGL_LIBS = -framework OpenGL -framework Cocoa
  57. endif
  58. ifeq ($(WIN32),true)
  59. DGL_LIBS = -lopengl32 -lgdi32
  60. endif
  61. else
  62. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  63. DGL_LIBS = $(shell pkg-config --libs gl x11)
  64. endif
  65. endif
  66. # ---------------------------------------------------------------------------------------------------------------------
  67. ifeq ($(HAVE_PROJECTM),true)
  68. PROJECTM_FLAGS = $(shell pkg-config --cflags libprojectM)
  69. PROJECTM_LIBS = $(shell pkg-config --libs libprojectM)
  70. endif
  71. # ---------------------------------------------------------------------------------------------------------------------
  72. # Flags for DPF Plugins
  73. DPF_FLAGS = -I$(CWDE)/modules/distrho
  74. ifeq ($(HAVE_DGL),true)
  75. DPF_FLAGS += -I$(CWDE)/modules/dgl
  76. endif
  77. # ---------------------------------------------------------------------------------------------------------------------
  78. # Flags for ZynAddSubFX (DSP and UI separated)
  79. ifeq ($(HAVE_ZYN_DEPS),true)
  80. # Common flags
  81. ZYN_BASE_FLAGS = $(shell pkg-config --cflags liblo mxml)
  82. ZYN_BASE_FLAGS += -Izynaddsubfx -Izynaddsubfx/rtosc
  83. ifneq ($(WIN32),true)
  84. ZYN_BASE_FLAGS += -DHAVE_ASYNC
  85. endif
  86. ZYN_BASE_LIBS = $(shell pkg-config --libs liblo mxml) -lpthread
  87. ZYN_BASE_LIBS += $(LIBDL_LIBS)
  88. # DSP flags
  89. ZYN_DSP_FLAGS = $(ZYN_BASE_FLAGS)
  90. ZYN_DSP_FLAGS += $(shell pkg-config --cflags fftw3 zlib)
  91. ZYN_DSP_LIBS = $(ZYN_BASE_LIBS)
  92. ZYN_DSP_LIBS += $(shell pkg-config --libs fftw3 zlib)
  93. # UI flags
  94. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  95. # Common UI flags
  96. ZYN_UI_FLAGS = $(ZYN_BASE_FLAGS)
  97. ZYN_UI_LIBS = $(ZYN_BASE_LIBS)
  98. # NTK or FLTK UI flags
  99. ifeq ($(HAVE_NTK),true)
  100. FLUID = ntk-fluid
  101. ZYN_UI_FLAGS += $(shell pkg-config --cflags ntk_images ntk) -DNTK_GUI
  102. ZYN_UI_LIBS += $(shell pkg-config --libs ntk_images ntk)
  103. else # HAVE_NTK
  104. FLUID = fluid
  105. ZYN_UI_FLAGS += $(shell fltk-config --use-images --cxxflags) -DFLTK_GUI
  106. ZYN_UI_LIBS += $(shell fltk-config --use-images --ldflags)
  107. endif # HAVE_NTK
  108. # UI extra flags
  109. ifeq ($(HAVE_X11),true)
  110. ZYN_UI_FLAGS += $(shell pkg-config --cflags x11)
  111. ZYN_UI_LIBS += $(shell pkg-config --libs x11)
  112. endif
  113. ifeq ($(LINUX),true)
  114. ZYN_UI_LIBS += -lrt
  115. endif
  116. else # HAVE_ZYN_UI_DEPS
  117. ZYN_DSP_FLAGS += -DNO_UI
  118. endif # HAVE_ZYN_UI_DEPS
  119. endif # HAVE_ZYN_DEPS
  120. # ---------------------------------------------------------------------------------------------------------------------
  121. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  122. NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS)
  123. NATIVE_PLUGINS_LIBS += $(ZYN_DSP_LIBS)
  124. NATIVE_PLUGINS_LIBS += $(ZITA_DSP_LIBS)
  125. # ---------------------------------------------------------------------------------------------------------------------
  126. ifeq ($(HAVE_DGL),true)
  127. ALL_LIBS += $(MODULEDIR)/dgl.a
  128. endif
  129. # ---------------------------------------------------------------------------------------------------------------------
  130. all:
  131. install_external_plugins:
  132. ifeq ($(HAVE_ZYN_DEPS),true)
  133. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  134. # Create directories (zynaddsubfx)
  135. install -d $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  136. # Install resources (zynaddsubfx)
  137. install -m 644 \
  138. bin/resources/zynaddsubfx/*.png \
  139. $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  140. install -m 755 \
  141. bin/resources/zynaddsubfx-ui \
  142. $(DESTDIR)$(DATADIR)/carla/resources
  143. endif
  144. endif
  145. features_print_external_plugins:
  146. @printf -- "\n"
  147. @printf -- "$(tS)---> External plugins: $(tE)\n"
  148. ifeq ($(HAVE_DGL),true)
  149. @printf -- "DPF Plugins: $(ANS_YES) (with UI)\n"
  150. ifeq ($(HAVE_PROJECTM),true)
  151. @printf -- "DPF ProM: $(ANS_YES)\n"
  152. else
  153. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing libprojectM$(mE)\n"
  154. endif
  155. else
  156. @printf -- "DPF Plugins: $(ANS_YES) (without UI)\n"
  157. ifeq ($(HAVE_PROJECTM),true)
  158. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL$(mE)\n"
  159. else
  160. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL and libprojectM$(mE)\n"
  161. endif
  162. endif
  163. ifeq ($(HAVE_ZYN_DEPS),true)
  164. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  165. ifeq ($(HAVE_NTK),true)
  166. @printf -- "ZynAddSubFX: $(ANS_YES) (with NTK UI)\n"
  167. else
  168. @printf -- "ZynAddSubFX: $(ANS_YES) (with FLTK UI)\n"
  169. endif
  170. else
  171. @printf -- "ZynAddSubFX: $(ANS_YES) (without UI) $(mS)FLTK or NTK missing$(mE)\n"
  172. endif
  173. else
  174. @printf -- "ZynAddSubFX: $(ANS_NO) $(mS)liblo, fftw3, mxml or zlib missing$(mE)\n"
  175. endif
  176. # ---------------------------------------------------------------------------------------------------------------------