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.

227 lines
6.4KB

  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. ifneq ($(MACOS_OLD),true)
  19. HAVE_ZYN_DEPS = $(shell pkg-config --exists liblo fftw3 mxml zlib && echo true)
  20. endif
  21. # ---------------------------------------------------------------------------------------------------------------------
  22. # Check for optional libs (special non-pkgconfig unix tests)
  23. ifeq ($(UNIX),true)
  24. # fltk doesn't have a pkg-config file but has fltk-config instead.
  25. # Also, don't try looking for it if we already have NTK.
  26. ifneq ($(HAVE_NTK),true)
  27. ifeq ($(shell which fltk-config 1>/dev/null 2>/dev/null && echo true),true)
  28. ifeq ($(shell which fluid 1>/dev/null 2>/dev/null && echo true),true)
  29. HAVE_FLTK = true
  30. endif
  31. endif
  32. endif
  33. endif
  34. # ---------------------------------------------------------------------------------------------------------------------
  35. ifeq ($(HAVE_FLTK),true)
  36. HAVE_ZYN_UI_DEPS = true
  37. endif
  38. ifeq ($(HAVE_NTK),true)
  39. HAVE_ZYN_UI_DEPS = true
  40. endif
  41. # ---------------------------------------------------------------------------------------------------------------------
  42. ifeq ($(HAVE_DGL),true)
  43. BASE_FLAGS += -DHAVE_DGL
  44. endif
  45. ifeq ($(HAVE_PROJECTM),true)
  46. BASE_FLAGS += -DHAVE_PROJECTM
  47. endif
  48. ifeq ($(HAVE_ZYN_DEPS),true)
  49. BASE_FLAGS += -DHAVE_ZYN_DEPS
  50. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  51. BASE_FLAGS += -DHAVE_ZYN_UI_DEPS
  52. endif
  53. endif
  54. # ---------------------------------------------------------------------------------------------------------------------
  55. ifeq ($(HAVE_DGL),true)
  56. ifeq ($(MACOS_OR_WIN32),true)
  57. ifeq ($(MACOS),true)
  58. DGL_LIBS = -framework OpenGL -framework Cocoa
  59. endif
  60. ifeq ($(WIN32),true)
  61. DGL_LIBS = -lopengl32 -lgdi32
  62. endif
  63. else
  64. DGL_FLAGS = $(shell pkg-config --cflags gl x11)
  65. DGL_LIBS = $(shell pkg-config --libs gl x11)
  66. endif
  67. DGL_FLAGS += -DDGL_NAMESPACE=CarlaDGL -DDGL_FILE_BROWSER_DISABLED -DDGL_NO_SHARED_RESOURCES
  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 += $(shell pkg-config --cflags gl)
  79. DPF_FLAGS += -I$(CWDE)/modules/dgl -DDGL_NAMESPACE=CarlaDGL -DDGL_FILE_BROWSER_DISABLED -DDGL_NO_SHARED_RESOURCES
  80. endif
  81. # ---------------------------------------------------------------------------------------------------------------------
  82. # Flags for ZynAddSubFX (DSP and UI separated)
  83. ifeq ($(HAVE_ZYN_DEPS),true)
  84. # Common flags
  85. ZYN_BASE_FLAGS = $(shell pkg-config --cflags liblo mxml)
  86. ZYN_BASE_FLAGS += -Izynaddsubfx -Izynaddsubfx/rtosc
  87. ifneq ($(WIN32),true)
  88. ZYN_BASE_FLAGS += -DHAVE_ASYNC
  89. endif
  90. ZYN_BASE_LIBS = $(shell pkg-config --libs liblo mxml) -lpthread
  91. ZYN_BASE_LIBS += $(LIBDL_LIBS)
  92. # DSP flags
  93. ZYN_DSP_FLAGS = $(ZYN_BASE_FLAGS)
  94. ZYN_DSP_FLAGS += $(shell pkg-config --cflags fftw3 zlib)
  95. ZYN_DSP_LIBS = $(ZYN_BASE_LIBS)
  96. ZYN_DSP_LIBS += $(shell pkg-config --libs fftw3 zlib)
  97. # UI flags
  98. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  99. # Common UI flags
  100. ZYN_UI_FLAGS = $(ZYN_BASE_FLAGS)
  101. ZYN_UI_LIBS = $(ZYN_BASE_LIBS)
  102. # NTK or FLTK UI flags
  103. ifeq ($(HAVE_NTK),true)
  104. FLUID = ntk-fluid
  105. ZYN_UI_FLAGS += $(shell pkg-config --cflags ntk_images ntk) -DNTK_GUI
  106. ZYN_UI_LIBS += $(shell pkg-config --libs ntk_images ntk)
  107. else # HAVE_NTK
  108. FLUID = fluid
  109. ZYN_UI_FLAGS += $(shell fltk-config --use-images --cxxflags) -DFLTK_GUI
  110. ZYN_UI_LIBS += $(shell fltk-config --use-images --ldflags)
  111. endif # HAVE_NTK
  112. # UI extra flags
  113. ifeq ($(HAVE_X11),true)
  114. ZYN_UI_FLAGS += $(shell pkg-config --cflags x11)
  115. ZYN_UI_LIBS += $(shell pkg-config --libs x11)
  116. endif
  117. ifeq ($(LINUX),true)
  118. ZYN_UI_LIBS += -lrt
  119. endif
  120. else # HAVE_ZYN_UI_DEPS
  121. ZYN_DSP_FLAGS += -DNO_UI
  122. endif # HAVE_ZYN_UI_DEPS
  123. endif # HAVE_ZYN_DEPS
  124. # ---------------------------------------------------------------------------------------------------------------------
  125. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  126. NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS)
  127. NATIVE_PLUGINS_LIBS += $(ZYN_DSP_LIBS)
  128. NATIVE_PLUGINS_LIBS += $(ZITA_DSP_LIBS)
  129. # ---------------------------------------------------------------------------------------------------------------------
  130. ifeq ($(HAVE_DGL),true)
  131. ALL_LIBS += $(MODULEDIR)/dgl.a
  132. endif
  133. # ---------------------------------------------------------------------------------------------------------------------
  134. all:
  135. install_external_plugins:
  136. ifeq ($(HAVE_ZYN_DEPS),true)
  137. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  138. # Create directories (zynaddsubfx)
  139. install -d $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  140. # Install resources (zynaddsubfx)
  141. install -m 644 \
  142. bin/resources/zynaddsubfx/*.png \
  143. $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  144. install -m 755 \
  145. bin/resources/zynaddsubfx-ui \
  146. $(DESTDIR)$(DATADIR)/carla/resources
  147. endif
  148. endif
  149. features_print_external_plugins:
  150. @printf -- "\n"
  151. @printf -- "$(tS)---> External plugins: $(tE)\n"
  152. ifeq ($(HAVE_DGL),true)
  153. @printf -- "DPF Plugins: $(ANS_YES) (with UI)\n"
  154. ifeq ($(HAVE_PROJECTM),true)
  155. @printf -- "DPF ProM: $(ANS_YES)\n"
  156. else
  157. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing libprojectM$(mE)\n"
  158. endif
  159. else
  160. @printf -- "DPF Plugins: $(ANS_YES) (without UI)\n"
  161. ifeq ($(HAVE_PROJECTM),true)
  162. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL$(mE)\n"
  163. else
  164. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL and libprojectM$(mE)\n"
  165. endif
  166. endif
  167. ifeq ($(HAVE_ZYN_DEPS),true)
  168. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  169. ifeq ($(HAVE_NTK),true)
  170. @printf -- "ZynAddSubFX: $(ANS_YES) (with NTK UI)\n"
  171. else
  172. @printf -- "ZynAddSubFX: $(ANS_YES) (with FLTK UI)\n"
  173. endif
  174. else
  175. @printf -- "ZynAddSubFX: $(ANS_YES) (without UI) $(mS)FLTK or NTK missing$(mE)\n"
  176. endif
  177. else
  178. @printf -- "ZynAddSubFX: $(ANS_NO) $(mS)liblo, fftw3, mxml or zlib missing$(mE)\n"
  179. endif
  180. # ---------------------------------------------------------------------------------------------------------------------