Audio plugin host https://kx.studio/carla
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.

370 lines
13KB

  1. #!/usr/bin/make -f
  2. # Makefile for carla-plugin #
  3. # ------------------------- #
  4. # Created by falkTX
  5. #
  6. CWD=..
  7. include $(CWD)/Makefile.mk
  8. # ---------------------------------------------------------------------------------------------------------------------
  9. BINDIR := $(CWD)/../bin
  10. ifeq ($(DEBUG),true)
  11. OBJDIR := $(CWD)/../build/plugin/Debug
  12. MODULEDIR := $(CWD)/../build/modules/Debug
  13. else
  14. OBJDIR := $(CWD)/../build/plugin/Release
  15. MODULEDIR := $(CWD)/../build/modules/Release
  16. endif
  17. # ---------------------------------------------------------------------------------------------------------------------
  18. BUILD_CXX_FLAGS += -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils
  19. BUILD_CXX_FLAGS += $(NATIVE_PLUGINS_FLAGS)
  20. ifeq ($(HAVE_LIBLO),true)
  21. BUILD_CXX_FLAGS += $(LIBLO_FLAGS)
  22. endif
  23. ifeq ($(HAVE_FLUIDSYNTH),true)
  24. BUILD_CXX_FLAGS += $(FLUIDSYNTH_FLAGS)
  25. endif
  26. ifeq ($(HAVE_X11),true)
  27. BUILD_CXX_FLAGS += $(X11_FLAGS)
  28. endif
  29. # ---------------------------------------------------------------------------------------------------------------------
  30. # Libs
  31. LIBS = $(MODULEDIR)/carla_engine_plugin.a
  32. LIBS += $(MODULEDIR)/carla_plugin.a
  33. LIBS += $(MODULEDIR)/jackbridge.a
  34. LIBS += $(MODULEDIR)/lilv.a
  35. LIBS += $(MODULEDIR)/rtmempool.a
  36. LIBS += $(MODULEDIR)/water.a
  37. LIBS += $(MODULEDIR)/audio_decoder.a
  38. LIBS += $(MODULEDIR)/native-plugins.a
  39. LIBS += $(MODULEDIR)/sfzero.a
  40. ifeq ($(HAVE_DGL),true)
  41. LIBS += $(MODULEDIR)/dgl.a
  42. endif
  43. ifeq ($(HAVE_HYLIA),true)
  44. LIBS += $(MODULEDIR)/hylia.a
  45. endif
  46. # ---------------------------------------------------------------------------------------------------------------------
  47. # Link flags
  48. NATIVE_LINK_FLAGS = $(LINK_FLAGS)
  49. NATIVE_LINK_FLAGS += $(JACKBRIDGE_LIBS)
  50. NATIVE_LINK_FLAGS += $(LILV_LIBS)
  51. NATIVE_LINK_FLAGS += $(RTMEMPOOL_LIBS)
  52. NATIVE_LINK_FLAGS += $(WATER_LIBS)
  53. NATIVE_LINK_FLAGS += $(NATIVE_PLUGINS_LIBS)
  54. NATIVE_LINK_FLAGS += $(FLUIDSYNTH_LIBS)
  55. NATIVE_LINK_FLAGS += $(LIBLO_LIBS)
  56. NATIVE_LINK_FLAGS += $(MAGIC_LIBS)
  57. NATIVE_LINK_FLAGS += $(X11_LIBS)
  58. ifeq ($(MACOS),true)
  59. SYMBOLS_NATIVE = -Wl,-exported_symbol,_carla_get_native_rack_plugin
  60. SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_patchbay_plugin
  61. SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_library_filename
  62. SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_library_folder
  63. SYMBOLS_LV2 = -Wl,-exported_symbol,_lv2_descriptor
  64. ifeq ($(HAVE_PYQT),true)
  65. SYMBOLS_LV2 += -Wl,-exported_symbol,_lv2ui_descriptor
  66. SYMBOLS_LV2_UI = -Wl,-exported_symbol,_lv2ui_descriptor
  67. endif
  68. SYMBOLS_VST = # TODO
  69. endif
  70. # ---------------------------------------------------------------------------------------------------------------------
  71. # Other libs
  72. LIBS_ui = $(MODULEDIR)/water.a
  73. LIBS_wine = $(MODULEDIR)/dgl.wine.a
  74. LIBS_wine += $(MODULEDIR)/water.files.a
  75. WINE_LINK_FLAGS = $(LINK_FLAGS)
  76. WINE_LINK_FLAGS += -L$(BINDIR) -lcarla_native-plugin
  77. WINE_LINK_FLAGS += -lstdc++ -lopengl32 -lgdi32 -ldl
  78. WINE_LINK_FLAGS += -Wl,-rpath,/usr/local/lib/carla
  79. WINE_LINK_FLAGS += -Wl,-rpath,/usr/lib/carla
  80. # ---------------------------------------------------------------------------------------------------------------------
  81. TARGETS = \
  82. $(BINDIR)/carla-native-plugin$(APP_EXT) \
  83. $(BINDIR)/libcarla_native-plugin$(LIB_EXT)
  84. TARGETS += \
  85. $(BINDIR)/carla.lv2/carla$(LIB_EXT)
  86. ifeq ($(HAVE_PYQT),true)
  87. TARGETS += \
  88. $(BINDIR)/carla.lv2/carla-ui$(LIB_EXT)
  89. endif
  90. ifneq ($(CROSS_COMPILING),true)
  91. TARGETS += \
  92. $(BINDIR)/carla.lv2/manifest.ttl
  93. endif
  94. ifneq ($(HAIKU),true)
  95. ifeq ($(HAVE_PYQT),true)
  96. TARGETS += \
  97. $(BINDIR)/CarlaRack$(LIB_EXT) \
  98. $(BINDIR)/CarlaRackFX$(LIB_EXT) \
  99. $(BINDIR)/CarlaPatchbay$(LIB_EXT) \
  100. $(BINDIR)/CarlaPatchbay16$(LIB_EXT) \
  101. $(BINDIR)/CarlaPatchbay32$(LIB_EXT) \
  102. $(BINDIR)/CarlaPatchbayFX$(LIB_EXT) \
  103. $(BINDIR)/CarlaVstShell$(LIB_EXT) \
  104. $(BINDIR)/CarlaVstFxShell$(LIB_EXT)
  105. endif
  106. endif
  107. # ---------------------------------------------------------------------------------------------------------------------
  108. all: $(TARGETS)
  109. ifeq ($(WIN32),true)
  110. wine: $(BINDIR)/CarlaVstShellBridged.dll $(BINDIR)/CarlaVstFxShellBridged.dll
  111. else
  112. wine: $(BINDIR)/CarlaVstShellBridged.dll.so $(BINDIR)/CarlaVstFxShellBridged.dll.so
  113. endif
  114. # ---------------------------------------------------------------------------------------------------------------------
  115. clean:
  116. rm -f $(OBJDIR)/*.o $(TARGETS)
  117. rm -f $(BINDIR)/carla.lv2/*.*
  118. rm -f $(BINDIR)/carla-lv2-export$(APP_EXT)
  119. debug:
  120. $(MAKE) DEBUG=true
  121. # ---------------------------------------------------------------------------------------------------------------------
  122. $(BINDIR)/carla-native-plugin$(APP_EXT): $(OBJDIR)/carla-native-plugin.cpp.o
  123. -@mkdir -p $(BINDIR)
  124. @echo "Linking carla-native-plugin$(APP_EXT)"
  125. @$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(NATIVE_LINK_FLAGS) -o $@
  126. $(BINDIR)/libcarla_native-plugin$(LIB_EXT): $(OBJDIR)/carla-native-plugin.cpp.o
  127. -@mkdir -p $(BINDIR)
  128. @echo "Linking libcarla-native-plugin$(LIB_EXT)"
  129. @$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(SYMBOLS_NATIVE) $(NATIVE_LINK_FLAGS) -o $@
  130. # ---------------------------------------------------------------------------------------------------------------------
  131. $(BINDIR)/carla.lv2/carla$(LIB_EXT): $(OBJDIR)/carla-lv2.cpp.o
  132. -@mkdir -p $(BINDIR)/carla.lv2
  133. @echo "Linking carla.lv2/carla$(LIB_EXT)"
  134. @$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(SYMBOLS_LV2) $(NATIVE_LINK_FLAGS) -o $@
  135. $(BINDIR)/carla.lv2/carla-ui$(LIB_EXT): $(OBJDIR)/carla-lv2-ui.cpp.o $(LIBS_ui)
  136. -@mkdir -p $(BINDIR)/carla.lv2
  137. @echo "Linking carla.lv2/carla-ui$(LIB_EXT)"
  138. @$(CXX) $< $(LIBS_START) $(LIBS_ui) $(LIBS_END) $(SHARED) $(SYMBOLS_LV2_UI) $(NATIVE_LINK_FLAGS) -o $@
  139. # ---------------------------------------------------------------------------------------------------------------------
  140. $(BINDIR)/CarlaRack$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.rack-syn.o $(OBJDIR)/carla-vst-export.cpp.o
  141. -@mkdir -p $(BINDIR)
  142. @echo "Linking CarlaRack$(LIB_EXT)"
  143. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  144. $(BINDIR)/CarlaRackFX$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.rack-fx.o $(OBJDIR)/carla-vst-export.cpp.o
  145. -@mkdir -p $(BINDIR)
  146. @echo "Linking CarlaRackFX$(LIB_EXT)"
  147. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  148. $(BINDIR)/CarlaPatchbay$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn.o $(OBJDIR)/carla-vst-export.cpp.o
  149. -@mkdir -p $(BINDIR)
  150. @echo "Linking CarlaPatchbay$(LIB_EXT)"
  151. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  152. $(BINDIR)/CarlaPatchbay16$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn16.o $(OBJDIR)/carla-vst-export.cpp.o
  153. -@mkdir -p $(BINDIR)
  154. @echo "Linking CarlaPatchbay16$(LIB_EXT)"
  155. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  156. $(BINDIR)/CarlaPatchbay32$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-syn32.o $(OBJDIR)/carla-vst-export.cpp.o
  157. -@mkdir -p $(BINDIR)
  158. @echo "Linking CarlaPatchbay32$(LIB_EXT)"
  159. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  160. $(BINDIR)/CarlaPatchbayFX$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.patchbay-fx.o $(OBJDIR)/carla-vst-export.cpp.o
  161. -@mkdir -p $(BINDIR)
  162. @echo "Linking CarlaPatchbayFX$(LIB_EXT)"
  163. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  164. # ---------------------------------------------------------------------------------------------------------------------
  165. $(BINDIR)/CarlaVstShell$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.shell.o $(OBJDIR)/carla-vst-export.cpp.o
  166. -@mkdir -p $(BINDIR)
  167. @echo "Linking CarlaVstShell$(LIB_EXT)"
  168. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  169. $(BINDIR)/CarlaVstFxShell$(LIB_EXT): $(OBJDIR)/carla-vst.cpp.shellfx.o $(OBJDIR)/carla-vst-export.cpp.o
  170. -@mkdir -p $(BINDIR)
  171. @echo "Linking CarlaVstFxShell$(LIB_EXT)"
  172. @$(CXX) $^ $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(NATIVE_LINK_FLAGS) -o $@
  173. ifeq ($(WIN32),true)
  174. $(BINDIR)/CarlaVstShellBridged.dll: $(OBJDIR)/carla-vst-export-bridged.cpp.synth.o carla-vst-export.def
  175. -@mkdir -p $(BINDIR)
  176. @echo "Linking CarlaVstShellBridged.dll"
  177. @$(CXX) $^ $(SHARED) $(LINK_FLAGS) -o $@
  178. $(BINDIR)/CarlaVstFxShellBridged.dll: $(OBJDIR)/carla-vst-export-bridged.cpp.fx.o carla-vst-export.def
  179. -@mkdir -p $(BINDIR)
  180. @echo "Linking CarlaVstFxShellBridged.dll"
  181. @$(CXX) $^ $(SHARED) $(LINK_FLAGS) -o $@
  182. else
  183. $(BINDIR)/CarlaVstShellBridged.dll.so: $(OBJDIR)/carla-vst.cpp.shell.o $(OBJDIR)/carla-vst-export.cpp.dll.o carla-vst-export.def
  184. -@mkdir -p $(BINDIR)
  185. @echo "Linking CarlaVstShellBridged.dll.so"
  186. @$(WINECC) $^ $(LIBS_START) $(LIBS_wine) $(LIBS_END) $(SHARED) $(WINE_LINK_FLAGS) -o $@
  187. $(BINDIR)/CarlaVstFxShellBridged.dll.so: $(OBJDIR)/carla-vst.cpp.shellfx.o $(OBJDIR)/carla-vst-export.cpp.dll.o carla-vst-export.def
  188. -@mkdir -p $(BINDIR)
  189. @echo "Linking CarlaVstFxShellBridged.dll.so"
  190. @$(WINECC) $^ $(LIBS_START) $(LIBS_wine) $(LIBS_END) $(SHARED) $(WINE_LINK_FLAGS) -o $@
  191. endif
  192. # ---------------------------------------------------------------------------------------------------------------------
  193. $(OBJDIR)/carla-native-plugin.cpp.o: carla-native-plugin.cpp
  194. -@mkdir -p $(OBJDIR)
  195. @echo "Compiling $<"
  196. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  197. # ---------------------------------------------------------------------------------------------------------------------
  198. $(OBJDIR)/carla-lv2.cpp.o: carla-lv2.cpp
  199. -@mkdir -p $(OBJDIR)
  200. @echo "Compiling $<"
  201. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  202. $(OBJDIR)/carla-lv2-ui.cpp.o: carla-lv2-ui.cpp
  203. -@mkdir -p $(OBJDIR)
  204. @echo "Compiling $<"
  205. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  206. # ---------------------------------------------------------------------------------------------------------------------
  207. $(OBJDIR)/carla-vst.cpp.rack-fx.o: carla-vst.cpp
  208. -@mkdir -p $(OBJDIR)
  209. @echo "Compiling $< (RackFX)"
  210. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_PATCHBAY=0 -DCARLA_PLUGIN_SYNTH=0 -c -o $@
  211. $(OBJDIR)/carla-vst.cpp.rack-syn.o: carla-vst.cpp
  212. -@mkdir -p $(OBJDIR)
  213. @echo "Compiling $< (RackSynth)"
  214. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_PATCHBAY=0 -DCARLA_PLUGIN_SYNTH=1 -c -o $@
  215. $(OBJDIR)/carla-vst.cpp.patchbay-fx.o: carla-vst.cpp
  216. -@mkdir -p $(OBJDIR)
  217. @echo "Compiling $< (PatchbayFX)"
  218. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_PATCHBAY=1 -DCARLA_PLUGIN_SYNTH=0 -c -o $@
  219. $(OBJDIR)/carla-vst.cpp.patchbay-syn.o: carla-vst.cpp
  220. -@mkdir -p $(OBJDIR)
  221. @echo "Compiling $< (PatchbaySynth)"
  222. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_PATCHBAY=1 -DCARLA_PLUGIN_SYNTH=1 -c -o $@
  223. $(OBJDIR)/carla-vst.cpp.patchbay-syn16.o: carla-vst.cpp
  224. -@mkdir -p $(OBJDIR)
  225. @echo "Compiling $< (PatchbaySynth 16ch)"
  226. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_PATCHBAY=1 -DCARLA_PLUGIN_SYNTH=1 -DCARLA_PLUGIN_16CH=1 -c -o $@
  227. $(OBJDIR)/carla-vst.cpp.patchbay-syn32.o: carla-vst.cpp
  228. -@mkdir -p $(OBJDIR)
  229. @echo "Compiling $< (PatchbaySynth 32ch)"
  230. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_PATCHBAY=1 -DCARLA_PLUGIN_SYNTH=1 -DCARLA_PLUGIN_32CH=1 -c -o $@
  231. $(OBJDIR)/carla-vst.cpp.shell.o: carla-vst.cpp
  232. -@mkdir -p $(OBJDIR)
  233. @echo "Compiling $< (VstShell)"
  234. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_VST_SHELL=1 -DCARLA_PLUGIN_SYNTH=1 -c -o $@
  235. $(OBJDIR)/carla-vst.cpp.shellfx.o: carla-vst.cpp
  236. -@mkdir -p $(OBJDIR)
  237. @echo "Compiling $< (VstShell)"
  238. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_VST_SHELL=1 -DCARLA_PLUGIN_SYNTH=0 -c -o $@
  239. $(OBJDIR)/carla-vst-export-bridged.cpp.fx.o: carla-vst-export-bridged.cpp
  240. -@mkdir -p $(OBJDIR)
  241. @echo "Compiling $<"
  242. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_SYNTH=0 -c -o $@
  243. $(OBJDIR)/carla-vst-export-bridged.cpp.synth.o: carla-vst-export-bridged.cpp
  244. -@mkdir -p $(OBJDIR)
  245. @echo "Compiling $<"
  246. @$(CXX) $< $(BUILD_CXX_FLAGS) -DCARLA_PLUGIN_SYNTH=1 -c -o $@
  247. $(OBJDIR)/carla-vst-export.cpp.o: carla-vst-export.cpp
  248. -@mkdir -p $(OBJDIR)
  249. @echo "Compiling $<"
  250. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  251. $(OBJDIR)/carla-vst-export.cpp.dll.o: carla-vst-export.cpp
  252. -@mkdir -p $(OBJDIR)
  253. @echo "Compiling $< (Wine)"
  254. @$(WINECC) $< $(BUILD_CXX_FLAGS) -c -o $@
  255. # ---------------------------------------------------------------------------------------------------------------------
  256. $(BINDIR)/carla.lv2/manifest.ttl: $(OBJDIR)/carla-lv2-export.cpp.o
  257. -@mkdir -p $(BINDIR)/carla.lv2
  258. @echo "Linking carla-lv2-export$(APP_EXT)"
  259. @$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(NATIVE_LINK_FLAGS) -o $(BINDIR)/carla-lv2-export$(APP_EXT)
  260. @echo "Generating LV2 ttl data"
  261. ifeq ($(BUILDING_FOR_WINDOWS),true)
  262. @cd $(BINDIR) && wine ./carla-lv2-export$(APP_EXT)
  263. else
  264. @cd $(BINDIR) && ./carla-lv2-export$(APP_EXT)
  265. endif
  266. @cd $(BINDIR)/carla.lv2 && ln -sf ../*bridge-* ../carla-discovery-* .
  267. $(BINDIR)/carla-lv2-export$(APP_EXT): $(OBJDIR)/carla-lv2-export.cpp.o
  268. -@mkdir -p $(BINDIR)
  269. @echo "Linking carla-lv2-export$(APP_EXT)"
  270. @$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(NATIVE_LINK_FLAGS) -o $@
  271. $(OBJDIR)/carla-lv2-export.cpp.o: carla-lv2-export.cpp
  272. -@mkdir -p $(OBJDIR)
  273. @echo "Compiling $<"
  274. @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  275. # ---------------------------------------------------------------------------------------------------------------------
  276. -include $(OBJDIR)/carla-native-plugin.cpp.d
  277. -include $(OBJDIR)/carla-lv2.cpp.d
  278. -include $(OBJDIR)/carla-lv2-export.cpp.d
  279. -include $(OBJDIR)/carla-vst.cpp.patchbay-fx.d
  280. -include $(OBJDIR)/carla-vst.cpp.patchbay-syn.d
  281. -include $(OBJDIR)/carla-vst.cpp.patchbay-syn16.d
  282. -include $(OBJDIR)/carla-vst.cpp.rack-fx.d
  283. -include $(OBJDIR)/carla-vst.cpp.rack-syn.d
  284. -include $(OBJDIR)/carla-vst.cpp.shell.d
  285. -include $(OBJDIR)/carla-vst-export.cpp.d
  286. -include $(OBJDIR)/carla-vst-export.cpp.dll.d
  287. -include $(OBJDIR)/carla-vst-export-bridged.cpp.fx.d
  288. -include $(OBJDIR)/carla-vst-export-bridged.cpp.synth.d
  289. # ---------------------------------------------------------------------------------------------------------------------