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 7.2KB

6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. ifeq ($(FILES_UI),)
  14. HAVE_DGL = false
  15. endif
  16. # ---------------------------------------------------------------------------------------------------------------------
  17. # Basic setup
  18. TARGET_DIR = ../../bin
  19. BUILD_DIR = ../../build/$(NAME)
  20. BUILD_C_FLAGS += -I.
  21. BUILD_CXX_FLAGS += -I. -I$(DPF_PATH)/distrho -I$(DPF_PATH)/dgl
  22. ifeq ($(HAVE_DGL),true)
  23. BASE_FLAGS += -DHAVE_DGL
  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 plugins without UI
  47. ifneq ($(HAVE_DGL),true)
  48. dssi_ui =
  49. lv2_ui =
  50. DGL_LIBS =
  51. OBJS_UI =
  52. endif
  53. # ---------------------------------------------------------------------------------------------------------------------
  54. # all needs to be first
  55. all:
  56. # ---------------------------------------------------------------------------------------------------------------------
  57. # Common
  58. $(BUILD_DIR)/%.c.o: %.c
  59. -@mkdir -p $(BUILD_DIR)
  60. @echo "Compiling $<"
  61. @$(CC) $< $(BUILD_C_FLAGS) -c -o $@
  62. $(BUILD_DIR)/%.cpp.o: %.cpp
  63. -@mkdir -p $(BUILD_DIR)
  64. @echo "Compiling $<"
  65. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  66. clean:
  67. rm -rf $(BUILD_DIR)
  68. rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2
  69. # ---------------------------------------------------------------------------------------------------------------------
  70. $(BUILD_DIR)/DistrhoPluginMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  71. -@mkdir -p $(BUILD_DIR)
  72. @echo "Compiling DistrhoPluginMain.cpp ($*)"
  73. @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  74. $(BUILD_DIR)/DistrhoUIMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  75. -@mkdir -p $(BUILD_DIR)
  76. @echo "Compiling DistrhoUIMain.cpp ($*)"
  77. @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
  78. $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
  79. -@mkdir -p $(BUILD_DIR)
  80. @echo "Compiling DistrhoPluginMain.cpp (JACK)"
  81. @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags jack) -DDISTRHO_PLUGIN_TARGET_JACK -c -o $@
  82. $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
  83. -@mkdir -p $(BUILD_DIR)
  84. @echo "Compiling DistrhoUIMain.cpp (DSSI)"
  85. @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -c -o $@
  86. # ---------------------------------------------------------------------------------------------------------------------
  87. # JACK
  88. jack: $(jack)
  89. ifeq ($(HAVE_DGL),true)
  90. $(jack): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.o $(DPF_PATH)/build/libdgl.a
  91. else
  92. $(jack): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o
  93. endif
  94. -@mkdir -p $(shell dirname $@)
  95. @echo "Creating JACK standalone for $(NAME)"
  96. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --libs jack) -o $@
  97. # ---------------------------------------------------------------------------------------------------------------------
  98. # LADSPA
  99. ladspa: $(ladspa_dsp)
  100. $(ladspa_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.o
  101. -@mkdir -p $(shell dirname $@)
  102. @echo "Creating LADSPA plugin for $(NAME)"
  103. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  104. # ---------------------------------------------------------------------------------------------------------------------
  105. # DSSI
  106. dssi: $(dssi_dsp) $(dssi_ui)
  107. dssi_dsp: $(dssi_dsp)
  108. dssi_ui: $(dssi_ui)
  109. $(dssi_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.o
  110. -@mkdir -p $(shell dirname $@)
  111. @echo "Creating DSSI plugin library for $(NAME)"
  112. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  113. $(dssi_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o $(DPF_PATH)/build/libdgl.a
  114. -@mkdir -p $(shell dirname $@)
  115. @echo "Creating DSSI UI for $(NAME)"
  116. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --libs liblo) -o $@
  117. # ---------------------------------------------------------------------------------------------------------------------
  118. # LV2
  119. lv2: $(lv2)
  120. lv2_dsp: $(lv2_dsp)
  121. lv2_sep: $(lv2_dsp) $(lv2_ui)
  122. $(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DPF_PATH)/build/libdgl.a
  123. -@mkdir -p $(shell dirname $@)
  124. @echo "Creating LV2 plugin for $(NAME)"
  125. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  126. $(lv2_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o
  127. -@mkdir -p $(shell dirname $@)
  128. @echo "Creating LV2 plugin library for $(NAME)"
  129. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
  130. $(lv2_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DPF_PATH)/build/libdgl.a
  131. -@mkdir -p $(shell dirname $@)
  132. @echo "Creating LV2 plugin UI for $(NAME)"
  133. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  134. # ---------------------------------------------------------------------------------------------------------------------
  135. # VST
  136. vst: $(vst)
  137. ifeq ($(HAVE_DGL),true)
  138. $(vst): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o $(BUILD_DIR)/DistrhoUIMain_VST.cpp.o $(DPF_PATH)/build/libdgl.a
  139. else
  140. $(vst): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o
  141. endif
  142. -@mkdir -p $(shell dirname $@)
  143. @echo "Creating VST plugin for $(NAME)"
  144. @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
  145. # ---------------------------------------------------------------------------------------------------------------------
  146. -include $(OBJS_DSP:%.o=%.d)
  147. ifeq ($(HAVE_DGL),true)
  148. -include $(OBJS_UI:%.o=%.d)
  149. endif
  150. -include $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.d
  151. -include $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.d
  152. -include $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.d
  153. -include $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.d
  154. -include $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.d
  155. -include $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.d
  156. -include $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.d
  157. -include $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.d
  158. -include $(BUILD_DIR)/DistrhoUIMain_VST.cpp.d
  159. # ---------------------------------------------------------------------------------------------------------------------