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.

229 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. ifneq ($(MACOS_OR_WIN32),true)
  79. DPF_FLAGS += $(shell pkg-config --cflags gl)
  80. endif
  81. DPF_FLAGS += -I$(CWDE)/modules/dgl -DDGL_NAMESPACE=CarlaDGL -DDGL_FILE_BROWSER_DISABLED -DDGL_NO_SHARED_RESOURCES
  82. endif
  83. # ---------------------------------------------------------------------------------------------------------------------
  84. # Flags for ZynAddSubFX (DSP and UI separated)
  85. ifeq ($(HAVE_ZYN_DEPS),true)
  86. # Common flags
  87. ZYN_BASE_FLAGS = $(shell pkg-config --cflags liblo mxml)
  88. ZYN_BASE_FLAGS += -Izynaddsubfx -Izynaddsubfx/rtosc
  89. ifneq ($(WIN32),true)
  90. ZYN_BASE_FLAGS += -DHAVE_ASYNC
  91. endif
  92. ZYN_BASE_LIBS = $(shell pkg-config --libs liblo mxml) -lpthread
  93. ZYN_BASE_LIBS += $(LIBDL_LIBS)
  94. # DSP flags
  95. ZYN_DSP_FLAGS = $(ZYN_BASE_FLAGS)
  96. ZYN_DSP_FLAGS += $(shell pkg-config --cflags fftw3 zlib)
  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. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  128. NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS)
  129. NATIVE_PLUGINS_LIBS += $(ZYN_DSP_LIBS)
  130. NATIVE_PLUGINS_LIBS += $(ZITA_DSP_LIBS)
  131. # ---------------------------------------------------------------------------------------------------------------------
  132. ifeq ($(HAVE_DGL),true)
  133. ALL_LIBS += $(MODULEDIR)/dgl.a
  134. endif
  135. # ---------------------------------------------------------------------------------------------------------------------
  136. all:
  137. install_external_plugins:
  138. ifeq ($(HAVE_ZYN_DEPS),true)
  139. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  140. # Create directories (zynaddsubfx)
  141. install -d $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  142. # Install resources (zynaddsubfx)
  143. install -m 644 \
  144. bin/resources/zynaddsubfx/*.png \
  145. $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  146. install -m 755 \
  147. bin/resources/zynaddsubfx-ui \
  148. $(DESTDIR)$(DATADIR)/carla/resources
  149. endif
  150. endif
  151. features_print_external_plugins:
  152. @printf -- "\n"
  153. @printf -- "$(tS)---> External plugins: $(tE)\n"
  154. ifeq ($(HAVE_DGL),true)
  155. @printf -- "DPF Plugins: $(ANS_YES) (with UI)\n"
  156. ifeq ($(HAVE_PROJECTM),true)
  157. @printf -- "DPF ProM: $(ANS_YES)\n"
  158. else
  159. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing libprojectM$(mE)\n"
  160. endif
  161. else
  162. @printf -- "DPF Plugins: $(ANS_YES) (without UI)\n"
  163. ifeq ($(HAVE_PROJECTM),true)
  164. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL$(mE)\n"
  165. else
  166. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL and libprojectM$(mE)\n"
  167. endif
  168. endif
  169. ifeq ($(HAVE_ZYN_DEPS),true)
  170. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  171. ifeq ($(HAVE_NTK),true)
  172. @printf -- "ZynAddSubFX: $(ANS_YES) (with NTK UI)\n"
  173. else
  174. @printf -- "ZynAddSubFX: $(ANS_YES) (with FLTK UI)\n"
  175. endif
  176. else
  177. @printf -- "ZynAddSubFX: $(ANS_YES) (without UI) $(mS)FLTK or NTK missing$(mE)\n"
  178. endif
  179. else
  180. @printf -- "ZynAddSubFX: $(ANS_NO) $(mS)liblo, fftw3, mxml or zlib missing$(mE)\n"
  181. endif
  182. # ---------------------------------------------------------------------------------------------------------------------