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.

226 lines
6.3KB

  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 += -I$(CWDE)/modules/dgl -DDGL_NAMESPACE=CarlaDGL -DDGL_FILE_BROWSER_DISABLED -DDGL_NO_SHARED_RESOURCES
  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. NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
  125. NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS)
  126. NATIVE_PLUGINS_LIBS += $(ZYN_DSP_LIBS)
  127. NATIVE_PLUGINS_LIBS += $(ZITA_DSP_LIBS)
  128. # ---------------------------------------------------------------------------------------------------------------------
  129. ifeq ($(HAVE_DGL),true)
  130. ALL_LIBS += $(MODULEDIR)/dgl.a
  131. endif
  132. # ---------------------------------------------------------------------------------------------------------------------
  133. all:
  134. install_external_plugins:
  135. ifeq ($(HAVE_ZYN_DEPS),true)
  136. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  137. # Create directories (zynaddsubfx)
  138. install -d $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  139. # Install resources (zynaddsubfx)
  140. install -m 644 \
  141. bin/resources/zynaddsubfx/*.png \
  142. $(DESTDIR)$(DATADIR)/carla/resources/zynaddsubfx
  143. install -m 755 \
  144. bin/resources/zynaddsubfx-ui \
  145. $(DESTDIR)$(DATADIR)/carla/resources
  146. endif
  147. endif
  148. features_print_external_plugins:
  149. @printf -- "\n"
  150. @printf -- "$(tS)---> External plugins: $(tE)\n"
  151. ifeq ($(HAVE_DGL),true)
  152. @printf -- "DPF Plugins: $(ANS_YES) (with UI)\n"
  153. ifeq ($(HAVE_PROJECTM),true)
  154. @printf -- "DPF ProM: $(ANS_YES)\n"
  155. else
  156. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing libprojectM$(mE)\n"
  157. endif
  158. else
  159. @printf -- "DPF Plugins: $(ANS_YES) (without UI)\n"
  160. ifeq ($(HAVE_PROJECTM),true)
  161. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL$(mE)\n"
  162. else
  163. @printf -- "DPF ProM: $(ANS_NO) $(mS)missing OpenGL and libprojectM$(mE)\n"
  164. endif
  165. endif
  166. ifeq ($(HAVE_ZYN_DEPS),true)
  167. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  168. ifeq ($(HAVE_NTK),true)
  169. @printf -- "ZynAddSubFX: $(ANS_YES) (with NTK UI)\n"
  170. else
  171. @printf -- "ZynAddSubFX: $(ANS_YES) (with FLTK UI)\n"
  172. endif
  173. else
  174. @printf -- "ZynAddSubFX: $(ANS_YES) (without UI) $(mS)FLTK or NTK missing$(mE)\n"
  175. endif
  176. else
  177. @printf -- "ZynAddSubFX: $(ANS_NO) $(mS)liblo, fftw3, mxml or zlib missing$(mE)\n"
  178. endif
  179. # ---------------------------------------------------------------------------------------------------------------------