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.

Makefile 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. 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. DIALOG_UI_FILES = $(wildcard dialogs/*.ui)
  113. PLUGINLIST_UI_FILES = $(wildcard pluginlist/*.ui)
  114. UIs = $(DIALOG_UI_FILES:dialogs/%.ui=dialogs/ui_%.h)
  115. UIs += $(PLUGINLIST_UI_FILES:pluginlist/%.ui=pluginlist/ui_%.h)
  116. UIs += $(DIALOG_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. dialogs/ui_%.h: dialogs/%.ui
  138. $(UIC_QT5) $< -o $@
  139. pluginlist/ui_%.h: pluginlist/%.ui
  140. $(UIC_QT5) $< -o $@
  141. %_ui.py: %.ui
  142. $(PYUIC) $< -o $@
  143. ui_%.py: $(RESDIR)/ui/%.ui
  144. $(PYUIC) $< -o $@
  145. resources_rc.py: $(RESDIR)/resources.qrc $(RESDIR)/*/*.png $(RESDIR)/*/*.svg $(RESDIR)/*/*.svgz
  146. $(PYRCC) $< -o $@
  147. test: $(OBJS) $(LIBS) test.cpp
  148. @echo "Linking test"
  149. $(SILENT)$(CXX) $(OBJS) test.cpp $(BUILD_CXX_FLAGS) -Wl,-rpath,$(abspath $(BINDIR)) $(QT5_LINK_FLAGS) -o $@
  150. $(BINDIR)/resources/%: %
  151. -@mkdir -p $(BINDIR)/resources
  152. $(LINK) $(CURDIR)/$* $(BINDIR)/resources/
  153. $(BINDIR)/resources/zynaddsubfx: ../native-plugins/resources/zynaddsubfx
  154. -@mkdir -p $(BINDIR)/resources
  155. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  156. $(BINDIR)/resources/zynaddsubfx-ui: ../native-plugins/resources/zynaddsubfx-ui
  157. -@mkdir -p $(BINDIR)/resources
  158. $(LINK) $(CURDIR)/$< $(BINDIR)/resources/
  159. # ---------------------------------------------------------------------------------------------------------------------
  160. $(BINDIR)/libcarla_frontend$(LIB_EXT): $(OBJS) $(LIBS)
  161. -@mkdir -p $(BINDIR)
  162. @echo "Linking libcarla_frontend$(LIB_EXT)"
  163. $(SILENT)$(CXX) $(OBJS) $(BUILD_CXX_FLAGS) $(QT5_LINK_FLAGS) $(SHARED) -o $@
  164. ifeq ($(MACOS),true)
  165. # FIXME this does not work: -Wl,-rpath,@loader_path
  166. $(SILENT)install_name_tool -change ../../../bin/libcarla_utils.dylib @loader_path/libcarla_utils.dylib $@
  167. endif
  168. $(OBJDIR)/%.cpp.o: %.cpp $(UIs)
  169. -@mkdir -p $(shell dirname $@)
  170. @echo "Compiling $<"
  171. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  172. -include $(OBJS:%.o=%.d)
  173. # ---------------------------------------------------------------------------------------------------------------------
  174. clean:
  175. rm -rf $(BINDIR)/libcarla_frontend$(LIB_EXT) $(UIs) $(RES) $(QMs) __pycache__ *.pyc
  176. # old files
  177. rm -f ui_carla_about_juce.py
  178. rm -f ui_carla_add_jack.py
  179. rm -f ui_carla_database.py
  180. rm -f ui_carla_refresh.py
  181. debug:
  182. $(MAKE) DEBUG=true
  183. # ---------------------------------------------------------------------------------------------------------------------
  184. lint:
  185. pylint \
  186. --extension-pkg-whitelist=PyQt5 \
  187. --max-line-length=120 \
  188. --max-locals=25 \
  189. --max-statements=100 \
  190. --disable=bare-except,duplicate-code,invalid-name,missing-docstring,too-many-branches,too-many-instance-attributes,too-many-statements \
  191. $(wildcard widgets/*.py)
  192. # ---------------------------------------------------------------------------------------------------------------------
  193. i18n_update: $(TSs)
  194. i18n_release: $(QMs)
  195. translations/%.ts:
  196. @install -d translations
  197. pylupdate5 *.py $(RESDIR)/ui/*.ui -ts $@
  198. %.qm: %.ts
  199. lrelease $< -qm $@
  200. # ---------------------------------------------------------------------------------------------------------------------