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