DISTRHO Plugin Framework
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.

Makefile.plugins.mk 8.3KB

3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. #!/usr/bin/make -f
  2. # Makefile for DPF Example Plugins #
  3. # -------------------------------- #
  4. # Created by falkTX
  5. #
  6. # NOTE: NAME, FILES_DSP and FILES_UI must have been defined before including this file!
  7. ifeq ($(DPF_CUSTOM_PATH),)
  8. ifeq (,$(wildcard ../../Makefile.base.mk))
  9. DPF_PATH=../../dpf
  10. else
  11. DPF_PATH=../..
  12. endif
  13. else
  14. DPF_PATH = $(DPF_CUSTOM_PATH)
  15. endif
  16. include $(DPF_PATH)/Makefile.base.mk
  17. # ---------------------------------------------------------------------------------------------------------------------
  18. # Basic setup
  19. ifeq ($(DPF_CUSTOM_PATH),)
  20. TARGET_DIR = ../../bin
  21. BUILD_DIR = ../../build/$(NAME)
  22. else
  23. ifeq ($(DPF_CUSTOM_TARGET_DIR),)
  24. $(error DPF_CUSTOM_TARGET_DIR is not set)
  25. else
  26. TARGET_DIR = $(DPF_CUSTOM_TARGET_DIR)
  27. endif
  28. ifeq ($(DPF_CUSTOM_BUILD_DIR),)
  29. $(error DPF_CUSTOM_BUILD_DIR is not set)
  30. else
  31. BUILD_DIR = $(DPF_CUSTOM_BUILD_DIR)
  32. endif
  33. endif
  34. BUILD_C_FLAGS += -I.
  35. BUILD_CXX_FLAGS += -I. -I$(DPF_PATH)/distrho -I$(DPF_PATH)/dgl
  36. ifeq ($(HAVE_JACK),true)
  37. BASE_FLAGS += -DHAVE_JACK
  38. endif
  39. ifeq ($(HAVE_LIBLO),true)
  40. BASE_FLAGS += -DHAVE_LIBLO
  41. endif
  42. # ---------------------------------------------------------------------------------------------------------------------
  43. # Set files to build
  44. OBJS_DSP = $(FILES_DSP:%=$(BUILD_DIR)/%.o)
  45. OBJS_UI = $(FILES_UI:%=$(BUILD_DIR)/%.o)
  46. # ---------------------------------------------------------------------------------------------------------------------
  47. # Set plugin binary file targets
  48. jack = $(TARGET_DIR)/$(NAME)$(APP_EXT)
  49. ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT)
  50. dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi$(LIB_EXT)
  51. dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui$(APP_EXT)
  52. lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT)
  53. lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT)
  54. lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT)
  55. vst = $(TARGET_DIR)/$(NAME)-vst$(LIB_EXT)
  56. # ---------------------------------------------------------------------------------------------------------------------
  57. # Handle UI stuff, disable UI support automatically
  58. ifeq ($(FILES_UI),)
  59. UI_TYPE = none
  60. endif
  61. ifeq ($(UI_TYPE),)
  62. UI_TYPE = opengl
  63. endif
  64. ifeq ($(UI_TYPE),cairo)
  65. ifeq ($(HAVE_CAIRO),true)
  66. DGL_FLAGS += -DDGL_CAIRO
  67. DGL_FLAGS += $(CAIRO_FLAGS)
  68. DGL_LIBS += $(CAIRO_LIBS)
  69. DGL_LIB = $(DPF_PATH)/build/libdgl-cairo.a
  70. HAVE_DGL = true
  71. else
  72. HAVE_DGL = false
  73. endif
  74. endif
  75. ifeq ($(UI_TYPE),opengl)
  76. ifeq ($(HAVE_OPENGL),true)
  77. DGL_FLAGS += -DDGL_OPENGL
  78. DGL_FLAGS += $(OPENGL_FLAGS)
  79. DGL_LIBS += $(OPENGL_LIBS)
  80. DGL_LIB = $(DPF_PATH)/build/libdgl-opengl.a
  81. HAVE_DGL = true
  82. else
  83. HAVE_DGL = false
  84. endif
  85. endif
  86. ifeq ($(UI_TYPE),external)
  87. DGL_FLAGS += -DDGL_EXTERNAL
  88. HAVE_DGL = true
  89. endif
  90. DGL_LIBS += $(DGL_SYSTEM_LIBS) -lm
  91. ifneq ($(HAVE_DGL),true)
  92. dssi_ui =
  93. lv2_ui =
  94. DGL_LIBS =
  95. OBJS_UI =
  96. endif
  97. ifneq ($(HAVE_LIBLO),true)
  98. dssi_ui =
  99. endif
  100. # TODO split dsp and ui object build flags
  101. BASE_FLAGS += $(DGL_FLAGS)
  102. # ---------------------------------------------------------------------------------------------------------------------
  103. # all needs to be first
  104. all:
  105. # ---------------------------------------------------------------------------------------------------------------------
  106. # Common
  107. $(BUILD_DIR)/%.c.o: %.c
  108. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  109. @echo "Compiling $<"
  110. $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@
  111. $(BUILD_DIR)/%.cc.o: %.cc
  112. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  113. @echo "Compiling $<"
  114. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  115. $(BUILD_DIR)/%.cpp.o: %.cpp
  116. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  117. @echo "Compiling $<"
  118. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  119. clean:
  120. rm -rf $(BUILD_DIR)
  121. rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2
  122. # ---------------------------------------------------------------------------------------------------------------------
  123. $(BUILD_DIR)/DistrhoPluginMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  124. -@mkdir -p $(BUILD_DIR)
  125. @echo "Compiling DistrhoPluginMain.cpp ($*)"
  126. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  127. $(BUILD_DIR)/DistrhoUIMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  128. -@mkdir -p $(BUILD_DIR)
  129. @echo "Compiling DistrhoUIMain.cpp ($*)"
  130. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  131. $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  132. -@mkdir -p $(BUILD_DIR)
  133. @echo "Compiling DistrhoPluginMain.cpp (JACK)"
  134. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(JACK_FLAGS) -DDISTRHO_PLUGIN_TARGET_JACK -c -o $@
  135. $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  136. -@mkdir -p $(BUILD_DIR)
  137. @echo "Compiling DistrhoUIMain.cpp (DSSI)"
  138. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(LIBLO_FLAGS) -DDISTRHO_PLUGIN_TARGET_DSSI -c -o $@
  139. # ---------------------------------------------------------------------------------------------------------------------
  140. # JACK
  141. jack: $(jack)
  142. ifeq ($(HAVE_DGL),true)
  143. $(jack): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.o $(DGL_LIB)
  144. else
  145. $(jack): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o
  146. endif
  147. -@mkdir -p $(shell dirname $@)
  148. @echo "Creating JACK standalone for $(NAME)"
  149. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(JACK_LIBS) -o $@
  150. # ---------------------------------------------------------------------------------------------------------------------
  151. # LADSPA
  152. ladspa: $(ladspa_dsp)
  153. $(ladspa_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.o
  154. -@mkdir -p $(shell dirname $@)
  155. @echo "Creating LADSPA plugin for $(NAME)"
  156. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  157. # ---------------------------------------------------------------------------------------------------------------------
  158. # DSSI
  159. dssi: $(dssi_dsp) $(dssi_ui)
  160. dssi_dsp: $(dssi_dsp)
  161. dssi_ui: $(dssi_ui)
  162. $(dssi_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.o
  163. -@mkdir -p $(shell dirname $@)
  164. @echo "Creating DSSI plugin library for $(NAME)"
  165. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  166. $(dssi_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o $(DGL_LIB)
  167. -@mkdir -p $(shell dirname $@)
  168. @echo "Creating DSSI UI for $(NAME)"
  169. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(LIBLO_LIBS) -o $@
  170. # ---------------------------------------------------------------------------------------------------------------------
  171. # LV2
  172. lv2: $(lv2)
  173. lv2_dsp: $(lv2_dsp)
  174. lv2_sep: $(lv2_dsp) $(lv2_ui)
  175. $(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
  176. -@mkdir -p $(shell dirname $@)
  177. @echo "Creating LV2 plugin for $(NAME)"
  178. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  179. $(lv2_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o
  180. -@mkdir -p $(shell dirname $@)
  181. @echo "Creating LV2 plugin library for $(NAME)"
  182. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  183. $(lv2_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
  184. -@mkdir -p $(shell dirname $@)
  185. @echo "Creating LV2 plugin UI for $(NAME)"
  186. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  187. # ---------------------------------------------------------------------------------------------------------------------
  188. # VST
  189. vst: $(vst)
  190. ifeq ($(HAVE_DGL),true)
  191. $(vst): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o $(BUILD_DIR)/DistrhoUIMain_VST.cpp.o $(DGL_LIB)
  192. else
  193. $(vst): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o
  194. endif
  195. -@mkdir -p $(shell dirname $@)
  196. @echo "Creating VST plugin for $(NAME)"
  197. $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  198. # ---------------------------------------------------------------------------------------------------------------------
  199. -include $(OBJS_DSP:%.o=%.d)
  200. ifneq ($(UI_TYPE),)
  201. -include $(OBJS_UI:%.o=%.d)
  202. endif
  203. -include $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.d
  204. -include $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.d
  205. -include $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.d
  206. -include $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.d
  207. -include $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.d
  208. -include $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.d
  209. -include $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.d
  210. -include $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.d
  211. -include $(BUILD_DIR)/DistrhoUIMain_VST.cpp.d
  212. # ---------------------------------------------------------------------------------------------------------------------