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.

381 lines
14KB

  1. #!/usr/bin/make -f
  2. # Makefile for carla-bridges-plugin #
  3. # --------------------------------- #
  4. # Created by falkTX
  5. #
  6. CWD=..
  7. MODULENAME=carla-bridge
  8. include $(CWD)/Makefile.mk
  9. # ----------------------------------------------------------------------------------------------------------------------
  10. BINDIR := $(CWD)/../bin
  11. ifeq ($(DEBUG),true)
  12. OBJDIR := $(CWD)/../build/bridges-plugin/Debug
  13. MODULEDIR := $(CWD)/../build/modules/Debug
  14. else
  15. OBJDIR := $(CWD)/../build/bridges-plugin/Release
  16. MODULEDIR := $(CWD)/../build/modules/Release
  17. endif
  18. # ----------------------------------------------------------------------------------------------------------------------
  19. BUILD_CXX_FLAGS += -DBUILD_BRIDGE -I. -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils
  20. BUILD_CXX_FLAGS += -I$(CWD)/backend/engine -I$(CWD)/backend/plugin
  21. 32BIT_FLAGS += -DBUILD_BRIDGE_ALTERNATIVE_ARCH
  22. 64BIT_FLAGS += -DBUILD_BRIDGE_ALTERNATIVE_ARCH
  23. # ----------------------------------------------------------------------------------------------------------------------
  24. LIBS_native = $(MODULEDIR)/jackbridge.a
  25. LIBS_posix32 = $(MODULEDIR)/jackbridge.posix32.a
  26. LIBS_posix64 = $(MODULEDIR)/jackbridge.posix64.a
  27. ifeq ($(BUILDING_FOR_WINDOWS),true)
  28. LIBS_win32 = $(MODULEDIR)/jackbridge.win32.a
  29. LIBS_win64 = $(MODULEDIR)/jackbridge.win64.a
  30. else
  31. LIBS_win32 = $(MODULEDIR)/jackbridge.win32e.a
  32. LIBS_win64 = $(MODULEDIR)/jackbridge.win64e.a
  33. endif
  34. LINK_FLAGS += $(JACKBRIDGE_LIBS)
  35. LIBS_native += $(MODULEDIR)/lilv.a
  36. LIBS_posix32 += $(MODULEDIR)/lilv.posix32.a
  37. LIBS_posix64 += $(MODULEDIR)/lilv.posix64.a
  38. LIBS_win32 += $(MODULEDIR)/lilv.win32.a
  39. LIBS_win64 += $(MODULEDIR)/lilv.win64.a
  40. LINK_FLAGS += $(LILV_LIBS)
  41. LIBS_native += $(MODULEDIR)/rtmempool.a
  42. LIBS_posix32 += $(MODULEDIR)/rtmempool.posix32.a
  43. LIBS_posix64 += $(MODULEDIR)/rtmempool.posix64.a
  44. LIBS_win32 += $(MODULEDIR)/rtmempool.win32.a
  45. LIBS_win64 += $(MODULEDIR)/rtmempool.win64.a
  46. LINK_FLAGS += $(RTMEMPOOL_LIBS)
  47. LIBS_native += $(MODULEDIR)/water.a
  48. LIBS_posix32 += $(MODULEDIR)/water.posix32.a
  49. LIBS_posix64 += $(MODULEDIR)/water.posix64.a
  50. LIBS_win32 += $(MODULEDIR)/water.win32.a
  51. LIBS_win64 += $(MODULEDIR)/water.win64.a
  52. LINK_FLAGS += $(WATER_LIBS)
  53. LINK_FLAGS += $(X11_LIBS)
  54. # ----------------------------------------------------------------------------------------------------------------------
  55. NATIVE_BUILD_FLAGS = $(NATIVE_PLUGINS_FLAGS)
  56. NATIVE_LINK_FLAGS = $(NATIVE_PLUGINS_LIBS)
  57. NATIVE_BUILD_FLAGS += $(LIBLO_FLAGS)
  58. NATIVE_LINK_FLAGS += $(LIBLO_LIBS)
  59. NATIVE_BUILD_FLAGS += $(FLUIDSYNTH_FLAGS)
  60. NATIVE_LINK_FLAGS += $(FLUIDSYNTH_LIBS)
  61. NATIVE_LINK_FLAGS += $(MAGIC_LIBS)
  62. LIBS_native += $(MODULEDIR)/audio_decoder.a
  63. LIBS_native += $(MODULEDIR)/native-plugins.a
  64. LIBS_native += $(MODULEDIR)/sfzero.a
  65. ifeq ($(HAVE_DGL),true)
  66. LIBS_native += $(MODULEDIR)/dgl.a
  67. endif
  68. # ----------------------------------------------------------------------------------------------------------------------
  69. OBJS_native = \
  70. $(OBJDIR)/CarlaBridgePlugin.cpp.o \
  71. $(OBJDIR)/CarlaEngine.cpp.o \
  72. $(OBJDIR)/CarlaEngineClient.cpp.o \
  73. $(OBJDIR)/CarlaEngineData.cpp.o \
  74. $(OBJDIR)/CarlaEngineGraph.cpp.o \
  75. $(OBJDIR)/CarlaEngineInternal.cpp.o \
  76. $(OBJDIR)/CarlaEngineNative.cpp.o \
  77. $(OBJDIR)/CarlaEngineOscSend.cpp.o \
  78. $(OBJDIR)/CarlaEnginePorts.cpp.o \
  79. $(OBJDIR)/CarlaEngineThread.cpp.o \
  80. $(OBJDIR)/CarlaEngineJack.cpp.o \
  81. $(OBJDIR)/CarlaEngineBridge.cpp.o \
  82. $(OBJDIR)/CarlaPlugin.cpp.o \
  83. $(OBJDIR)/CarlaPluginBridge.cpp.o \
  84. $(OBJDIR)/CarlaPluginInternal.cpp.o \
  85. $(OBJDIR)/CarlaPluginJack.cpp.o \
  86. $(OBJDIR)/CarlaPluginNative.cpp.o \
  87. $(OBJDIR)/CarlaPluginLADSPA.cpp.o \
  88. $(OBJDIR)/CarlaPluginDSSI.cpp.o \
  89. $(OBJDIR)/CarlaPluginLV2.cpp.o \
  90. $(OBJDIR)/CarlaPluginVST2.cpp.o \
  91. $(OBJDIR)/CarlaPluginFluidSynth.cpp.o \
  92. $(OBJDIR)/CarlaPluginSFZero.cpp.o \
  93. $(OBJDIR)/CarlaStandalone.cpp.o
  94. OBJS_lv2 = $(OBJS_native) \
  95. $(OBJDIR)/CarlaBridgeSingleLV2.cpp.o
  96. OBJS_arch = \
  97. $(OBJDIR)/CarlaBridgePlugin.cpp.arch.o \
  98. $(OBJDIR)/CarlaEngine.cpp.arch.o \
  99. $(OBJDIR)/CarlaEngineClient.cpp.arch.o \
  100. $(OBJDIR)/CarlaEngineData.cpp.arch.o \
  101. $(OBJDIR)/CarlaEngineInternal.cpp.arch.o \
  102. $(OBJDIR)/CarlaEnginePorts.cpp.arch.o \
  103. $(OBJDIR)/CarlaEngineThread.cpp.arch.o \
  104. $(OBJDIR)/CarlaEngineJack.cpp.arch.o \
  105. $(OBJDIR)/CarlaEngineBridge.cpp.arch.o \
  106. $(OBJDIR)/CarlaPlugin.cpp.arch.o \
  107. $(OBJDIR)/CarlaPluginBridge.cpp.arch.o \
  108. $(OBJDIR)/CarlaPluginInternal.cpp.arch.o \
  109. $(OBJDIR)/CarlaPluginLADSPA.cpp.arch.o \
  110. $(OBJDIR)/CarlaPluginDSSI.cpp.arch.o \
  111. $(OBJDIR)/CarlaPluginLV2.cpp.arch.o \
  112. $(OBJDIR)/CarlaPluginVST2.cpp.arch.o \
  113. $(OBJDIR)/CarlaStandalone.cpp.arch.o
  114. OBJS_posix32 = $(OBJS_arch:%.arch.o=%.posix32.o)
  115. OBJS_posix64 = $(OBJS_arch:%.arch.o=%.posix64.o)
  116. OBJS_win32 = $(OBJS_arch:%.arch.o=%.win32.o)
  117. OBJS_win64 = $(OBJS_arch:%.arch.o=%.win64.o)
  118. # ----------------------------------------------------------------------------------------------------------------------
  119. all: native
  120. # ----------------------------------------------------------------------------------------------------------------------
  121. clean:
  122. rm -f $(OBJDIR)/*.o
  123. rm -f $(BINDIR)/$(MODULENAME)-native
  124. rm -f $(BINDIR)/$(MODULENAME)-posix32
  125. rm -f $(BINDIR)/$(MODULENAME)-posix64
  126. rm -f $(BINDIR)/$(MODULENAME)-win*.exe
  127. debug:
  128. $(MAKE) DEBUG=true
  129. # ----------------------------------------------------------------------------------------------------------------------
  130. native: $(BINDIR)/$(MODULENAME)-native$(APP_EXT) $(BINDIR)/$(MODULENAME)-lv2$(LIB_EXT)
  131. posix32: $(BINDIR)/$(MODULENAME)-posix32
  132. posix64: $(BINDIR)/$(MODULENAME)-posix64
  133. win32: $(BINDIR)/$(MODULENAME)-win32.exe
  134. win64: $(BINDIR)/$(MODULENAME)-win64.exe
  135. # ----------------------------------------------------------------------------------------------------------------------
  136. # linking
  137. $(BINDIR)/$(MODULENAME)-native$(APP_EXT): $(OBJS_native) $(LIBS_native)
  138. -@mkdir -p $(BINDIR)
  139. @echo "Linking $(MODULENAME)-native$(APP_EXT)"
  140. @$(CXX) $(OBJS_native) $(LIBS_START) $(LIBS_native) $(LIBS_END) $(LINK_FLAGS) $(NATIVE_LINK_FLAGS) -o $@
  141. $(BINDIR)/$(MODULENAME)-lv2$(LIB_EXT): $(OBJS_lv2) $(LIBS_native)
  142. -@mkdir -p $(BINDIR)
  143. @echo "Linking $(MODULENAME)-lv2$(LIB_EXT)"
  144. @$(CXX) $(OBJS_lv2) $(LIBS_START) $(LIBS_native) $(LIBS_END) $(SHARED) $(LINK_FLAGS) $(NATIVE_LINK_FLAGS) -o $@
  145. $(BINDIR)/$(MODULENAME)-posix32: $(OBJS_posix32) $(LIBS_posix32)
  146. -@mkdir -p $(BINDIR)
  147. @echo "Linking $(MODULENAME)-posix32"
  148. @$(CXX) $(OBJS_posix32) $(LIBS_START) $(LIBS_posix32) $(LIBS_END) $(LINK_FLAGS) $(32BIT_FLAGS) -o $@
  149. $(BINDIR)/$(MODULENAME)-posix64: $(OBJS_posix64) $(LIBS_posix64)
  150. -@mkdir -p $(BINDIR)
  151. @echo "Linking $(MODULENAME)-posix64"
  152. @$(CXX) $(OBJS_posix64) $(LIBS_START) $(LIBS_posix64) $(LIBS_END) $(LINK_FLAGS) $(64BIT_FLAGS) -o $@
  153. $(BINDIR)/$(MODULENAME)-win32.exe: $(OBJS_win32) $(LIBS_win32)
  154. -@mkdir -p $(BINDIR)
  155. @echo "Linking $(MODULENAME)-win32.exe"
  156. @$(CXX) $(OBJS_win32) $(LIBS_START) $(LIBS_win32) $(LIBS_END) $(LINK_FLAGS) $(32BIT_FLAGS) -o $@
  157. $(BINDIR)/$(MODULENAME)-win64.exe: $(OBJS_win64) $(LIBS_win64)
  158. -@mkdir -p $(BINDIR)
  159. @echo "Linking $(MODULENAME)-win64.exe"
  160. @$(CXX) $(OBJS_win64) $(LIBS_START) $(LIBS_win64) $(LIBS_END) $(LINK_FLAGS) $(64BIT_FLAGS) -o $@
  161. # ----------------------------------------------------------------------------------------------------------------------
  162. # native
  163. ifeq ($(MACOS),true)
  164. $(OBJDIR)/CarlaPluginVST2.cpp.o: $(CWD)/backend/plugin/CarlaPluginVST2.cpp
  165. -@mkdir -p $(OBJDIR)
  166. @echo "Compiling CarlaPluginVST2.cpp (bridge)"
  167. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@
  168. $(OBJDIR)/CarlaStandalone.cpp.o: $(CWD)/backend/CarlaStandalone.cpp
  169. -@mkdir -p $(OBJDIR)
  170. @echo "Compiling CarlaStandalone.cpp (bridge)"
  171. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@
  172. $(OBJDIR)/CarlaBridgePlugin.cpp.o: CarlaBridgePlugin.cpp
  173. -@mkdir -p $(OBJDIR)
  174. @echo "Compiling $<"
  175. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@
  176. else
  177. $(OBJDIR)/CarlaStandalone.cpp.o: $(CWD)/backend/CarlaStandalone.cpp
  178. -@mkdir -p $(OBJDIR)
  179. @echo "Compiling CarlaStandalone.cpp (bridge)"
  180. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
  181. $(OBJDIR)/CarlaBridgePlugin.cpp.o: CarlaBridgePlugin.cpp
  182. -@mkdir -p $(OBJDIR)
  183. @echo "Compiling $<"
  184. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
  185. endif
  186. $(OBJDIR)/CarlaBridgeSingleLV2.cpp.o: CarlaBridgeSingleLV2.cpp
  187. -@mkdir -p $(OBJDIR)
  188. @echo "Compiling $<"
  189. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
  190. $(OBJDIR)/CarlaPlug%.cpp.o: $(CWD)/backend/plugin/CarlaPlug%.cpp
  191. -@mkdir -p $(OBJDIR)
  192. @echo "Compiling CarlaPlug$*.cpp (bridge)"
  193. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
  194. $(OBJDIR)/CarlaEng%.cpp.o: $(CWD)/backend/engine/CarlaEng%.cpp
  195. -@mkdir -p $(OBJDIR)
  196. @echo "Compiling CarlaEng$*.cpp (bridge)"
  197. @$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
  198. # ----------------------------------------------------------------------------------------------------------------------
  199. # posix32
  200. ifeq ($(MACOS),true)
  201. $(OBJDIR)/CarlaPluginVST2.cpp.posix32.o: $(CWD)/backend/plugin/CarlaPluginVST2.cpp
  202. -@mkdir -p $(OBJDIR)
  203. @echo "Compiling CarlaPluginVST2.cpp (posix32 bridge)"
  204. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -ObjC++ -c -o $@
  205. $(OBJDIR)/CarlaBridgePlugin.cpp.posix32.o: CarlaBridgePlugin.cpp
  206. -@mkdir -p $(OBJDIR)
  207. @echo "Compiling $< (posix32 bridge)"
  208. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -ObjC++ -c -o $@
  209. $(OBJDIR)/CarlaStandalone.cpp.posix32.o: $(CWD)/backend/CarlaStandalone.cpp
  210. -@mkdir -p $(OBJDIR)
  211. @echo "Compiling CarlaStandalone.cpp (posix32 bridge)"
  212. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -ObjC++ -c -o $@
  213. else
  214. $(OBJDIR)/CarlaBridgePlugin.cpp.posix32.o: CarlaBridgePlugin.cpp
  215. -@mkdir -p $(OBJDIR)
  216. @echo "Compiling $< (posix32 bridge)"
  217. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  218. $(OBJDIR)/CarlaStandalone.cpp.posix32.o: $(CWD)/backend/CarlaStandalone.cpp
  219. -@mkdir -p $(OBJDIR)
  220. @echo "Compiling CarlaStandalone.cpp (posix32 bridge)"
  221. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  222. endif
  223. $(OBJDIR)/CarlaEng%.cpp.posix32.o: $(CWD)/backend/engine/CarlaEng%.cpp
  224. -@mkdir -p $(OBJDIR)
  225. @echo "Compiling CarlaEng$*.cpp (posix32 bridge)"
  226. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  227. $(OBJDIR)/CarlaPlug%.cpp.posix32.o: $(CWD)/backend/plugin/CarlaPlug%.cpp
  228. -@mkdir -p $(OBJDIR)
  229. @echo "Compiling CarlaPlug$*.cpp (posix32 bridge)"
  230. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  231. # ----------------------------------------------------------------------------------------------------------------------
  232. # posix64
  233. ifeq ($(MACOS),true)
  234. $(OBJDIR)/CarlaPluginVST2.cpp.posix64.o: $(CWD)/backend/plugin/CarlaPluginVST2.cpp
  235. -@mkdir -p $(OBJDIR)
  236. @echo "Compiling CarlaPluginVST2.cpp (posix64 bridge)"
  237. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -ObjC++ -c -o $@
  238. $(OBJDIR)/CarlaBridgePlugin.cpp.posix64.o: CarlaBridgePlugin.cpp
  239. -@mkdir -p $(OBJDIR)
  240. @echo "Compiling $< (posix64 bridge)"
  241. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -ObjC++ -c -o $@
  242. $(OBJDIR)/CarlaStandalone.cpp.posix64.o: $(CWD)/backend/CarlaStandalone.cpp
  243. -@mkdir -p $(OBJDIR)
  244. @echo "Compiling CarlaStandalone.cpp (posix64 bridge)"
  245. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -ObjC++ -c -o $@
  246. else
  247. $(OBJDIR)/CarlaBridgePlugin.cpp.posix64.o: CarlaBridgePlugin.cpp
  248. -@mkdir -p $(OBJDIR)
  249. @echo "Compiling $< (posix64 bridge)"
  250. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  251. $(OBJDIR)/CarlaStandalone.cpp.posix64.o: $(CWD)/backend/CarlaStandalone.cpp
  252. -@mkdir -p $(OBJDIR)
  253. @echo "Compiling CarlaStandalone.cpp (posix64 bridge)"
  254. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  255. endif
  256. $(OBJDIR)/CarlaEng%.cpp.posix64.o: $(CWD)/backend/engine/CarlaEng%.cpp
  257. -@mkdir -p $(OBJDIR)
  258. @echo "Compiling CarlaEng$*.cpp (posix64 bridge)"
  259. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  260. $(OBJDIR)/CarlaPlug%.cpp.posix64.o: $(CWD)/backend/plugin/CarlaPlug%.cpp
  261. -@mkdir -p $(OBJDIR)
  262. @echo "Compiling CarlaPlug$*.cpp (posix64 bridge)"
  263. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  264. # ----------------------------------------------------------------------------------------------------------------------
  265. # win32
  266. $(OBJDIR)/CarlaBridgePlugin.cpp.win32.o: CarlaBridgePlugin.cpp
  267. -@mkdir -p $(OBJDIR)
  268. @echo "Compiling $< (win32 bridge)"
  269. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  270. $(OBJDIR)/CarlaEng%.cpp.win32.o: $(CWD)/backend/engine/CarlaEng%.cpp
  271. -@mkdir -p $(OBJDIR)
  272. @echo "Compiling CarlaEng$*.cpp (win32 bridge)"
  273. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  274. $(OBJDIR)/CarlaPlug%.cpp.win32.o: $(CWD)/backend/plugin/CarlaPlug%.cpp
  275. -@mkdir -p $(OBJDIR)
  276. @echo "Compiling CarlaPlug$*.cpp (win32 bridge)"
  277. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  278. $(OBJDIR)/CarlaStandalone.cpp.win32.o: $(CWD)/backend/CarlaStandalone.cpp
  279. -@mkdir -p $(OBJDIR)
  280. @echo "Compiling CarlaStandalone.cpp (win32 bridge)"
  281. @$(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@
  282. # ----------------------------------------------------------------------------------------------------------------------
  283. # win64
  284. $(OBJDIR)/CarlaBridgePlugin.cpp.win64.o: CarlaBridgePlugin.cpp
  285. -@mkdir -p $(OBJDIR)
  286. @echo "Compiling $< (win64 bridge)"
  287. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  288. $(OBJDIR)/CarlaEng%.cpp.win64.o: $(CWD)/backend/engine/CarlaEng%.cpp
  289. -@mkdir -p $(OBJDIR)
  290. @echo "Compiling CarlaEng$*.cpp (win64 bridge)"
  291. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  292. $(OBJDIR)/CarlaPlug%.cpp.win64.o: $(CWD)/backend/plugin/CarlaPlug%.cpp
  293. -@mkdir -p $(OBJDIR)
  294. @echo "Compiling CarlaPlug$*.cpp (win64 bridge)"
  295. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  296. $(OBJDIR)/CarlaStandalone.cpp.win64.o: $(CWD)/backend/CarlaStandalone.cpp
  297. -@mkdir -p $(OBJDIR)
  298. @echo "Compiling CarlaStandalone.cpp (win64 bridge)"
  299. @$(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@
  300. # ----------------------------------------------------------------------------------------------------------------------
  301. -include $(OBJS_lv2:%.o=%.d)
  302. -include $(OBJS_posix32:%.o=%.d)
  303. -include $(OBJS_posix64:%.o=%.d)
  304. -include $(OBJS_win32:%.o=%.d)
  305. -include $(OBJS_win64:%.o=%.d)
  306. # ----------------------------------------------------------------------------------------------------------------------