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.

300 lines
9.8KB

  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. au = $(TARGET_DIR)/$(NAME).component/Contents/MacOS/plugin
  46. # ---------------------------------------------------------------------------------------------------------------------
  47. # Set stuff needed for AU
  48. AU_BUILD_FLAGS = \
  49. -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/AUBase \
  50. -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/Utility \
  51. -I$(DPF_PATH)/distrho/src/CoreAudio106/PublicUtility\
  52. -Wno-deprecated-declarations \
  53. -Wno-four-char-constants \
  54. -Wno-overloaded-virtual \
  55. -Wno-unused-parameter
  56. AU_LINK_FLAGS = \
  57. -bundle \
  58. -framework AudioToolbox \
  59. -framework AudioUnit \
  60. -Wl,-exported_symbol,_PluginAUEntry
  61. # not needed yet
  62. # -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/AUCarbonViewBase
  63. # -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/AUInstrumentBase
  64. # -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/AUViewBase
  65. # -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/OtherBases
  66. # -framework CoreAudio
  67. # -framework CoreServices
  68. # ---------------------------------------------------------------------------------------------------------------------
  69. # Handle UI stuff, disable UI support automatically
  70. ifeq ($(FILES_UI),)
  71. UI_TYPE = none
  72. endif
  73. ifeq ($(UI_TYPE),)
  74. UI_TYPE = opengl
  75. endif
  76. ifeq ($(UI_TYPE),cairo)
  77. ifeq ($(HAVE_CAIRO),true)
  78. DGL_FLAGS += $(CAIRO_FLAGS) -DDGL_CAIRO
  79. DGL_LIBS += $(CAIRO_LIBS)
  80. DGL_LIB = $(DPF_PATH)/build/libdgl-cairo.a
  81. HAVE_DGL = true
  82. else
  83. HAVE_DGL = false
  84. endif
  85. endif
  86. ifeq ($(UI_TYPE),opengl)
  87. ifeq ($(HAVE_OPENGL),true)
  88. DGL_FLAGS += $(OPENGL_FLAGS) -DDGL_OPENGL
  89. DGL_LIBS += $(OPENGL_LIBS)
  90. DGL_LIB = $(DPF_PATH)/build/libdgl-opengl.a
  91. HAVE_DGL = true
  92. else
  93. HAVE_DGL = false
  94. endif
  95. endif
  96. DGL_LIBS += $(DGL_SYSTEM_LIBS)
  97. ifneq ($(HAVE_DGL),true)
  98. dssi_ui =
  99. lv2_ui =
  100. DGL_LIBS =
  101. OBJS_UI =
  102. endif
  103. # TODO split dsp and ui object build flags
  104. BASE_FLAGS += $(DGL_FLAGS)
  105. # ---------------------------------------------------------------------------------------------------------------------
  106. # all needs to be first
  107. all:
  108. # ---------------------------------------------------------------------------------------------------------------------
  109. # Common
  110. $(BUILD_DIR)/%.c.o: %.c
  111. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  112. @echo "Compiling $<"
  113. @$(CC) $< $(BUILD_C_FLAGS) -c -o $@
  114. $(BUILD_DIR)/%.cc.o: %.cc
  115. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  116. @echo "Compiling $<"
  117. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  118. $(BUILD_DIR)/%.cpp.o: %.cpp
  119. -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
  120. @echo "Compiling $<"
  121. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  122. clean:
  123. rm -rf $(BUILD_DIR)
  124. rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2
  125. # ---------------------------------------------------------------------------------------------------------------------
  126. $(BUILD_DIR)/DistrhoPluginMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  127. -@mkdir -p $(BUILD_DIR)
  128. @echo "Compiling DistrhoPluginMain.cpp ($*)"
  129. @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  130. $(BUILD_DIR)/DistrhoUIMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  131. -@mkdir -p $(BUILD_DIR)
  132. @echo "Compiling DistrhoUIMain.cpp ($*)"
  133. @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  134. $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  135. -@mkdir -p $(BUILD_DIR)
  136. @echo "Compiling DistrhoPluginMain.cpp (JACK)"
  137. @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags jack) -DDISTRHO_PLUGIN_TARGET_JACK -c -o $@
  138. $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  139. -@mkdir -p $(BUILD_DIR)
  140. @echo "Compiling DistrhoPluginMain.cpp (AU)"
  141. $(CXX) $< $(BUILD_CXX_FLAGS) $(AU_BUILD_FLAGS) -DDISTRHO_PLUGIN_TARGET_AU -c -o $@
  142. $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  143. -@mkdir -p $(BUILD_DIR)
  144. @echo "Compiling DistrhoUIMain.cpp (DSSI)"
  145. @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -c -o $@
  146. # ---------------------------------------------------------------------------------------------------------------------
  147. # JACK
  148. jack: $(jack)
  149. ifeq ($(HAVE_DGL),true)
  150. $(jack): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.o $(DGL_LIB)
  151. else
  152. $(jack): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o
  153. endif
  154. -@mkdir -p $(shell dirname $@)
  155. @echo "Creating JACK standalone for $(NAME)"
  156. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs jack) -o $@
  157. # ---------------------------------------------------------------------------------------------------------------------
  158. # LADSPA
  159. ladspa: $(ladspa_dsp)
  160. $(ladspa_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.o
  161. -@mkdir -p $(shell dirname $@)
  162. @echo "Creating LADSPA plugin for $(NAME)"
  163. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  164. # ---------------------------------------------------------------------------------------------------------------------
  165. # DSSI
  166. dssi: $(dssi_dsp) $(dssi_ui)
  167. dssi_dsp: $(dssi_dsp)
  168. dssi_ui: $(dssi_ui)
  169. $(dssi_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.o
  170. -@mkdir -p $(shell dirname $@)
  171. @echo "Creating DSSI plugin library for $(NAME)"
  172. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  173. $(dssi_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o $(DGL_LIB)
  174. -@mkdir -p $(shell dirname $@)
  175. @echo "Creating DSSI UI for $(NAME)"
  176. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs liblo) -o $@
  177. # ---------------------------------------------------------------------------------------------------------------------
  178. # LV2
  179. lv2: $(lv2)
  180. lv2_dsp: $(lv2_dsp)
  181. lv2_sep: $(lv2_dsp) $(lv2_ui)
  182. $(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
  183. -@mkdir -p $(shell dirname $@)
  184. @echo "Creating LV2 plugin for $(NAME)"
  185. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  186. $(lv2_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o
  187. -@mkdir -p $(shell dirname $@)
  188. @echo "Creating LV2 plugin library for $(NAME)"
  189. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  190. $(lv2_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
  191. -@mkdir -p $(shell dirname $@)
  192. @echo "Creating LV2 plugin UI for $(NAME)"
  193. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  194. # ---------------------------------------------------------------------------------------------------------------------
  195. # VST
  196. vst: $(vst)
  197. ifeq ($(HAVE_DGL),true)
  198. $(vst): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o $(BUILD_DIR)/DistrhoUIMain_VST.cpp.o $(DGL_LIB)
  199. else
  200. $(vst): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o
  201. endif
  202. -@mkdir -p $(shell dirname $@)
  203. @echo "Creating VST plugin for $(NAME)"
  204. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  205. # ---------------------------------------------------------------------------------------------------------------------
  206. # AU
  207. au: $(au)
  208. ifeq ($(HAVE_DGL),true)
  209. $(au): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.o $(BUILD_DIR)/DistrhoUIMain_AU.cpp.o $(DGL_LIB)
  210. else
  211. $(au): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.o
  212. endif
  213. -@mkdir -p $(shell dirname $@)
  214. @echo "Creating AU plugin for $(NAME)"
  215. $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(AU_LINK_FLAGS) $(DGL_LIBS) -o $@
  216. # ---------------------------------------------------------------------------------------------------------------------
  217. -include $(OBJS_DSP:%.o=%.d)
  218. ifeq ($(HAVE_DGL),true)
  219. -include $(OBJS_UI:%.o=%.d)
  220. endif
  221. -include $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.d
  222. -include $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.d
  223. -include $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.d
  224. -include $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.d
  225. -include $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.d
  226. -include $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.d
  227. -include $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.d
  228. -include $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.d
  229. -include $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.d
  230. -include $(BUILD_DIR)/DistrhoUIMain_VST.cpp.d
  231. -include $(BUILD_DIR)/DistrhoUIMain_AU.cpp.d
  232. # ---------------------------------------------------------------------------------------------------------------------