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.

254 lines
8.1KB

  1. #!/usr/bin/make -f
  2. # Makefile for carla-frontend #
  3. # --------------------------- #
  4. # Created by falkTX
  5. #
  6. CWD=..
  7. include $(CWD)/Makefile.mk
  8. # ---------------------------------------------------------------------------------------------------------------------
  9. BINDIR := $(CWD)/../bin
  10. RESDIR := $(CWD)/../resources
  11. ifeq ($(DEBUG),true)
  12. OBJDIR := $(CWD)/../build/frontend/Debug
  13. else
  14. OBJDIR := $(CWD)/../build/frontend/Release
  15. endif
  16. # ---------------------------------------------------------------------------------------------------------------------
  17. BUILD_CXX_FLAGS += -I. -Iutils
  18. BUILD_CXX_FLAGS += -I../backend
  19. BUILD_CXX_FLAGS += -I../includes
  20. BUILD_CXX_FLAGS += -I../modules
  21. BUILD_CXX_FLAGS += -I../utils
  22. # ---------------------------------------------------------------------------------------------------------------------
  23. ifeq ($(WINDOWS),true)
  24. QT5_LINK_FLAGS = $(shell echo $(LINK_FLAGS) | awk 'sub(" -static","")')
  25. else
  26. QT5_LINK_FLAGS = $(LINK_FLAGS)
  27. endif
  28. ifeq ($(HAVE_QT5),true)
  29. QT5_PREFIX = $(shell $(PKG_CONFIG) --variable=prefix Qt5Core)
  30. BUILD_CXX_FLAGS += $(shell $(PKG_CONFIG) --cflags Qt5Core Qt5Gui Qt5Widgets)
  31. QT5_LINK_FLAGS += -Wl,-rpath,$(QT5_PREFIX)/lib $(shell $(PKG_CONFIG) --libs Qt5Core Qt5Gui Qt5Widgets)
  32. else ifeq ($(HAVE_QT5PKG),true)
  33. QT5_PREFIX = $(shell $(PKG_CONFIG) --variable=prefix Qt5OpenGLExtensions)
  34. BUILD_CXX_FLAGS += -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -I $(QT5_PREFIX)/include/qt5
  35. QT5_LINK_FLAGS += -Wl,-rpath,$(QT5_PREFIX)/lib -F $(QT5_PREFIX)/lib -framework QtCore -framework QtGui -framework QtWidgets
  36. else
  37. $(error Trying to build frontend without Qt5, cannot continue)
  38. endif
  39. ifeq ($(WINDOWS),true)
  40. QT5_LINK_FLAGS += -L$(BINDIR) $(BINDIR)/libcarla_utils.dll
  41. else
  42. QT5_LINK_FLAGS += -L$(BINDIR) -lcarla_utils
  43. endif
  44. ifeq ($(MACOS),true)
  45. QT5_LINK_FLAGS += -install_name @rpath/libcarla_frontend.dylib
  46. # FIXME this does not work: -Wl,-rpath,@loader_path
  47. else
  48. QT5_LINK_FLAGS += -Wl,-rpath,'$${ORIGIN}'
  49. endif
  50. # ---------------------------------------------------------------------------------------------------------------------
  51. # Translations
  52. TSs = $(patsubst %,translations/carla_%.ts,$(I18N_LANGUAGES))
  53. QMs = $(patsubst %,translations/carla_%.qm,$(I18N_LANGUAGES))
  54. # ---------------------------------------------------------------------------------------------------------------------
  55. # C++ files
  56. CPP_FILES = \
  57. carla_frontend.cpp \
  58. dialogs/aboutjucedialog.cpp \
  59. dialogs/jackappdialog.cpp \
  60. pluginlist/pluginlistdialog.cpp \
  61. pluginlist/pluginlistrefreshdialog.cpp
  62. OBJS = $(CPP_FILES:%=$(OBJDIR)/%.o)
  63. # ---------------------------------------------------------------------------------------------------------------------
  64. # Resources
  65. RES = \
  66. resources_rc.py \
  67. $(BINDIR)/resources/modgui \
  68. $(BINDIR)/resources/patchcanvas \
  69. $(BINDIR)/resources/widgets \
  70. $(BINDIR)/resources/bigmeter-ui \
  71. $(BINDIR)/resources/carla-plugin \
  72. $(BINDIR)/resources/carla-plugin-patchbay \
  73. $(BINDIR)/resources/carla_app.py \
  74. $(BINDIR)/resources/carla_backend.py \
  75. $(BINDIR)/resources/carla_backend_qt.py \
  76. $(BINDIR)/resources/carla_host.py \
  77. $(BINDIR)/resources/carla_host_control.py \
  78. $(BINDIR)/resources/carla_modgui.py \
  79. $(BINDIR)/resources/carla_settings.py \
  80. $(BINDIR)/resources/carla_skin.py \
  81. $(BINDIR)/resources/carla_shared.py \
  82. $(BINDIR)/resources/carla_utils.py \
  83. $(BINDIR)/resources/carla_widgets.py \
  84. $(BINDIR)/resources/externalui.py \
  85. $(BINDIR)/resources/midipattern-ui \
  86. $(BINDIR)/resources/notes-ui \
  87. $(BINDIR)/resources/xycontroller-ui \
  88. $(BINDIR)/resources/resources_rc.py \
  89. $(BINDIR)/resources/ui_carla_about.py \
  90. $(BINDIR)/resources/ui_carla_edit.py \
  91. $(BINDIR)/resources/ui_carla_host.py \
  92. $(BINDIR)/resources/ui_carla_osc_connect.py \
  93. $(BINDIR)/resources/ui_carla_parameter.py \
  94. $(BINDIR)/resources/ui_carla_plugin_calf.py \
  95. $(BINDIR)/resources/ui_carla_plugin_classic.py \
  96. $(BINDIR)/resources/ui_carla_plugin_compact.py \
  97. $(BINDIR)/resources/ui_carla_plugin_default.py \
  98. $(BINDIR)/resources/ui_carla_plugin_presets.py \
  99. $(BINDIR)/resources/ui_carla_settings.py \
  100. $(BINDIR)/resources/ui_carla_settings_driver.py \
  101. $(BINDIR)/resources/ui_inputdialog_value.py \
  102. $(BINDIR)/resources/ui_midipattern.py \
  103. $(BINDIR)/resources/ui_xycontroller.py
  104. ifneq ($(SKIP_ZYN_SYNTH),true)
  105. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  106. RES += \
  107. $(BINDIR)/resources/zynaddsubfx \
  108. $(BINDIR)/resources/zynaddsubfx-ui
  109. endif
  110. endif
  111. # ---------------------------------------------------------------------------------------------------------------------
  112. # UI code
  113. DIALOG_UI_FILES = $(wildcard dialogs/*.ui)
  114. PLUGINLIST_UI_FILES = $(wildcard pluginlist/*.ui)
  115. UIs = $(DIALOG_UI_FILES:dialogs/%.ui=dialogs/ui_%.h)
  116. UIs += $(PLUGINLIST_UI_FILES:pluginlist/%.ui=pluginlist/ui_%.h)
  117. UIs += $(DIALOG_UI_FILES:%.ui=%_ui.py)
  118. UIs += $(PLUGINLIST_UI_FILES:%.ui=%_ui.py)
  119. # old stuff, not yet converted
  120. UIs += \
  121. ui_carla_about.py \
  122. ui_carla_edit.py \
  123. ui_carla_host.py \
  124. ui_carla_osc_connect.py \
  125. ui_carla_parameter.py \
  126. ui_carla_plugin_calf.py \
  127. ui_carla_plugin_classic.py \
  128. ui_carla_plugin_compact.py \
  129. ui_carla_plugin_default.py \
  130. ui_carla_plugin_presets.py \
  131. ui_carla_settings.py \
  132. ui_carla_settings_driver.py \
  133. ui_inputdialog_value.py \
  134. ui_midipattern.py \
  135. ui_xycontroller.py
  136. # ---------------------------------------------------------------------------------------------------------------------
  137. all: $(BINDIR)/libcarla_frontend$(LIB_EXT) $(QMs) $(RES) $(UIs)
  138. # ---------------------------------------------------------------------------------------------------------------------
  139. dialogs/ui_%.h: dialogs/%.ui
  140. $(UIC_QT5) $< -o $@
  141. pluginlist/ui_%.h: pluginlist/%.ui
  142. $(UIC_QT5) $< -o $@
  143. %_ui.py: %.ui
  144. $(PYUIC) $< -o $@
  145. ui_%.py: $(RESDIR)/ui/%.ui
  146. $(PYUIC) $< -o $@
  147. resources_rc.py: $(RESDIR)/resources.qrc $(RESDIR)/*/*.png $(RESDIR)/*/*.svg $(RESDIR)/*/*.svgz
  148. $(PYRCC) $< -o $@
  149. test: $(OBJS) $(LIBS) test.cpp
  150. @echo "Linking test"
  151. $(SILENT)$(CXX) $(OBJS) test.cpp $(BUILD_CXX_FLAGS) -Wl,-rpath,$(abspath $(BINDIR)) $(QT5_LINK_FLAGS) -o $@
  152. $(BINDIR)/resources/%: %
  153. -@mkdir -p $(BINDIR)/resources
  154. $(LINK) $(CURDIR)/$* $(BINDIR)/resources/
  155. $(BINDIR)/resources/zynaddsubfx: ../native-plugins/resources/zynaddsubfx
  156. -@mkdir -p $(BINDIR)/resources
  157. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  158. $(BINDIR)/resources/zynaddsubfx-ui: ../native-plugins/resources/zynaddsubfx-ui
  159. -@mkdir -p $(BINDIR)/resources
  160. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  161. # ---------------------------------------------------------------------------------------------------------------------
  162. $(BINDIR)/libcarla_frontend$(LIB_EXT): $(OBJS) $(LIBS)
  163. -@mkdir -p $(BINDIR)
  164. @echo "Linking libcarla_frontend$(LIB_EXT)"
  165. $(SILENT)$(CXX) $(OBJS) $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) $(SHARED) -o $@
  166. ifeq ($(MACOS),true)
  167. # FIXME this does not work: -Wl,-rpath,@loader_path
  168. $(SILENT)install_name_tool -change ../../../bin/libcarla_utils.dylib @loader_path/libcarla_utils.dylib $@
  169. endif
  170. $(OBJDIR)/%.cpp.o: %.cpp $(UIs)
  171. -@mkdir -p $(shell dirname $@)
  172. @echo "Compiling $<"
  173. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  174. -include $(OBJS:%.o=%.d)
  175. # ---------------------------------------------------------------------------------------------------------------------
  176. clean:
  177. rm -rf $(BINDIR)/libcarla_frontend$(LIB_EXT) $(UIs) $(RES) $(QMs) __pycache__ *.pyc
  178. # old files
  179. rm -f ui_carla_about_juce.py
  180. rm -f ui_carla_add_jack.py
  181. rm -f ui_carla_database.py
  182. rm -f ui_carla_refresh.py
  183. debug:
  184. $(MAKE) DEBUG=true
  185. # ---------------------------------------------------------------------------------------------------------------------
  186. lint:
  187. pylint \
  188. --extension-pkg-whitelist=PyQt5 \
  189. --max-line-length=120 \
  190. --max-locals=25 \
  191. --max-statements=100 \
  192. --disable=bare-except,duplicate-code,invalid-name,missing-docstring,too-many-branches,too-many-instance-attributes,too-many-statements \
  193. $(wildcard widgets/*.py)
  194. # ---------------------------------------------------------------------------------------------------------------------
  195. i18n_update: $(TSs)
  196. i18n_release: $(QMs)
  197. translations/%.ts:
  198. @install -d translations
  199. pylupdate5 *.py $(RESDIR)/ui/*.ui -ts $@
  200. %.qm: %.ts
  201. lrelease $< -qm $@
  202. # ---------------------------------------------------------------------------------------------------------------------