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.

251 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. DGL_LIBS += $(DGL_SYSTEM_LIBS)
  74. ifneq ($(HAVE_DGL),true)
  75. dssi_ui =
  76. lv2_ui =
  77. DGL_LIBS =
  78. OBJS_UI =
  79. endif
  80. # TODO split dsp and ui object build flags
  81. BASE_FLAGS += $(DGL_FLAGS)
  82. # ---------------------------------------------------------------------------------------------------------------------
  83. # all needs to be first
  84. all:
  85. # ---------------------------------------------------------------------------------------------------------------------
  86. # Common
  87. $(BUILD_DIR)/%.c.o: %.c
  88. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  89. @echo "Compiling $<"
  90. @$(CC) $< $(BUILD_C_FLAGS) -c -o $@
  91. $(BUILD_DIR)/%.cc.o: %.cc
  92. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  93. @echo "Compiling $<"
  94. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  95. $(BUILD_DIR)/%.cpp.o: %.cpp
  96. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  97. @echo "Compiling $<"
  98. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  99. clean:
  100. rm -rf $(BUILD_DIR)
  101. rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2
  102. # ---------------------------------------------------------------------------------------------------------------------
  103. $(BUILD_DIR)/DistrhoPluginMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  104. -@mkdir -p $(BUILD_DIR)
  105. @echo "Compiling DistrhoPluginMain.cpp ($*)"
  106. @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  107. $(BUILD_DIR)/DistrhoUIMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  108. -@mkdir -p $(BUILD_DIR)
  109. @echo "Compiling DistrhoUIMain.cpp ($*)"
  110. @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  111. $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  112. -@mkdir -p $(BUILD_DIR)
  113. @echo "Compiling DistrhoPluginMain.cpp (JACK)"
  114. @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags jack) -DDISTRHO_PLUGIN_TARGET_JACK -c -o $@
  115. $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  116. -@mkdir -p $(BUILD_DIR)
  117. @echo "Compiling DistrhoUIMain.cpp (DSSI)"
  118. @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -c -o $@
  119. # ---------------------------------------------------------------------------------------------------------------------
  120. # JACK
  121. jack: $(jack)
  122. ifeq ($(HAVE_DGL),true)
  123. $(jack): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.o $(DGL_LIB)
  124. else
  125. $(jack): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o
  126. endif
  127. -@mkdir -p $(shell dirname $@)
  128. @echo "Creating JACK standalone for $(NAME)"
  129. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs jack) -o $@
  130. # ---------------------------------------------------------------------------------------------------------------------
  131. # LADSPA
  132. ladspa: $(ladspa_dsp)
  133. $(ladspa_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.o
  134. -@mkdir -p $(shell dirname $@)
  135. @echo "Creating LADSPA plugin for $(NAME)"
  136. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  137. # ---------------------------------------------------------------------------------------------------------------------
  138. # DSSI
  139. dssi: $(dssi_dsp) $(dssi_ui)
  140. dssi_dsp: $(dssi_dsp)
  141. dssi_ui: $(dssi_ui)
  142. $(dssi_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.o
  143. -@mkdir -p $(shell dirname $@)
  144. @echo "Creating DSSI plugin library for $(NAME)"
  145. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  146. $(dssi_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o $(DGL_LIB)
  147. -@mkdir -p $(shell dirname $@)
  148. @echo "Creating DSSI UI for $(NAME)"
  149. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs liblo) -o $@
  150. # ---------------------------------------------------------------------------------------------------------------------
  151. # LV2
  152. lv2: $(lv2)
  153. lv2_dsp: $(lv2_dsp)
  154. lv2_sep: $(lv2_dsp) $(lv2_ui)
  155. $(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
  156. -@mkdir -p $(shell dirname $@)
  157. @echo "Creating LV2 plugin for $(NAME)"
  158. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  159. $(lv2_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o
  160. -@mkdir -p $(shell dirname $@)
  161. @echo "Creating LV2 plugin library for $(NAME)"
  162. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  163. $(lv2_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
  164. -@mkdir -p $(shell dirname $@)
  165. @echo "Creating LV2 plugin UI for $(NAME)"
  166. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  167. # ---------------------------------------------------------------------------------------------------------------------
  168. # VST
  169. vst: $(vst)
  170. ifeq ($(HAVE_DGL),true)
  171. $(vst): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o $(BUILD_DIR)/DistrhoUIMain_VST.cpp.o $(DGL_LIB)
  172. else
  173. $(vst): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o
  174. endif
  175. -@mkdir -p $(shell dirname $@)
  176. @echo "Creating VST plugin for $(NAME)"
  177. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  178. # ---------------------------------------------------------------------------------------------------------------------
  179. -include $(OBJS_DSP:%.o=%.d)
  180. ifeq ($(HAVE_DGL),true)
  181. -include $(OBJS_UI:%.o=%.d)
  182. endif
  183. -include $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.d
  184. -include $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.d
  185. -include $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.d
  186. -include $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.d
  187. -include $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.d
  188. -include $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.d
  189. -include $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.d
  190. -include $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.d
  191. -include $(BUILD_DIR)/DistrhoUIMain_VST.cpp.d
  192. # ---------------------------------------------------------------------------------------------------------------------