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.

249 lines
7.9KB

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