comparison DPF-Prymula-audioplugins/dpf/Makefile.plugins.mk @ 3:84e66ea83026

DPF-Prymula-audioplugins-0.231015-2
author prymula <prymula76@outlook.com>
date Mon, 16 Oct 2023 21:53:34 +0200
parents
children
comparison
equal deleted inserted replaced
2:cf2cb71d31dd 3:84e66ea83026
1 #!/usr/bin/make -f
2 # Makefile for DPF Example Plugins #
3 # -------------------------------- #
4 # Created by falkTX
5 #
6
7 # NOTE: NAME, FILES_DSP and FILES_UI must have been defined before including this file!
8
9 ifeq ($(DPF_PATH),)
10 ifneq (,$(wildcard dpf/Makefile.base.mk))
11 BASE_PATH=.
12 DPF_PATH=dpf
13 else ifneq (,$(wildcard ../dpf/Makefile.base.mk))
14 BASE_PATH=..
15 DPF_PATH=../dpf
16 else ifneq (,$(wildcard ../../dpf/Makefile.base.mk))
17 BASE_PATH=../..
18 DPF_PATH=../../dpf
19 else
20 BASE_PATH=../..
21 DPF_PATH=../..
22 endif
23 endif
24
25 include $(DPF_PATH)/Makefile.base.mk
26
27 # ---------------------------------------------------------------------------------------------------------------------
28 # Basic setup
29
30 ifeq ($(MODGUI_BUILD),true)
31 BUILD_DIR_SUFFIX = -modgui
32 endif
33
34 ifneq ($(DPF_BUILD_DIR),)
35 BUILD_DIR = $(DPF_BUILD_DIR)$(BUILD_DIR_SUFFIX)
36 else
37 BUILD_DIR = $(BASE_PATH)/build$(BUILD_DIR_SUFFIX)/$(NAME)
38 endif
39
40 ifneq ($(DPF_TARGET_DIR),)
41 TARGET_DIR = $(DPF_TARGET_DIR)
42 else
43 TARGET_DIR = $(BASE_PATH)/bin
44 endif
45
46 DGL_BUILD_DIR = $(DPF_PATH)/build$(BUILD_DIR_SUFFIX)
47
48 BUILD_C_FLAGS += -I.
49 BUILD_CXX_FLAGS += -I. -I$(DPF_PATH)/distrho -I$(DPF_PATH)/dgl
50
51 ifeq ($(HAVE_ALSA),true)
52 BASE_FLAGS += -DHAVE_ALSA
53 endif
54
55 ifeq ($(HAVE_JACK),true)
56 BASE_FLAGS += -DHAVE_JACK
57 endif
58
59 ifeq ($(HAVE_LIBLO),true)
60 BASE_FLAGS += -DHAVE_LIBLO
61 endif
62
63 ifeq ($(HAVE_PULSEAUDIO),true)
64 BASE_FLAGS += -DHAVE_PULSEAUDIO
65 endif
66
67 ifeq ($(HAVE_RTAUDIO),true)
68 BASE_FLAGS += -DHAVE_RTAUDIO
69 endif
70
71 ifeq ($(HAVE_SDL2),true)
72 BASE_FLAGS += -DHAVE_SDL2
73 endif
74
75 ifneq ($(MODGUI_CLASS_NAME),)
76 BASE_FLAGS += -DDISTRHO_PLUGIN_MODGUI_CLASS_NAME='"$(MODGUI_CLASS_NAME)"'
77 endif
78
79 # always needed
80 ifneq ($(HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS),true)
81 ifneq ($(STATIC_BUILD),true)
82 LINK_FLAGS += -ldl
83 endif
84 endif
85
86 # ---------------------------------------------------------------------------------------------------------------------
87 # JACK/Standalone setup
88
89 ifeq ($(WASM),true)
90
91 JACK_FLAGS += -sUSE_SDL=2
92 JACK_LIBS += -sUSE_SDL=2
93 JACK_LIBS += -sMAIN_MODULE -ldl
94
95 ifneq ($(FILE_BROWSER_DISABLED),true)
96 JACK_LIBS += -sEXPORTED_RUNTIME_METHODS=FS,cwrap
97 endif
98
99 else ifneq ($(SKIP_RTAUDIO_FALLBACK),true)
100
101 JACK_FLAGS += -DHAVE_GETTIMEOFDAY
102
103 ifeq ($(MACOS),true)
104 JACK_LIBS += -framework CoreAudio -framework CoreFoundation -framework CoreMIDI
105 else ifeq ($(WINDOWS),true)
106 JACK_LIBS += -lole32 -lwinmm
107 # DirectSound
108 # JACK_LIBS += -ldsound
109 # WASAPI
110 JACK_LIBS += -lksuser -lmfplat -lmfuuid -lwmcodecdspuuid
111 else
112 ifeq ($(HAVE_PULSEAUDIO),true)
113 JACK_FLAGS += $(PULSEAUDIO_FLAGS)
114 JACK_LIBS += $(PULSEAUDIO_LIBS)
115 endif
116 ifeq ($(HAVE_ALSA),true)
117 JACK_FLAGS += $(ALSA_FLAGS)
118 JACK_LIBS += $(ALSA_LIBS)
119 endif
120 endif
121
122 ifeq ($(HAVE_RTAUDIO),true)
123 ifneq ($(HAIKU),true)
124 JACK_LIBS += -lpthread
125 endif
126 endif
127
128 ifeq ($(HAVE_SDL2),true)
129 JACK_FLAGS += $(SDL2_FLAGS)
130 JACK_LIBS += $(SDL2_LIBS)
131 endif
132
133 endif
134
135 # ---------------------------------------------------------------------------------------------------------------------
136 # Set files to build
137
138 OBJS_DSP = $(FILES_DSP:%=$(BUILD_DIR)/%.o)
139 OBJS_UI = $(FILES_UI:%=$(BUILD_DIR)/%.o)
140
141 ifeq ($(MACOS),true)
142 OBJS_UI += $(BUILD_DIR)/DistrhoUI_macOS_$(NAME).mm.o
143 endif
144
145 # ---------------------------------------------------------------------------------------------------------------------
146 # Handle UI stuff, disable UI support automatically
147
148 ifeq ($(FILES_UI),)
149 HAVE_DGL = false
150 UI_TYPE = none
151 endif
152
153 ifeq ($(UI_TYPE),)
154 UI_TYPE = opengl
155 endif
156
157 ifeq ($(UI_TYPE),generic)
158 ifeq ($(HAVE_OPENGL),true)
159 UI_TYPE = opengl
160 else ifeq ($(HAVE_CAIRO),true)
161 UI_TYPE = cairo
162 endif
163 endif
164
165 ifeq ($(UI_TYPE),cairo)
166 ifeq ($(HAVE_CAIRO),true)
167 DGL_FLAGS += -DDGL_CAIRO -DHAVE_DGL
168 DGL_FLAGS += $(CAIRO_FLAGS)
169 DGL_LIBS += $(CAIRO_LIBS)
170 DGL_LIB = $(DGL_BUILD_DIR)/libdgl-cairo.a
171 HAVE_DGL = true
172 else
173 HAVE_DGL = false
174 endif
175 endif
176
177 ifeq ($(UI_TYPE),opengl)
178 ifeq ($(HAVE_OPENGL),true)
179 DGL_FLAGS += -DDGL_OPENGL -DHAVE_DGL
180 DGL_FLAGS += $(OPENGL_FLAGS)
181 DGL_LIBS += $(OPENGL_LIBS)
182 DGL_LIB = $(DGL_BUILD_DIR)/libdgl-opengl.a
183 HAVE_DGL = true
184 else
185 HAVE_DGL = false
186 endif
187 endif
188
189 ifeq ($(UI_TYPE),opengl3)
190 ifeq ($(HAVE_OPENGL),true)
191 DGL_FLAGS += -DDGL_OPENGL -DDGL_USE_OPENGL3 -DHAVE_DGL
192 DGL_FLAGS += $(OPENGL_FLAGS)
193 DGL_LIBS += $(OPENGL_LIBS)
194 DGL_LIB = $(DGL_BUILD_DIR)/libdgl-opengl3.a
195 HAVE_DGL = true
196 else
197 HAVE_DGL = false
198 endif
199 endif
200
201 ifeq ($(UI_TYPE),vulkan)
202 ifeq ($(HAVE_VULKAN),true)
203 DGL_FLAGS += -DDGL_VULKAN -DHAVE_DGL
204 DGL_FLAGS += $(VULKAN_FLAGS)
205 DGL_LIBS += $(VULKAN_LIBS)
206 DGL_LIB = $(DGL_BUILD_DIR)/libdgl-vulkan.a
207 HAVE_DGL = true
208 else
209 HAVE_DGL = false
210 endif
211 endif
212
213 ifeq ($(UI_TYPE),external)
214 DGL_FLAGS += -DDGL_EXTERNAL
215 HAVE_DGL = true
216 endif
217
218 ifeq ($(UI_TYPE),stub)
219 ifeq ($(HAVE_STUB),true)
220 DGL_LIB = $(DGL_BUILD_DIR)/libdgl-stub.a
221 HAVE_DGL = true
222 else
223 HAVE_DGL = false
224 endif
225 endif
226
227 DGL_LIBS += $(DGL_SYSTEM_LIBS) -lm
228
229 # TODO split dsp and ui object build flags
230 BASE_FLAGS += $(DGL_FLAGS)
231
232 # ---------------------------------------------------------------------------------------------------------------------
233 # Set CLAP filename, either single binary or inside a bundle
234
235 ifeq ($(MACOS),true)
236 CLAP_FILENAME = $(NAME).clap/$(CLAP_BINARY_DIR)/$(NAME)
237 else ifeq ($(USE_CLAP_BUNDLE),true)
238 CLAP_FILENAME = $(NAME).clap/$(NAME).clap
239 else
240 CLAP_FILENAME = $(NAME).clap
241 endif
242
243 # ---------------------------------------------------------------------------------------------------------------------
244 # Set VST2 filename, either single binary or inside a bundle
245
246 ifeq ($(MACOS),true)
247 VST2_FILENAME = $(NAME).vst/$(VST2_BINARY_DIR)/$(NAME)
248 else ifeq ($(USE_VST2_BUNDLE),true)
249 VST2_FILENAME = $(NAME).vst/$(NAME)$(LIB_EXT)
250 else
251 VST2_FILENAME = $(NAME)-vst$(LIB_EXT)
252 endif
253
254 # ---------------------------------------------------------------------------------------------------------------------
255 # Set VST3 filename, see https://vst3sdk-doc.diatonic.jp/doc/vstinterfaces/vst3loc.html
256
257 ifeq ($(LINUX),true)
258 VST3_FILENAME = $(NAME).vst3/$(VST3_BINARY_DIR)/$(NAME)$(LIB_EXT)
259 else ifeq ($(MACOS),true)
260 VST3_FILENAME = $(NAME).vst3/$(VST3_BINARY_DIR)/$(NAME)
261 else ifneq ($(VST3_BINARY_DIR),)
262 VST3_FILENAME = $(NAME).vst3/$(VST3_BINARY_DIR)/$(NAME).vst3
263 endif
264
265 # ---------------------------------------------------------------------------------------------------------------------
266 # Set plugin binary file targets
267
268 ifeq ($(MACOS)$(HAVE_DGL),truetrue)
269 MACOS_APP_BUNDLE = true
270 endif
271
272 ifeq ($(WINDOWS)$(HAVE_DGL),truetrue)
273 JACK_LIBS += -Wl,-subsystem,windows
274 endif
275
276 ifeq ($(MACOS_APP_BUNDLE),true)
277 jack = $(TARGET_DIR)/$(NAME).app/Contents/MacOS/$(NAME)
278 jackfiles = $(TARGET_DIR)/$(NAME).app/Contents/Info.plist
279 else
280 jack = $(TARGET_DIR)/$(NAME)$(APP_EXT)
281 endif
282
283 ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT)
284 dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi$(LIB_EXT)
285 dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui$(APP_EXT)
286 lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT)
287 lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT)
288 lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT)
289 vst2 = $(TARGET_DIR)/$(VST2_FILENAME)
290 ifneq ($(VST3_FILENAME),)
291 vst3 = $(TARGET_DIR)/$(VST3_FILENAME)
292 endif
293 clap = $(TARGET_DIR)/$(CLAP_FILENAME)
294 shared = $(TARGET_DIR)/$(NAME)$(LIB_EXT)
295 static = $(TARGET_DIR)/$(NAME).a
296
297 ifeq ($(MACOS),true)
298 BUNDLE_RESOURCES = Info.plist PkgInfo Resources/empty.lproj
299 vst2files += $(BUNDLE_RESOURCES=%:$(TARGET_DIR)/$(NAME).vst/Contents/%)
300 vst3files += $(BUNDLE_RESOURCES=%:$(TARGET_DIR)/$(NAME).vst3/Contents/%)
301 clapfiles += $(BUNDLE_RESOURCES=%:$(TARGET_DIR)/$(NAME).clap/Contents/%)
302 endif
303
304 ifneq ($(HAVE_DGL),true)
305 dssi_ui =
306 lv2_ui =
307 DGL_LIBS =
308 OBJS_UI =
309 endif
310
311 ifneq ($(HAVE_LIBLO),true)
312 dssi_ui =
313 endif
314
315 # ---------------------------------------------------------------------------------------------------------------------
316 # Set plugin symbols to export
317
318 ifeq ($(MACOS),true)
319 SYMBOLS_LADSPA = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/ladspa.exp
320 SYMBOLS_DSSI = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/dssi.exp
321 SYMBOLS_LV2DSP = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/lv2-dsp.exp
322 SYMBOLS_LV2UI = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/lv2-ui.exp
323 SYMBOLS_LV2 = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/lv2.exp
324 SYMBOLS_VST2 = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/vst2.exp
325 SYMBOLS_VST3 = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/vst3.exp
326 SYMBOLS_CLAP = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/clap.exp
327 SYMBOLS_SHARED = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/shared.exp
328 else ifeq ($(WASM),true)
329 SYMBOLS_LADSPA = -sEXPORTED_FUNCTIONS="['ladspa_descriptor']"
330 SYMBOLS_DSSI = -sEXPORTED_FUNCTIONS="['ladspa_descriptor','dssi_descriptor']"
331 SYMBOLS_LV2DSP = -sEXPORTED_FUNCTIONS="['lv2_descriptor','lv2_generate_ttl']"
332 SYMBOLS_LV2UI = -sEXPORTED_FUNCTIONS="['lv2ui_descriptor']"
333 SYMBOLS_LV2 = -sEXPORTED_FUNCTIONS="['lv2_descriptor','lv2_generate_ttl','lv2ui_descriptor']"
334 SYMBOLS_VST2 = -sEXPORTED_FUNCTIONS="['VSTPluginMain']"
335 SYMBOLS_VST3 = -sEXPORTED_FUNCTIONS="['GetPluginFactory','ModuleEntry','ModuleExit']"
336 SYMBOLS_CLAP = -sEXPORTED_FUNCTIONS="['clap_entry']"
337 SYMBOLS_SHARED = -sEXPORTED_FUNCTIONS="['createSharedPlugin']"
338 else ifeq ($(WINDOWS),true)
339 SYMBOLS_LADSPA = $(DPF_PATH)/utils/symbols/ladspa.def
340 SYMBOLS_DSSI = $(DPF_PATH)/utils/symbols/dssi.def
341 SYMBOLS_LV2DSP = $(DPF_PATH)/utils/symbols/lv2-dsp.def
342 SYMBOLS_LV2UI = $(DPF_PATH)/utils/symbols/lv2-ui.def
343 SYMBOLS_LV2 = $(DPF_PATH)/utils/symbols/lv2.def
344 SYMBOLS_VST2 = $(DPF_PATH)/utils/symbols/vst2.def
345 SYMBOLS_VST3 = $(DPF_PATH)/utils/symbols/vst3.def
346 SYMBOLS_CLAP = $(DPF_PATH)/utils/symbols/clap.def
347 SYMBOLS_SHARED = $(DPF_PATH)/utils/symbols/shared.def
348 else ifneq ($(DEBUG),true)
349 SYMBOLS_LADSPA = -Wl,--version-script=$(DPF_PATH)/utils/symbols/ladspa.version
350 SYMBOLS_DSSI = -Wl,--version-script=$(DPF_PATH)/utils/symbols/dssi.version
351 SYMBOLS_LV2DSP = -Wl,--version-script=$(DPF_PATH)/utils/symbols/lv2-dsp.version
352 SYMBOLS_LV2UI = -Wl,--version-script=$(DPF_PATH)/utils/symbols/lv2-ui.version
353 SYMBOLS_LV2 = -Wl,--version-script=$(DPF_PATH)/utils/symbols/lv2.version
354 SYMBOLS_VST2 = -Wl,--version-script=$(DPF_PATH)/utils/symbols/vst2.version
355 SYMBOLS_VST3 = -Wl,--version-script=$(DPF_PATH)/utils/symbols/vst3.version
356 SYMBOLS_CLAP = -Wl,--version-script=$(DPF_PATH)/utils/symbols/clap.version
357 SYMBOLS_SHARED = -Wl,--version-script=$(DPF_PATH)/utils/symbols/shared.version
358 endif
359
360 # ---------------------------------------------------------------------------------------------------------------------
361 # Runtime test build
362
363 ifeq ($(DPF_RUNTIME_TESTING),true)
364 BUILD_CXX_FLAGS += -DDPF_RUNTIME_TESTING -Wno-pmf-conversions
365 endif
366
367 # ---------------------------------------------------------------------------------------------------------------------
368 # all needs to be first
369
370 all:
371
372 # ---------------------------------------------------------------------------------------------------------------------
373 # Common
374
375 $(BUILD_DIR)/%.S.o: %.S
376 -@mkdir -p "$(shell dirname $@)"
377 @echo "Compiling $<"
378 @$(CC) $< $(BUILD_C_FLAGS) -c -o $@
379
380 $(BUILD_DIR)/%.c.o: %.c
381 -@mkdir -p "$(shell dirname $@)"
382 @echo "Compiling $<"
383 $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@
384
385 $(BUILD_DIR)/%.cc.o: %.cc
386 -@mkdir -p "$(shell dirname $@)"
387 @echo "Compiling $<"
388 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
389
390 $(BUILD_DIR)/%.cpp.o: %.cpp
391 -@mkdir -p "$(shell dirname $@)"
392 @echo "Compiling $<"
393 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
394
395 $(BUILD_DIR)/%.m.o: %.m
396 -@mkdir -p "$(shell dirname $@)"
397 @echo "Compiling $<"
398 $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -ObjC -c -o $@
399
400 $(BUILD_DIR)/%.mm.o: %.mm
401 -@mkdir -p "$(shell dirname $@)"
402 @echo "Compiling $<"
403 $(SILENT)$(CC) $< $(BUILD_CXX_FLAGS) -ObjC++ -c -o $@
404
405 clean:
406 rm -rf $(BUILD_DIR)
407 ifeq ($(DPF_BUILD_DIR),)
408 rm -rf $(BASE_PATH)/build-modgui/$(NAME)
409 rm -rf $(DPF_PATH)/build-modgui
410 endif
411 rm -rf $(TARGET_DIR)/$(NAME)
412 rm -rf $(TARGET_DIR)/$(NAME)-*
413 rm -rf $(TARGET_DIR)/$(NAME).lv2
414 rm -rf $(TARGET_DIR)/$(NAME).vst
415 rm -rf $(TARGET_DIR)/$(NAME).vst3
416 rm -rf $(TARGET_DIR)/$(NAME).clap
417
418 # ---------------------------------------------------------------------------------------------------------------------
419 # DGL
420
421 DGL_POSSIBLE_DEPS = \
422 $(DPF_PATH)/dgl/*.* \
423 $(DPF_PATH)/dgl/src/*.* \
424 $(DPF_PATH)/dgl/src/nanovg/*.* \
425 $(DPF_PATH)/dgl/src/pugl-extra/*.* \
426 $(DPF_PATH)/dgl/src/pugl-upstream/include/pugl/*.* \
427 $(DPF_PATH)/dgl/src/pugl-upstream/src/*.*
428
429 $(DGL_BUILD_DIR)/libdgl-cairo.a: $(DGL_POSSIBLE_DEPS)
430 $(MAKE) -C $(DPF_PATH)/dgl cairo
431
432 $(DGL_BUILD_DIR)/libdgl-opengl.a: $(DGL_POSSIBLE_DEPS)
433 $(MAKE) -C $(DPF_PATH)/dgl opengl
434
435 $(DGL_BUILD_DIR)/libdgl-opengl3.a: $(DGL_POSSIBLE_DEPS)
436 $(MAKE) -C $(DPF_PATH)/dgl opengl3
437
438 $(DGL_BUILD_DIR)/libdgl-stub.a: $(DGL_POSSIBLE_DEPS)
439 $(MAKE) -C $(DPF_PATH)/dgl stub
440
441 $(DGL_BUILD_DIR)/libdgl-vulkan.a: $(DGL_POSSIBLE_DEPS)
442 $(MAKE) -C $(DPF_PATH)/dgl vulkan
443
444 # ---------------------------------------------------------------------------------------------------------------------
445
446 $(BUILD_DIR)/DistrhoPluginMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp $(EXTRA_DEPENDENCIES) $(EXTRA_DSP_DEPENDENCIES)
447 -@mkdir -p $(BUILD_DIR)
448 @echo "Compiling DistrhoPluginMain.cpp ($*)"
449 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
450
451 $(BUILD_DIR)/DistrhoUIMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp $(EXTRA_DEPENDENCIES) $(EXTRA_UI_DEPENDENCIES)
452 -@mkdir -p $(BUILD_DIR)
453 @echo "Compiling DistrhoUIMain.cpp ($*)"
454 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
455
456 $(BUILD_DIR)/DistrhoUI_macOS_%.mm.o: $(DPF_PATH)/distrho/DistrhoUI_macOS.mm $(EXTRA_DEPENDENCIES) $(EXTRA_UI_DEPENDENCIES)
457 -@mkdir -p $(BUILD_DIR)
458 @echo "Compiling DistrhoUI_macOS.mm ($*)"
459 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -ObjC++ -c -o $@
460
461 $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp $(EXTRA_DEPENDENCIES) $(EXTRA_DSP_DEPENDENCIES)
462 -@mkdir -p $(BUILD_DIR)
463 @echo "Compiling DistrhoPluginMain.cpp (JACK)"
464 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_JACK $(JACK_FLAGS) -c -o $@
465
466 $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp $(EXTRA_DEPENDENCIES) $(EXTRA_UI_DEPENDENCIES)
467 -@mkdir -p $(BUILD_DIR)
468 @echo "Compiling DistrhoUIMain.cpp (DSSI)"
469 $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_DSSI $(LIBLO_FLAGS) -c -o $@
470
471 # ---------------------------------------------------------------------------------------------------------------------
472 # JACK
473
474 jack: $(jack) $(jackfiles)
475
476 ifeq ($(HAVE_DGL),true)
477 $(jack): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.o $(DGL_LIB)
478 else
479 $(jack): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o
480 endif
481 -@mkdir -p $(shell dirname $@)
482 @echo "Creating JACK standalone for $(NAME)"
483 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(JACK_LIBS) -o $@
484
485 # ---------------------------------------------------------------------------------------------------------------------
486 # LADSPA
487
488 ladspa: $(ladspa_dsp)
489
490 $(ladspa_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.o
491 -@mkdir -p $(shell dirname $@)
492 @echo "Creating LADSPA plugin for $(NAME)"
493 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(SHARED) $(SYMBOLS_LADSPA) -o $@
494
495 # ---------------------------------------------------------------------------------------------------------------------
496 # DSSI
497
498 dssi: $(dssi_dsp) $(dssi_ui)
499 dssi_dsp: $(dssi_dsp)
500 dssi_ui: $(dssi_ui)
501
502 $(dssi_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.o
503 -@mkdir -p $(shell dirname $@)
504 @echo "Creating DSSI plugin library for $(NAME)"
505 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(SHARED) $(SYMBOLS_DSSI) -o $@
506
507 $(dssi_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o $(DGL_LIB)
508 -@mkdir -p $(shell dirname $@)
509 @echo "Creating DSSI UI for $(NAME)"
510 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(LIBLO_LIBS) -o $@
511
512 # ---------------------------------------------------------------------------------------------------------------------
513 # LV2
514
515 lv2: $(lv2)
516 lv2_dsp: $(lv2_dsp)
517 lv2_sep: $(lv2_dsp) $(lv2_ui)
518
519 ifeq ($(HAVE_DGL),true)
520 $(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
521 else
522 $(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o
523 endif
524 -@mkdir -p $(shell dirname $@)
525 @echo "Creating LV2 plugin for $(NAME)"
526 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(SHARED) $(SYMBOLS_LV2) -o $@
527
528 $(lv2_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o
529 -@mkdir -p $(shell dirname $@)
530 @echo "Creating LV2 plugin library for $(NAME)"
531 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(SHARED) $(SYMBOLS_LV2DSP) -o $@
532
533 $(lv2_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
534 -@mkdir -p $(shell dirname $@)
535 @echo "Creating LV2 plugin UI for $(NAME)"
536 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(SHARED) $(SYMBOLS_LV2UI) -o $@
537
538 # ---------------------------------------------------------------------------------------------------------------------
539 # LV2 modgui
540
541 ifeq ($(MODGUI_BUILD),true)
542 ifeq ($(MODGUI_CLASS_NAME),)
543 $(error MODGUI_CLASS_NAME undefined)
544 endif
545 endif
546
547 # clear all possible flags coming from DPF, while keeping any extra flags specified for this build
548 MODGUI_IGNORED_FLAGS = -fdata-sections
549 MODGUI_IGNORED_FLAGS += -ffast-math
550 MODGUI_IGNORED_FLAGS += -ffunction-sections
551 MODGUI_IGNORED_FLAGS += -fno-gnu-unique
552 MODGUI_IGNORED_FLAGS += -fprefetch-loop-arrays
553 MODGUI_IGNORED_FLAGS += -fvisibility=hidden
554 MODGUI_IGNORED_FLAGS += -fvisibility-inlines-hidden
555 MODGUI_IGNORED_FLAGS += -fPIC
556 MODGUI_IGNORED_FLAGS += -ldl
557 MODGUI_IGNORED_FLAGS += -mfpmath=sse
558 MODGUI_IGNORED_FLAGS += -msse
559 MODGUI_IGNORED_FLAGS += -msse2
560 MODGUI_IGNORED_FLAGS += -mtune=generic
561 MODGUI_IGNORED_FLAGS += -pipe
562 MODGUI_IGNORED_FLAGS += -std=gnu99
563 MODGUI_IGNORED_FLAGS += -std=gnu++11
564 MODGUI_IGNORED_FLAGS += -DDISTRHO_PLUGIN_MODGUI_CLASS_NAME='"$(MODGUI_CLASS_NAME)"'
565 MODGUI_IGNORED_FLAGS += -DDGL_OPENGL
566 MODGUI_IGNORED_FLAGS += -DGL_SILENCE_DEPRECATION=1
567 MODGUI_IGNORED_FLAGS += -DHAVE_ALSA
568 MODGUI_IGNORED_FLAGS += -DHAVE_DGL
569 MODGUI_IGNORED_FLAGS += -DHAVE_JACK
570 MODGUI_IGNORED_FLAGS += -DHAVE_LIBLO
571 MODGUI_IGNORED_FLAGS += -DHAVE_OPENGL
572 MODGUI_IGNORED_FLAGS += -DHAVE_PULSEAUDIO
573 MODGUI_IGNORED_FLAGS += -DHAVE_RTAUDIO
574 MODGUI_IGNORED_FLAGS += -DHAVE_SDL2
575 MODGUI_IGNORED_FLAGS += -DNDEBUG
576 MODGUI_IGNORED_FLAGS += -DPIC
577 MODGUI_IGNORED_FLAGS += -I.
578 MODGUI_IGNORED_FLAGS += -I$(DPF_PATH)/distrho
579 MODGUI_IGNORED_FLAGS += -I$(DPF_PATH)/dgl
580 MODGUI_IGNORED_FLAGS += -I$(MOD_WORKDIR)/modduo-static/staging/usr/include
581 MODGUI_IGNORED_FLAGS += -I$(MOD_WORKDIR)/modduox-static/staging/usr/include
582 MODGUI_IGNORED_FLAGS += -I$(MOD_WORKDIR)/moddwarf/staging/usr/include
583 MODGUI_IGNORED_FLAGS += -L$(MOD_WORKDIR)/modduo-static/staging/usr/lib
584 MODGUI_IGNORED_FLAGS += -L$(MOD_WORKDIR)/modduox-static/staging/usr/lib
585 MODGUI_IGNORED_FLAGS += -L$(MOD_WORKDIR)/moddwarf/staging/usr/lib
586 MODGUI_IGNORED_FLAGS += -MD
587 MODGUI_IGNORED_FLAGS += -MP
588 MODGUI_IGNORED_FLAGS += -O2
589 MODGUI_IGNORED_FLAGS += -O3
590 MODGUI_IGNORED_FLAGS += -Wall
591 MODGUI_IGNORED_FLAGS += -Wextra
592 MODGUI_IGNORED_FLAGS += -Wl,-O1,--as-needed,--gc-sections
593 MODGUI_IGNORED_FLAGS += -Wl,-dead_strip,-dead_strip_dylibs
594 MODGUI_IGNORED_FLAGS += -Wl,-x
595 MODGUI_IGNORED_FLAGS += -Wl,--gc-sections
596 MODGUI_IGNORED_FLAGS += -Wl,--no-undefined
597 MODGUI_IGNORED_FLAGS += -Wl,--strip-all
598 MODGUI_IGNORED_FLAGS += -Wno-deprecated-declarations
599 MODGUI_IGNORED_FLAGS += $(DGL_FLAGS)
600 MODGUI_CFLAGS = $(filter-out $(MODGUI_IGNORED_FLAGS),$(BUILD_C_FLAGS)) -D__MOD_DEVICES__
601 MODGUI_CXXFLAGS = $(filter-out $(MODGUI_IGNORED_FLAGS),$(BUILD_CXX_FLAGS)) -D__MOD_DEVICES__
602 MODGUI_LDFLAGS = $(filter-out $(MODGUI_IGNORED_FLAGS),$(LINK_FLAGS))
603
604 $(TARGET_DIR)/$(NAME).lv2/modgui/module.js: $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
605 -@mkdir -p $(shell dirname $@)
606 @echo "Creating LV2 plugin modgui for $(NAME)"
607 $(SILENT)$(CXX) $^ $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) \
608 -sALLOW_MEMORY_GROWTH -sALLOW_TABLE_GROWTH -sDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0 -sLZ4=1 \
609 -sMODULARIZE=1 -sMAIN_MODULE=2 \
610 -sEXPORTED_FUNCTIONS="['_malloc','_free','_modgui_init','_modgui_param_set','_modgui_patch_set','_modgui_cleanup']" \
611 -sEXPORTED_RUNTIME_METHODS=['addFunction','lengthBytesUTF8','stringToUTF8','UTF8ToString'] \
612 -sEXPORT_NAME="Module_$(MODGUI_CLASS_NAME)" \
613 -o $@
614
615 modgui:
616 $(MAKE) $(TARGET_DIR)/$(NAME).lv2/modgui/module.js \
617 EXE_WRAPPER= \
618 HAVE_OPENGL=true \
619 MODGUI_BUILD=true \
620 NOOPT=true \
621 PKG_CONFIG=false \
622 USE_GLES2=true \
623 AR=emar \
624 CC=emcc \
625 CXX=em++ \
626 CFLAGS="-O3 $(MODGUI_CFLAGS)" \
627 CXXFLAGS="-O3 $(MODGUI_CXXFLAGS)" \
628 LDFLAGS="-O3 $(MODGUI_LDFLAGS)"
629
630 .PHONY: modgui
631
632 # ---------------------------------------------------------------------------------------------------------------------
633 # VST2
634
635 vst2 vst: $(vst2) $(vst2files)
636
637 ifeq ($(HAVE_DGL),true)
638 $(vst2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_VST2.cpp.o $(BUILD_DIR)/DistrhoUIMain_VST2.cpp.o $(DGL_LIB)
639 else
640 $(vst2): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_VST2.cpp.o
641 endif
642 -@mkdir -p $(shell dirname $@)
643 @echo "Creating VST2 plugin for $(NAME)"
644 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(SHARED) $(SYMBOLS_VST2) -o $@
645
646 # ---------------------------------------------------------------------------------------------------------------------
647 # VST3
648
649 vst3: $(vst3) $(vst3files)
650
651 ifeq ($(HAVE_DGL),true)
652 $(vst3): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_VST3.cpp.o $(BUILD_DIR)/DistrhoUIMain_VST3.cpp.o $(DGL_LIB)
653 else
654 $(vst3): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_VST3.cpp.o
655 endif
656 -@mkdir -p $(shell dirname $@)
657 @echo "Creating VST3 plugin for $(NAME)"
658 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(SHARED) $(SYMBOLS_VST3) -o $@
659
660 # ---------------------------------------------------------------------------------------------------------------------
661 # CLAP
662
663 ifeq ($(HAVE_DGL),true)
664 ifneq ($(HAIKU),true)
665 ifneq ($(WASM),true)
666 CLAP_LIBS = -lpthread
667 endif
668 endif
669 endif
670
671 clap: $(clap) $(clapfiles)
672
673 ifeq ($(HAVE_DGL),true)
674 $(clap): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_CLAP.cpp.o $(BUILD_DIR)/DistrhoUIMain_CLAP.cpp.o $(DGL_LIB)
675 else
676 $(clap): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_CLAP.cpp.o
677 endif
678 -@mkdir -p $(shell dirname $@)
679 @echo "Creating CLAP plugin for $(NAME)"
680 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(CLAP_LIBS) $(SHARED) $(SYMBOLS_CLAP) -o $@
681
682 # ---------------------------------------------------------------------------------------------------------------------
683 # Shared
684
685 shared: $(shared)
686
687 ifeq ($(HAVE_DGL),true)
688 $(shared): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_SHARED.cpp.o $(BUILD_DIR)/DistrhoUIMain_SHARED.cpp.o $(DGL_LIB)
689 else
690 $(shared): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_SHARED.cpp.o
691 endif
692 -@mkdir -p $(shell dirname $@)
693 @echo "Creating shared library for $(NAME)"
694 $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(SHARED) $(SYMBOLS_SHARED) -o $@
695
696 # ---------------------------------------------------------------------------------------------------------------------
697 # Static
698
699 static: $(static)
700
701 ifeq ($(HAVE_DGL),true)
702 $(static): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_STATIC.cpp.o $(BUILD_DIR)/DistrhoUIMain_STATIC.cpp.o
703 else
704 $(static): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_STATIC.cpp.o
705 endif
706 -@mkdir -p $(shell dirname $@)
707 @echo "Creating static library for $(NAME)"
708 $(SILENT)rm -f $@
709 $(SILENT)$(AR) crs $@ $^
710
711 # ---------------------------------------------------------------------------------------------------------------------
712 # macOS files
713
714 $(TARGET_DIR)/%.app/Contents/Info.plist: $(DPF_PATH)/utils/plugin.app/Contents/Info.plist
715 -@mkdir -p $(shell dirname $@)
716 $(SILENT)sed -e "s/@INFO_PLIST_PROJECT_NAME@/$(NAME)/" $< > $@
717
718 $(TARGET_DIR)/%/Contents/Info.plist: $(DPF_PATH)/utils/plugin.bundle/Contents/Info.plist
719 -@mkdir -p $(shell dirname $@)
720 $(SILENT)sed -e "s/@INFO_PLIST_PROJECT_NAME@/$(NAME)/" $< > $@
721
722 $(TARGET_DIR)/%/Contents/PkgInfo: $(DPF_PATH)/utils/plugin.bundle/Contents/PkgInfo
723 -@mkdir -p $(shell dirname $@)
724 $(SILENT)cp $< $@
725
726 $(TARGET_DIR)/%/Resources/empty.lproj: $(DPF_PATH)/utils/plugin.bundle/Contents/Resources/empty.lproj
727 -@mkdir -p $(shell dirname $@)
728 $(SILENT)cp $< $@
729
730 # ---------------------------------------------------------------------------------------------------------------------
731
732 -include $(OBJS_DSP:%.o=%.d)
733 ifneq ($(UI_TYPE),)
734 -include $(OBJS_UI:%.o=%.d)
735 endif
736
737 -include $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.d
738 -include $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.d
739 -include $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.d
740 -include $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.d
741 -include $(BUILD_DIR)/DistrhoPluginMain_VST2.cpp.d
742 -include $(BUILD_DIR)/DistrhoPluginMain_VST3.cpp.d
743 -include $(BUILD_DIR)/DistrhoPluginMain_CLAP.cpp.d
744 -include $(BUILD_DIR)/DistrhoPluginMain_SHARED.cpp.d
745 -include $(BUILD_DIR)/DistrhoPluginMain_STATIC.cpp.d
746
747 -include $(BUILD_DIR)/DistrhoUIMain_JACK.cpp.d
748 -include $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.d
749 -include $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.d
750 -include $(BUILD_DIR)/DistrhoUIMain_VST2.cpp.d
751 -include $(BUILD_DIR)/DistrhoUIMain_VST3.cpp.d
752 -include $(BUILD_DIR)/DistrhoUIMain_CLAP.cpp.d
753 -include $(BUILD_DIR)/DistrhoUIMain_SHARED.cpp.d
754 -include $(BUILD_DIR)/DistrhoUIMain_STATIC.cpp.d
755
756 # ---------------------------------------------------------------------------------------------------------------------