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.

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