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.

244 lines
7.7KB

  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. 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. UI_FILES = $(wildcard dialogs/*.ui)
  114. UI_FILES += $(wildcard pluginlist/*.ui)
  115. UIs = $(UI_FILES:%.ui=%_ui.hpp)
  116. UIs += $(UI_FILES:%.ui=%_ui.py)
  117. # old stuff, not yet converted
  118. UIs += \
  119. ui_carla_about.py \
  120. ui_carla_edit.py \
  121. ui_carla_host.py \
  122. ui_carla_osc_connect.py \
  123. ui_carla_parameter.py \
  124. ui_carla_plugin_calf.py \
  125. ui_carla_plugin_classic.py \
  126. ui_carla_plugin_compact.py \
  127. ui_carla_plugin_default.py \
  128. ui_carla_plugin_presets.py \
  129. ui_carla_settings.py \
  130. ui_carla_settings_driver.py \
  131. ui_inputdialog_value.py \
  132. ui_midipattern.py \
  133. ui_xycontroller.py
  134. # ---------------------------------------------------------------------------------------------------------------------
  135. all: $(BINDIR)/libcarla_frontend$(LIB_EXT) $(QMs) $(RES) $(UIs)
  136. # ---------------------------------------------------------------------------------------------------------------------
  137. %_ui.hpp: %.ui
  138. $(UIC_QT5) $< -o $@
  139. %_ui.py: %.ui
  140. $(PYUIC) $< -o $@
  141. ui_%.py: $(RESDIR)/ui/%.ui
  142. $(PYUIC) $< -o $@
  143. resources_rc.py: $(RESDIR)/resources.qrc $(RESDIR)/*/*.png $(RESDIR)/*/*.svg $(RESDIR)/*/*.svgz
  144. $(PYRCC) $< -o $@
  145. $(BINDIR)/resources/%: %
  146. -@mkdir -p $(BINDIR)/resources
  147. $(LINK) $(CURDIR)/$* $(BINDIR)/resources/
  148. $(BINDIR)/resources/zynaddsubfx: ../native-plugins/resources/zynaddsubfx
  149. -@mkdir -p $(BINDIR)/resources
  150. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  151. $(BINDIR)/resources/zynaddsubfx-ui: ../native-plugins/resources/zynaddsubfx-ui
  152. -@mkdir -p $(BINDIR)/resources
  153. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  154. # ---------------------------------------------------------------------------------------------------------------------
  155. $(BINDIR)/libcarla_frontend$(LIB_EXT): $(OBJS) $(LIBS)
  156. -@mkdir -p $(BINDIR)
  157. @echo "Linking libcarla_frontend$(LIB_EXT)"
  158. $(SILENT)$(CXX) $(OBJS) $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) $(SHARED) -o $@
  159. ifeq ($(MACOS),true)
  160. # FIXME this does not work: -Wl,-rpath,@loader_path
  161. $(SILENT)install_name_tool -change ../../../bin/libcarla_utils.dylib @loader_path/libcarla_utils.dylib $@
  162. endif
  163. $(OBJDIR)/%.cpp.o: %.cpp $(UIs)
  164. -@mkdir -p $(shell dirname $@)
  165. @echo "Compiling $<"
  166. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  167. -include $(OBJS:%.o=%.d)
  168. # ---------------------------------------------------------------------------------------------------------------------
  169. clean:
  170. rm -rf $(BINDIR)/libcarla_frontend$(LIB_EXT) $(UIs) $(RES) $(QMs) __pycache__ *.pyc
  171. # old files
  172. rm -f ui_carla_about_juce.py
  173. rm -f ui_carla_add_jack.py
  174. rm -f ui_carla_database.py
  175. rm -f ui_carla_refresh.py
  176. debug:
  177. $(MAKE) DEBUG=true
  178. # ---------------------------------------------------------------------------------------------------------------------
  179. lint:
  180. pylint \
  181. --extension-pkg-whitelist=PyQt5 \
  182. --max-line-length=120 \
  183. --max-locals=25 \
  184. --max-statements=100 \
  185. --disable=bare-except,duplicate-code,invalid-name,missing-docstring,too-many-branches,too-many-instance-attributes,too-many-statements \
  186. $(wildcard widgets/*.py)
  187. # ---------------------------------------------------------------------------------------------------------------------
  188. i18n_update: $(TSs)
  189. i18n_release: $(QMs)
  190. translations/%.ts:
  191. @install -d translations
  192. pylupdate5 *.py $(RESDIR)/ui/*.ui -ts $@
  193. %.qm: %.ts
  194. lrelease $< -qm $@
  195. # ---------------------------------------------------------------------------------------------------------------------