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.

238 lines
7.5KB

  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 += -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. QT5_LINK_FLAGS += -L$(BINDIR) -lcarla_utils
  40. ifeq ($(MACOS),true)
  41. QT5_LINK_FLAGS += -install_name @rpath/libcarla_frontend.dylib
  42. # FIXME this does not work: -Wl,-rpath,@loader_path
  43. else
  44. QT5_LINK_FLAGS += -Wl,-rpath,'$${ORIGIN}'
  45. endif
  46. # ---------------------------------------------------------------------------------------------------------------------
  47. # Translations
  48. TSs = $(patsubst %,translations/carla_%.ts,$(I18N_LANGUAGES))
  49. QMs = $(patsubst %,translations/carla_%.qm,$(I18N_LANGUAGES))
  50. # ---------------------------------------------------------------------------------------------------------------------
  51. # C++ files
  52. CPP_FILES = \
  53. carla_frontend.cpp \
  54. dialogs/aboutjucedialog.cpp \
  55. dialogs/jackappdialog.cpp
  56. OBJS = $(CPP_FILES:%=$(OBJDIR)/%.o)
  57. # ---------------------------------------------------------------------------------------------------------------------
  58. # Resources
  59. RES = \
  60. resources_rc.py \
  61. $(BINDIR)/resources/modgui \
  62. $(BINDIR)/resources/patchcanvas \
  63. $(BINDIR)/resources/widgets \
  64. $(BINDIR)/resources/bigmeter-ui \
  65. $(BINDIR)/resources/carla-plugin \
  66. $(BINDIR)/resources/carla-plugin-patchbay \
  67. $(BINDIR)/resources/carla_app.py \
  68. $(BINDIR)/resources/carla_backend.py \
  69. $(BINDIR)/resources/carla_backend_qt.py \
  70. $(BINDIR)/resources/carla_host.py \
  71. $(BINDIR)/resources/carla_host_control.py \
  72. $(BINDIR)/resources/carla_modgui.py \
  73. $(BINDIR)/resources/carla_settings.py \
  74. $(BINDIR)/resources/carla_skin.py \
  75. $(BINDIR)/resources/carla_shared.py \
  76. $(BINDIR)/resources/carla_utils.py \
  77. $(BINDIR)/resources/carla_widgets.py \
  78. $(BINDIR)/resources/externalui.py \
  79. $(BINDIR)/resources/midipattern-ui \
  80. $(BINDIR)/resources/notes-ui \
  81. $(BINDIR)/resources/xycontroller-ui \
  82. $(BINDIR)/resources/resources_rc.py \
  83. $(BINDIR)/resources/ui_carla_about.py \
  84. $(BINDIR)/resources/ui_carla_edit.py \
  85. $(BINDIR)/resources/ui_carla_host.py \
  86. $(BINDIR)/resources/ui_carla_osc_connect.py \
  87. $(BINDIR)/resources/ui_carla_parameter.py \
  88. $(BINDIR)/resources/ui_carla_plugin_calf.py \
  89. $(BINDIR)/resources/ui_carla_plugin_classic.py \
  90. $(BINDIR)/resources/ui_carla_plugin_compact.py \
  91. $(BINDIR)/resources/ui_carla_plugin_default.py \
  92. $(BINDIR)/resources/ui_carla_plugin_presets.py \
  93. $(BINDIR)/resources/ui_carla_settings.py \
  94. $(BINDIR)/resources/ui_carla_settings_driver.py \
  95. $(BINDIR)/resources/ui_inputdialog_value.py \
  96. $(BINDIR)/resources/ui_midipattern.py \
  97. $(BINDIR)/resources/ui_xycontroller.py
  98. ifneq ($(SKIP_ZYN_SYNTH),true)
  99. ifeq ($(HAVE_ZYN_UI_DEPS),true)
  100. RES += \
  101. $(BINDIR)/resources/zynaddsubfx \
  102. $(BINDIR)/resources/zynaddsubfx-ui
  103. endif
  104. endif
  105. # ---------------------------------------------------------------------------------------------------------------------
  106. # UI code
  107. UI_FILES = $(wildcard dialogs/*.ui)
  108. UI_FILES += $(wildcard pluginlist/*.ui)
  109. UIs = $(UI_FILES:%.ui=%_ui.hpp)
  110. UIs += $(UI_FILES:%.ui=%_ui.py)
  111. # old stuff, not yet converted
  112. UIs += \
  113. ui_carla_about.py \
  114. ui_carla_edit.py \
  115. ui_carla_host.py \
  116. ui_carla_osc_connect.py \
  117. ui_carla_parameter.py \
  118. ui_carla_plugin_calf.py \
  119. ui_carla_plugin_classic.py \
  120. ui_carla_plugin_compact.py \
  121. ui_carla_plugin_default.py \
  122. ui_carla_plugin_presets.py \
  123. ui_carla_settings.py \
  124. ui_carla_settings_driver.py \
  125. ui_inputdialog_value.py \
  126. ui_midipattern.py \
  127. ui_xycontroller.py
  128. # ---------------------------------------------------------------------------------------------------------------------
  129. all: $(BINDIR)/libcarla_frontend$(LIB_EXT) $(QMs) $(RES) $(UIs)
  130. # ---------------------------------------------------------------------------------------------------------------------
  131. %_ui.hpp: %.ui
  132. $(UIC_QT5) $< -o $@
  133. %_ui.py: %.ui
  134. $(PYUIC) $< -o $@
  135. ui_%.py: $(RESDIR)/ui/%.ui
  136. $(PYUIC) $< -o $@
  137. resources_rc.py: $(RESDIR)/resources.qrc $(RESDIR)/*/*.png $(RESDIR)/*/*.svg $(RESDIR)/*/*.svgz
  138. $(PYRCC) $< -o $@
  139. $(BINDIR)/resources/%: %
  140. -@mkdir -p $(BINDIR)/resources
  141. $(LINK) $(CURDIR)/$* $(BINDIR)/resources/
  142. $(BINDIR)/resources/zynaddsubfx: ../native-plugins/resources/zynaddsubfx
  143. -@mkdir -p $(BINDIR)/resources
  144. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  145. $(BINDIR)/resources/zynaddsubfx-ui: ../native-plugins/resources/zynaddsubfx-ui
  146. -@mkdir -p $(BINDIR)/resources
  147. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  148. # ---------------------------------------------------------------------------------------------------------------------
  149. $(BINDIR)/libcarla_frontend$(LIB_EXT): $(OBJS) $(LIBS)
  150. -@mkdir -p $(BINDIR)
  151. @echo "Linking libcarla_frontend$(LIB_EXT)"
  152. $(SILENT)$(CXX) $(OBJS) $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) $(SHARED) -o $@
  153. ifeq ($(MACOS),true)
  154. # FIXME this does not work: -Wl,-rpath,@loader_path
  155. $(SILENT)install_name_tool -change ../../../bin/libcarla_utils.dylib @loader_path/libcarla_utils.dylib $@
  156. endif
  157. $(OBJDIR)/%.cpp.o: %.cpp $(UIs)
  158. -@mkdir -p $(shell dirname $@)
  159. @echo "Compiling $<"
  160. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  161. -include $(OBJS:%.o=%.d)
  162. # ---------------------------------------------------------------------------------------------------------------------
  163. clean:
  164. rm -rf $(BINDIR)/libcarla_frontend$(LIB_EXT) $(UIs) $(RES) $(QMs) __pycache__ *.pyc
  165. # old files
  166. rm -f ui_carla_about_juce.py
  167. rm -f ui_carla_add_jack.py
  168. rm -f ui_carla_database.py
  169. rm -f ui_carla_refresh.py
  170. debug:
  171. $(MAKE) DEBUG=true
  172. # ---------------------------------------------------------------------------------------------------------------------
  173. lint:
  174. pylint \
  175. --extension-pkg-whitelist=PyQt5 \
  176. --max-line-length=120 \
  177. --max-locals=25 \
  178. --max-statements=100 \
  179. --disable=bare-except,duplicate-code,invalid-name,missing-docstring,too-many-branches,too-many-instance-attributes,too-many-statements \
  180. $(wildcard widgets/*.py)
  181. # ---------------------------------------------------------------------------------------------------------------------
  182. i18n_update: $(TSs)
  183. i18n_release: $(QMs)
  184. translations/%.ts:
  185. @install -d translations
  186. pylupdate5 *.py $(RESDIR)/ui/*.ui -ts $@
  187. %.qm: %.ts
  188. lrelease $< -qm $@
  189. # ---------------------------------------------------------------------------------------------------------------------