Cleanup
[carla.git] / source / bridges-ui / Makefile
blob243bbfa2916f04913845be4ca5354531b411e6fa
1 #!/usr/bin/make -f
2 # Makefile for carla-bridges-ui #
3 # ----------------------------- #
4 # Created by falkTX
7 CWD=..
8 MODULENAME=carla-bridge
9 include $(CWD)/Makefile.mk
11 # ---------------------------------------------------------------------------------------------------------------------
13 BINDIR := $(CWD)/../bin
15 ifeq ($(DEBUG),true)
16 OBJDIR := $(CWD)/../build/bridges-ui/Debug
17 MODULEDIR := $(CWD)/../build/modules/Debug
18 else
19 OBJDIR := $(CWD)/../build/bridges-ui/Release
20 MODULEDIR := $(CWD)/../build/modules/Release
21 endif
23 # ---------------------------------------------------------------------------------------------------------------------
25 BUILD_CXX_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_UI -I. -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/utils -I$(CWD)/modules
26 LINK_FLAGS += $(WATER_LIBS)
28 ifneq ($(WASM),true)
29 ifeq ($(HAIKU),true)
30 LINK_FLAGS += -lpthread
31 else
32 LINK_FLAGS += -pthread
33 endif
34 endif
36 # ---------------------------------------------------------------------------------------------------------------------
38 BUILD_GTK2_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_GTK2 $(X11_FLAGS)
39 LINK_GTK2_FLAGS = $(LINK_FLAGS) $(X11_LIBS) $(LIBDL_LIBS)
41 BUILD_GTK3_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_GTK3 $(X11_FLAGS)
42 LINK_GTK3_FLAGS = $(LINK_FLAGS) $(X11_LIBS) $(LIBDL_LIBS)
44 BUILD_QT4_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_QT4 $(shell pkg-config --cflags QtCore QtGui) $(X11_FLAGS) -I$(OBJDIR) -I$(CWD)/theme -Wno-unused-variable
45 LINK_QT4_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs QtCore QtGui) $(X11_LIBS) $(LIBDL_LIBS)
47 BUILD_QT5_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_QT5 $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) -I$(OBJDIR) -I$(CWD)/theme
48 LINK_QT5_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets) $(LIBDL_LIBS)
50 BUILD_X11_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_X11 $(X11_FLAGS)
51 LINK_X11_FLAGS = $(LINK_FLAGS) $(X11_LIBS) $(LIBDL_LIBS)
53 BUILD_COCOA_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_COCOA -ObjC++
54 LINK_COCOA_FLAGS = $(LINK_FLAGS) -framework Cocoa $(LIBDL_LIBS)
56 BUILD_WINDOWS_FLAGS = $(BUILD_CXX_FLAGS) -DBRIDGE_HWND
57 LINK_WINDOWS_FLAGS = $(LINK_FLAGS) -static -mwindows
59 ifeq ($(MACOS),true)
60 BUILD_GTK2_FLAGS += -ObjC++
61 BUILD_GTK3_FLAGS += -ObjC++
62 endif
64 ifeq ($(TESTBUILD),true)
65 BUILD_QT4_FLAGS += -isystem /usr/include/qt4
66 BUILD_QT5_FLAGS += -isystem /usr/include/qt5
67 BUILD_QT5_FLAGS += -isystem /usr/include/x86_64-linux-gnu/qt5
68 endif
70 # ---------------------------------------------------------------------------------------------------------------------
72 TARGETS += ui_lv2-gtk2
73 TARGETS += ui_lv2-gtk3
75 ifneq ($(MACOS_OR_WINDOWS),true)
76 ifeq ($(HAVE_QT4),true)
77 TARGETS += ui_lv2-qt4
78 endif
80 ifeq ($(HAVE_QT5),true)
81 TARGETS += ui_lv2-qt5
82 endif
84 ifeq ($(HAVE_X11),true)
85 TARGETS += ui_lv2-x11
86 endif
87 endif
89 ifeq ($(MACOS),true)
90 TARGETS += ui_lv2-cocoa
91 endif
93 ifeq ($(WINDOWS),true)
94 TARGETS += ui_lv2-windows
95 endif
97 # ---------------------------------------------------------------------------------------------------------------------
99 all: $(TARGETS)
101 # ---------------------------------------------------------------------------------------------------------------------
103 clean:
104 rm -f $(OBJDIR)/*.cpp $(OBJDIR)/*.moc $(OBJDIR)/*.o
105 rm -f $(BINDIR)/$(MODULENAME)-lv2-gtk*
106 rm -f $(BINDIR)/$(MODULENAME)-lv2-qt*
107 rm -f $(BINDIR)/$(MODULENAME)-lv2-cocoa
108 rm -f $(BINDIR)/$(MODULENAME)-lv2-x11
109 rm -f $(BINDIR)/$(MODULENAME)-lv2-windows
111 debug:
112 $(MAKE) DEBUG=true
114 doxygen: carla_bridge.doxygen
115 doxygen $<
117 # ---------------------------------------------------------------------------------------------------------------------
119 ui_lv2-gtk2: $(BINDIR)/$(MODULENAME)-lv2-gtk2$(APP_EXT)
120 ui_lv2-gtk3: $(BINDIR)/$(MODULENAME)-lv2-gtk3$(APP_EXT)
121 ui_lv2-qt4: $(BINDIR)/$(MODULENAME)-lv2-qt4$(APP_EXT)
122 ui_lv2-qt5: $(BINDIR)/$(MODULENAME)-lv2-qt5$(APP_EXT)
123 ui_lv2-x11: $(BINDIR)/$(MODULENAME)-lv2-x11$(APP_EXT)
124 ui_lv2-cocoa: $(BINDIR)/$(MODULENAME)-lv2-cocoa$(APP_EXT)
125 ui_lv2-windows: $(BINDIR)/$(MODULENAME)-lv2-windows$(APP_EXT)
127 # ---------------------------------------------------------------------------------------------------------------------
128 # Common libs
130 LIBS = \
131 $(MODULEDIR)/lilv.a \
132 $(MODULEDIR)/water.files.a
134 # ---------------------------------------------------------------------------------------------------------------------
135 # Common objects
137 $(OBJDIR)/%.cpp.o: %.cpp
138 -@mkdir -p $(OBJDIR)
139 @echo "Compiling $<"
140 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
142 # ---------------------------------------------------------------------------------------------------------------------
143 # ui_lv2-gtk2
145 OBJS_GTK2 = \
146 $(OBJDIR)/CarlaBridgeFormat.cpp.o \
147 $(OBJDIR)/CarlaBridgeFormatLV2.cpp-gtk2.o \
148 $(OBJDIR)/CarlaBridgeToolkitGtk.cpp-gtk2.o
150 $(BINDIR)/$(MODULENAME)-lv2-gtk2$(APP_EXT): $(OBJS_GTK2) $(LIBS)
151 -@mkdir -p $(BINDIR)
152 @echo "Linking $(MODULENAME)-lv2-gtk2$(APP_EXT)"
153 $(SILENT)$(CXX) $(OBJS_GTK2) $(BUILD_CXX_FLAGS) $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_GTK2_FLAGS) -o $@
155 $(OBJDIR)/%.cpp-gtk2.o: %.cpp
156 -@mkdir -p $(OBJDIR)
157 @echo "Compiling $< (GTK2)"
158 $(SILENT)$(CXX) $< $(BUILD_GTK2_FLAGS) -c -o $@
160 -include $(OBJS_GTK2:%.o=%.d)
162 # ---------------------------------------------------------------------------------------------------------------------
163 # ui_lv2-gtk3
165 OBJS_GTK3 = \
166 $(OBJDIR)/CarlaBridgeFormat.cpp.o \
167 $(OBJDIR)/CarlaBridgeFormatLV2.cpp-gtk3.o \
168 $(OBJDIR)/CarlaBridgeToolkitGtk.cpp-gtk3.o
170 $(BINDIR)/$(MODULENAME)-lv2-gtk3$(APP_EXT): $(OBJS_GTK3) $(LIBS)
171 -@mkdir -p $(BINDIR)
172 @echo "Linking $(MODULENAME)-lv2-gtk3$(APP_EXT)"
173 $(SILENT)$(CXX) $(OBJS_GTK3) $(BUILD_CXX_FLAGS) $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_GTK3_FLAGS) -o $@
175 $(OBJDIR)/%.cpp-gtk3.o: %.cpp
176 -@mkdir -p $(OBJDIR)
177 @echo "Compiling $< (GTK3)"
178 $(SILENT)$(CXX) $< $(BUILD_GTK3_FLAGS) -c -o $@
180 -include $(OBJS_GTK3:%.o=%.d)
182 # ---------------------------------------------------------------------------------------------------------------------
183 # ui_lv2-qt4
185 OBJS_QT4 = \
186 $(OBJDIR)/CarlaBridgeFormat.cpp.o \
187 $(OBJDIR)/CarlaBridgeFormatLV2.cpp-qt4.o \
188 $(OBJDIR)/CarlaBridgeToolkitQt.cpp-qt4.o
190 $(BINDIR)/$(MODULENAME)-lv2-qt4$(APP_EXT): $(OBJS_QT4) $(LIBS) $(MODULEDIR)/theme.qt4.a
191 -@mkdir -p $(BINDIR)
192 @echo "Linking $(MODULENAME)-lv2-qt4$(APP_EXT)"
193 $(SILENT)$(CXX) $(OBJS_QT4) $(BUILD_CXX_FLAGS) $(LIBS_START) $(LIBS) $(LIBS_END) $(MODULEDIR)/theme.qt4.a $(LINK_QT4_FLAGS) -o $@
195 $(OBJDIR)/%.cpp-qt4.o: %.cpp $(OBJDIR)/CarlaBridgeToolkitQt4.moc $(OBJDIR)/resources.qt4.cpp
196 -@mkdir -p $(OBJDIR)
197 @echo "Compiling $< (QT4)"
198 $(SILENT)$(CXX) $< $(BUILD_QT4_FLAGS) -c -o $@
200 $(OBJDIR)/CarlaBridgeToolkitQt4.moc: CarlaBridgeToolkitQt.cpp
201 -@mkdir -p $(OBJDIR)
202 @echo "Generating CarlaBridgeToolkitQt4.moc"
203 $(SILENT)$(MOC_QT4) $< -DMOC_PARSING -o $@
205 $(OBJDIR)/resources.qt4.cpp: ../../resources/resources-theme.qrc
206 -@mkdir -p $(OBJDIR)
207 @echo "Generating resources.qt4.cpp"
208 $(SILENT)$(RCC_QT4) $< -o $@
210 -include $(OBJS_QT4:%.o=%.d)
212 # ---------------------------------------------------------------------------------------------------------------------
213 # ui_lv2-qt5
215 OBJS_QT5 = \
216 $(OBJDIR)/CarlaBridgeFormat.cpp.o \
217 $(OBJDIR)/CarlaBridgeFormatLV2.cpp-qt5.o \
218 $(OBJDIR)/CarlaBridgeToolkitQt.cpp-qt5.o
220 $(BINDIR)/$(MODULENAME)-lv2-qt5$(APP_EXT): $(OBJS_QT5) $(LIBS) $(MODULEDIR)/theme.qt5.a
221 -@mkdir -p $(BINDIR)
222 @echo "Linking $(MODULENAME)-lv2-qt5$(APP_EXT)"
223 $(SILENT)$(CXX) $(OBJS_QT5) $(BUILD_CXX_FLAGS) $(LIBS_START) $(LIBS) $(LIBS_END) $(MODULEDIR)/theme.qt5.a $(LINK_QT5_FLAGS) -o $@
225 $(OBJDIR)/%.cpp-qt5.o: %.cpp $(OBJDIR)/CarlaBridgeToolkitQt5.moc $(OBJDIR)/resources.qt5.cpp
226 -@mkdir -p $(OBJDIR)
227 @echo "Compiling $< (QT5)"
228 $(SILENT)$(CXX) $< $(BUILD_QT5_FLAGS) -c -o $@
230 $(OBJDIR)/CarlaBridgeToolkitQt5.moc: CarlaBridgeToolkitQt.cpp
231 -@mkdir -p $(OBJDIR)
232 @echo "Generating CarlaBridgeToolkitQt5.moc"
233 $(SILENT)$(MOC_QT5) $< -DMOC_PARSING -o $@
235 $(OBJDIR)/resources.qt5.cpp: ../../resources/resources-theme.qrc
236 -@mkdir -p $(OBJDIR)
237 @echo "Generating resources.qt5.cpp"
238 $(SILENT)$(RCC_QT5) $< -o $@
240 -include $(OBJS_QT5:%.o=%.d)
242 # ---------------------------------------------------------------------------------------------------------------------
243 # ui_lv2-x11
245 OBJS_X11 = \
246 $(OBJDIR)/CarlaBridgeFormat.cpp.o \
247 $(OBJDIR)/CarlaBridgeFormatLV2.cpp-x11.o \
248 $(OBJDIR)/CarlaBridgeToolkitNative.cpp-x11.o
250 $(BINDIR)/$(MODULENAME)-lv2-x11$(APP_EXT): $(OBJS_X11) $(LIBS)
251 -@mkdir -p $(BINDIR)
252 @echo "Linking $(MODULENAME)-lv2-x11$(APP_EXT)"
253 $(SILENT)$(CXX) $(OBJS_X11) $(BUILD_CXX_FLAGS) $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_X11_FLAGS) -o $@
255 $(OBJDIR)/%.cpp-x11.o: %.cpp
256 -@mkdir -p $(OBJDIR)
257 @echo "Compiling $< (X11)"
258 $(SILENT)$(CXX) $< $(BUILD_X11_FLAGS) -c -o $@
260 -include $(OBJS_X11:%.o=%.d)
262 # ---------------------------------------------------------------------------------------------------------------------
263 # ui_lv2-cocoa
265 OBJS_COCOA = \
266 $(OBJDIR)/CarlaBridgeFormat.cpp.o \
267 $(OBJDIR)/CarlaBridgeFormatLV2.cpp-cocoa.o \
268 $(OBJDIR)/CarlaBridgeToolkitNative.cpp-cocoa.o
270 $(BINDIR)/$(MODULENAME)-lv2-cocoa$(APP_EXT): $(OBJS_COCOA) $(LIBS)
271 -@mkdir -p $(BINDIR)
272 @echo "Linking $(MODULENAME)-lv2-cocoa$(APP_EXT)"
273 $(SILENT)$(CXX) $(OBJS_COCOA) $(BUILD_CXX_FLAGS) $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_COCOA_FLAGS) -o $@
275 $(OBJDIR)/%.cpp-cocoa.o: %.cpp
276 -@mkdir -p $(OBJDIR)
277 @echo "Compiling $< (Cocoa)"
278 $(SILENT)$(CXX) $< $(BUILD_COCOA_FLAGS) -c -o $@
280 -include $(OBJS_COCOA:%.o=%.d)
282 # ---------------------------------------------------------------------------------------------------------------------
283 # ui_lv2-windows
285 OBJS_WINDOWS = \
286 $(OBJDIR)/CarlaBridgeFormat.cpp.o \
287 $(OBJDIR)/CarlaBridgeFormatLV2.cpp-windows.o \
288 $(OBJDIR)/CarlaBridgeToolkitNative.cpp-windows.o
290 $(BINDIR)/$(MODULENAME)-lv2-windows$(APP_EXT): $(OBJS_WINDOWS) $(LIBS)
291 -@mkdir -p $(BINDIR)
292 @echo "Linking $(MODULENAME)-lv2-windows$(APP_EXT)"
293 $(SILENT)$(CXX) $(OBJS_WINDOWS) $(BUILD_CXX_FLAGS) $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_WINDOWS_FLAGS) -o $@
295 $(OBJDIR)/%.cpp-windows.o: %.cpp
296 -@mkdir -p $(OBJDIR)
297 @echo "Compiling $< (Windows)"
298 $(SILENT)$(CXX) $< $(BUILD_WINDOWS_FLAGS) -c -o $@
300 -include $(OBJS_WINDOWS:%.o=%.d)
302 # ---------------------------------------------------------------------------------------------------------------------